Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Enable checking headers with Clang Tidy.#46009

Merged
matanlurey merged 16 commits intoflutter:mainfrom
matanlurey:engine-clang-tidy-check-headers
Sep 22, 2023
Merged

Enable checking headers with Clang Tidy.#46009
matanlurey merged 16 commits intoflutter:mainfrom
matanlurey:engine-clang-tidy-check-headers

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 requested a review from zanderso September 18, 2023 22:43
@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?

@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 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
@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
flutter/engine@ef9ceed...92be04f

2023-09-22 [email protected] Roll Skia from 8beae2053939 to fe73688dc40f (1 revision) (flutter/engine#46202)
2023-09-22 [email protected] Enable checking headers with Clang Tidy. (flutter/engine#46009)
2023-09-22 [email protected] 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 [email protected],[email protected],[email protected] 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
…5319)

flutter/engine@ef9ceed...92be04f

2023-09-22 [email protected] Roll Skia from 8beae2053939 to fe73688dc40f (1 revision) (flutter/engine#46202)
2023-09-22 [email protected] Enable checking headers with Clang Tidy. (flutter/engine#46009)
2023-09-22 [email protected] 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 [email protected],[email protected],[email protected] 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 <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Engine] Clang Tidy should enforce header files

2 participants