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 clang-tidy for pre-push (opt-out), exclude performance-unnecessary-value-param #44936

Merged
merged 15 commits into from
Aug 23, 2023

Conversation

matanlurey
Copy link
Contributor

Closes flutter/flutter#132687.

Zach, this is a pretty naive attempt, so feel free to suggest alternatives. I considered for example just using --checks=-{{LINT}} as well, but figured that might be less discoverable (especially for non-core folks) than just a file called .clang-tidy-for-githooks.

/cc @jonahwilliams

@matanlurey matanlurey requested a review from zanderso August 22, 2023 00:32
@matanlurey
Copy link
Contributor Author

Whomever reviews this, I have no idea how to pass the LICENSES check and could use an adult!

tools/clang_tidy/lib/src/options.dart Outdated Show resolved Hide resolved
tools/githooks/lib/src/pre_push_command.dart Outdated Show resolved Hide resolved
@@ -0,0 +1,41 @@
# Keep in sync with .clang-tidy.
Copy link
Member

Choose a reason for hiding this comment

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

We should try to think of some ideas to avoid the duplication. Here's one:

The .clang-tidy file is just a yaml file. If clang-tidy ignores fields it doesn't understand, we could add one in the existing .clang-tidy file, like IgnoredCheckForFlutterGitHook (or some better name). Then when running in the context of the pre-push hook, our clang-tidy wrapper can create a new .clang-tidy file under /tmp, and pass that to the clang-tidy --config-file flag.

Copy link
Contributor Author

@matanlurey matanlurey Aug 22, 2023

Choose a reason for hiding this comment

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

Done, though I couldn't quite handle the way we both wanted as I'll need to bring in the YAML package.

OK with doing that, but it should probably be a follow-up PR. Wdyt of my hack?

@zanderso
Copy link
Member

Whomever reviews this, I have no idea how to pass the LICENSES check and could use an adult!

There are instructions at the bottom of the logs for the failing check: https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8772102403923285345/+/u/test:_licenses_check/stdout?format=raw.

@matanlurey matanlurey requested a review from zanderso August 22, 2023 21:11
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/ temp dir cleanup.

