-
Notifications
You must be signed in to change notification settings - Fork 6k
Speed up clang-tidy script by skipping third_party files #29640
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -106,7 +106,7 @@ Future<int> main(List<String> args) async { | |
| <String>[ | ||
| '--compile-commands', | ||
| // This just has to exist. | ||
| io.Platform.executable, | ||
| io.Platform.script.path, | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you update the comment on the line above?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
| '--repo', | ||
| '/does/not/exist', | ||
| ], | ||
|
|
@@ -168,7 +168,7 @@ Future<int> main(List<String> args) async { | |
| 'file': filePath, | ||
| }, | ||
| ]; | ||
| final List<Command> commands = clangTidy.getLintCommandsForChangedFiles( | ||
| final List<Command> commands = await clangTidy.getLintCommandsForChangedFiles( | ||
| buildCommandsData, | ||
| <io.File>[], | ||
| ); | ||
|
|
@@ -186,15 +186,17 @@ Future<int> main(List<String> args) async { | |
| outSink: outBuffer, | ||
| errSink: errBuffer, | ||
| ); | ||
| const String filePath = '/path/to/a/source_file.cc'; | ||
|
|
||
| // This just has to exist. | ||
|
||
| final String filePath = io.Platform.script.path; | ||
| final List<dynamic> buildCommandsData = <Map<String, dynamic>>[ | ||
| <String, dynamic>{ | ||
| 'directory': '/unused', | ||
| 'command': '../../buildtools/mac-x64/clang/bin/clang $filePath', | ||
| 'file': filePath, | ||
| }, | ||
| ]; | ||
| final List<Command> commands = clangTidy.getLintCommandsForChangedFiles( | ||
| final List<Command> commands = await clangTidy.getLintCommandsForChangedFiles( | ||
| buildCommandsData, | ||
| <io.File>[io.File(filePath)], | ||
| ); | ||
|
|
@@ -220,6 +222,14 @@ Future<int> main(List<String> args) async { | |
| expect(lintAction, equals(LintAction.skipThirdParty)); | ||
| }); | ||
|
|
||
| test('Command getLintAction flags missing files', () async { | ||
| final LintAction lintAction = await Command.getLintAction( | ||
| 'does/not/exist', | ||
| ); | ||
|
|
||
| expect(lintAction, equals(LintAction.skipMissing)); | ||
| }); | ||
|
|
||
| test('Command getLintActionFromContents flags FLUTTER_NOLINT', () async { | ||
| final LintAction lintAction = await Command.lintActionFromContents( | ||
| Stream<String>.fromIterable(<String>[ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this check reading the lines crashes
engine/tools/clang_tidy/lib/src/command.dart
Line 103 in ab47e45