[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable checking headers with Clang Tidy. #46009

Merged
merged 16 commits into from
Sep 22, 2023

Conversation

matanlurey
Copy link
Contributor

Closes flutter/flutter#134969.

Turns out this was literally 1 line. Tested locally:

dart tools/clang_tidy/bin/main.dart \
  --target-variant host_debug_unopt_arm64 \
  --lint-all \
  --checks="-*,llvm-header-guard"
Local Test Results

Here is a tiny snippet showing this is indeed doing something:

[0:02] Jobs:   0% done,   0/1033 completed,  7 in progress, 1019 pending,   7 failed.    
❌ Failures for clang-tidy on /Users/matanl/Developer/engine/src/flutter/display_list/dl_blend_mode.cc:
../../flutter/display_list/dl_blend_mode.h:5:9: error: header guard does not follow preferred style [llvm-header-guard,-warnings-as-errors]
    5 | #ifndef FLUTTER_DISPLAY_LIST_DL_BLEND_MODE_H_
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |         USERS_MATANL_DEVELOPER_ENGINE_SRC_OUT_HOST_DEBUG_UNOPT_ARM64_______FLUTTER_DISPLAY_LIST_DL_BLEND_MODE_H
    6 | #define FLUTTER_DISPLAY_LIST_DL_BLEND_MODE_H_
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |         USERS_MATANL_DEVELOPER_ENGINE_SRC_OUT_HOST_DEBUG_UNOPT_ARM64_______FLUTTER_DISPLAY_LIST_DL_BLEND_MODE_H
^C

This will likely show failures on CI, so I'm following our published directions to get CI to tell me what needs to get fixed, and won't submit until there are no warnings at HEAD. As such, not seeking LGTM yet (draft).

@matanlurey matanlurey force-pushed the engine-clang-tidy-check-headers branch from 5a96a00 to f3376d2 Compare September 19, 2023 02:03
@matanlurey
Copy link
Contributor Author

I need to revert the CI script but I wanted to show the CI logs as-is as part of the review!

@matanlurey matanlurey marked this pull request as ready for review September 22, 2023 01:57
@zanderso
Copy link
Member

Sorry, I'm a little confused about the state we're in. In the CI logs, it doesn't look like there are any lints reported in header files. Does that mean that they're all fixed already?

.clang-tidy Outdated Show resolved Hide resolved
@matanlurey
Copy link
Contributor Author

Sorry, I'm a little confused about the state we're in. In the CI logs, it doesn't look like there are any lints reported in header files. Does that mean that they're all fixed already?

Yup. It took about 20 PRs but we are (currently) green as far as we can tell.

@zanderso
Copy link
Member

Yup. It took about 20 PRs but we are (currently) green as far as we can tell.

Whoa. That's awesome!

Copy link
Member
@zanderso zanderso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM w/ noted cleanup.

matanlurey and others added 2 commits September 22, 2023 09:02
Co-authored-by: Zachary Anderson <zanderso@users.noreply.github.com>
@matanlurey matanlurey added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 22, 2023
@matanlurey matanlurey merged commit 017302b into flutter:main Sep 22, 2023
21 of 26 checks passed
@matanlurey matanlurey deleted the engine-clang-tidy-check-headers branch September 22, 2023 16:30
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 22, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Sep 22, 2023
…135319)

flutter/engine@ef9ceed...92be04f

2023-09-22 skia-flutter-autoroll@skia.org Roll Skia from 8beae2053939 to fe73688dc40f (1 revision) (flutter/engine#46202)
2023-09-22 matanlurey@users.noreply.github.com Enable checking headers with Clang Tidy. (flutter/engine#46009)
2023-09-22 skia-flutter-autoroll@skia.org Roll Skia from f346a813ffd4 to 8beae2053939 (5 revisions) (flutter/engine#46200)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC jonahwilliams@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Mairramer pushed a commit to Mairramer/flutter that referenced this pull request Oct 10, 2023
…lutter#135319)

flutter/engine@ef9ceed...92be04f

2023-09-22 skia-flutter-autoroll@skia.org Roll Skia from 8beae2053939 to fe73688dc40f (1 revision) (flutter/engine#46202)
2023-09-22 matanlurey@users.noreply.github.com Enable checking headers with Clang Tidy. (flutter/engine#46009)
2023-09-22 skia-flutter-autoroll@skia.org Roll Skia from f346a813ffd4 to 8beae2053939 (5 revisions) (flutter/engine#46200)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC jonahwilliams@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
harryterkelsen pushed a commit that referenced this pull request Oct 23, 2023
Closes flutter/flutter#134969.

Turns out this was literally 1 line. Tested locally:

```shell
dart tools/clang_tidy/bin/main.dart \
  --target-variant host_debug_unopt_arm64 \
  --lint-all \
  --checks="-*,llvm-header-guard"
```

<details>

<summary>Local Test Results</summary>

Here is a tiny snippet showing this is indeed doing something:

```txt
[0:02] Jobs:   0% done,   0/1033 completed,  7 in progress, 1019 pending,   7 failed.    
❌ Failures for clang-tidy on /Users/matanl/Developer/engine/src/flutter/display_list/dl_blend_mode.cc:
../../flutter/display_list/dl_blend_mode.h:5:9: error: header guard does not follow preferred style [llvm-header-guard,-warnings-as-errors]
    5 | #ifndef FLUTTER_DISPLAY_LIST_DL_BLEND_MODE_H_
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |         USERS_MATANL_DEVELOPER_ENGINE_SRC_OUT_HOST_DEBUG_UNOPT_ARM64_______FLUTTER_DISPLAY_LIST_DL_BLEND_MODE_H
    6 | #define FLUTTER_DISPLAY_LIST_DL_BLEND_MODE_H_
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |         USERS_MATANL_DEVELOPER_ENGINE_SRC_OUT_HOST_DEBUG_UNOPT_ARM64_______FLUTTER_DISPLAY_LIST_DL_BLEND_MODE_H
^C
```

</details>

This will likely show failures on CI, so I'm following [our published
directions](https://github.com/flutter/flutter/wiki/Engine-Clang-Tidy-Linter#clang-tidy-fix-on-ci)
to get CI to tell me what needs to get fixed, and won't submit until
there are no warnings at HEAD. As such, not seeking LGTM yet (draft).

---------

Co-authored-by: Zachary Anderson <zanderso@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App
Projects
None yet
2 participants