@@ -292,6 +299,10 @@ class ClangTidy {
List<Command> commands,
Options options,
) async {
io.File? configPath = options.configPath;
if (configPath != null && options.excludeSlowChecks) {
configPath = _createClangTidyConfigExcludingSlowLints(configPath);
Copy link
Member

Choose a reason for hiding this comment

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

The temp directory should probably be deleted sometime after _runJobs finishes up on line 171.

@matanlurey matanlurey force-pushed the engine-clang-tidy-for-githooks branch from a71ee6d to b4bc1e4 Compare August 22, 2023 21:32
@matanlurey
Copy link
Contributor Author

Done!

@matanlurey matanlurey added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 22, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 22, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Aug 22, 2023

auto label is removed for flutter/engine/44936, due to - The status or check suite Linux linux_host_engine has failed. Please fix the issues identified (or deflake) before re-applying this label.

@matanlurey matanlurey added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 22, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Aug 23, 2023

auto label is removed for flutter/engine/44936, due to - The status or check suite Linux linux_host_engine has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 23, 2023
@matanlurey matanlurey added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 23, 2023
@auto-submit auto-submit bot merged commit 4d1050f into flutter:main Aug 23, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 23, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 23, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 23, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 23, 2023
zanderso pushed a commit to flutter/flutter that referenced this pull request Aug 23, 2023
…sions) (#133106)

Manual roll requested by [email protected]

flutter/engine@b190f90...7d56840

2023-08-23 [email protected] Revert "Roll Dart SDK from
ab417bc74bb1 to c162b4979562 (1 revision)" (flutter/engine#44989)
2023-08-23 [email protected] Roll Fuchsia Mac SDK from
G25oJMO5jbUi-UN4F... to DoQ8KUxSk-5EU6VQ1... (flutter/engine#44988)
2023-08-23 [email protected] Revert "Make `FontWeight`
an enum, Remove unused text classes" (flutter/engine#44987)
2023-08-23 [email protected] Roll Dart SDK from
ab417bc74bb1 to c162b4979562 (1 revision) (flutter/engine#44986)
2023-08-23 [email protected] Roll Fuchsia Linux SDK from
kKI09su99b0AKs8b3... to VSvpNFoFjqXIQTcs6... (flutter/engine#44984)
2023-08-23 [email protected] Enable clang-tidy for
pre-push (opt-out), exclude `performance-unnecessary-value-param`
(flutter/engine#44936)
2023-08-22 [email protected] Restore old SurfaceTextureExternal
drawing code (flutter/engine#44979)
2023-08-22 [email protected] Roll Skia from d0918de21c1a to
aa208c8a2d60 (2 revisions) (flutter/engine#44981)
2023-08-22 [email protected] Initialize the texture
destruction callback in the Metal embedder test harness
(flutter/engine#44973)
2023-08-22 [email protected] Further filter/clear
`<SkPaint>.setDither(true)`, this time in `DlSkPaintDispatchHelper`
(flutter/engine#44912)
2023-08-22 [email protected] Roll Dart SDK from
3ebf0fedfceb to ab417bc74bb1 (1 revision) (flutter/engine#44977)
2023-08-22 [email protected] Roll Skia from bf6019be75ef to
d0918de21c1a (3 revisions) (flutter/engine#44975)
2023-08-22 [email protected] Roll Skia from c675298ddeda to
bf6019be75ef (3 revisions) (flutter/engine#44974)
2023-08-22 [email protected] Make
`FontWeight` an enum, Remove unused text classes (flutter/engine#44960)
2023-08-22 [email protected] Roll Skia from 9f4b81aac175 to
c675298ddeda (2 revisions) (flutter/engine#44971)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from kKI09su99b0A to VSvpNFoFjqXI
  fuchsia/sdk/core/mac-amd64 from G25oJMO5jbUi to DoQ8KUxSk-5E

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
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 23, 2023
bdero added a commit that referenced this pull request Aug 23, 2023
…e-unnecessary-value-param` (#44936)"

This reverts commit 4d1050f.
auto-submit bot pushed a commit that referenced this pull request Aug 23, 2023
@matanlurey matanlurey deleted the engine-clang-tidy-for-githooks branch August 24, 2023 18:09
matanlurey added a commit that referenced this pull request Aug 27, 2023
matanlurey added a commit that referenced this pull request Aug 29, 2023
Partial work towards re-landing #44936.

Both the `clang_tidy` and `githooks` passage could benefit from being
able to automatically find the latest `compile_commands.json` output,
which means that some common code should exist in the `tools/`
directory.

This is a very minimal (but tested) library for doing exactly that.
gaaclarke pushed a commit to gaaclarke/engine that referenced this pull request Aug 30, 2023
…ssary-value-param` (flutter#44936)

Closes flutter/flutter#132687.

Zach, this is a pretty naive attempt, so feel free to suggest alternatives. I considered for example just using `--checks=-{{LINT}}` as well, but figured that might be less discoverable (especially for non-core folks) than just a file called `.clang-tidy-for-githooks`.

/cc @jonahwilliams
gaaclarke pushed a commit to gaaclarke/engine that referenced this pull request Aug 30, 2023
gaaclarke pushed a commit to gaaclarke/engine that referenced this pull request Aug 30, 2023
gaaclarke pushed a commit to gaaclarke/engine that referenced this pull request Aug 30, 2023
…ter#45154)

Partial work towards re-landing flutter#44936.

Both the `clang_tidy` and `githooks` passage could benefit from being
able to automatically find the latest `compile_commands.json` output,
which means that some common code should exist in the `tools/`
directory.

This is a very minimal (but tested) library for doing exactly that.
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
Development

Successfully merging this pull request may close these issues.

[Engine] Audit clang_tidy --enable-check-profile and see what is expensive
2 participants