Only run clang-tidy warning checks reported as errors (flutter/engine#36885)
This commit is contained in:
@@ -7,8 +7,11 @@ clang-diagnostic-*,\
|
||||
google-*,\
|
||||
modernize-use-default-member-init,\
|
||||
readability-identifier-naming,\
|
||||
-google-build-using-namespace,\
|
||||
-google-default-arguments,\
|
||||
-google-objc-global-variable-declaration,\
|
||||
-google-objc-avoid-throwing-exception,\
|
||||
-google-readability-casting,\
|
||||
-clang-analyzer-nullability.NullPassedToNonnull,\
|
||||
-clang-analyzer-nullability.NullablePassedToNonnull,\
|
||||
-clang-analyzer-nullability.NullReturnedFromNonnull,\
|
||||
@@ -16,23 +19,6 @@ readability-identifier-naming,\
|
||||
performance-move-const-arg,\
|
||||
performance-unnecessary-value-param"
|
||||
|
||||
# Only warnings treated as errors are reported
|
||||
# in the "ci/lint.sh" script and pre-push git hook.
|
||||
# Add checks when all warnings are fixed
|
||||
# to prevent new warnings being introduced.
|
||||
# https://github.com/flutter/flutter/issues/93279
|
||||
# Note: There are platform specific warnings as errors in
|
||||
# //ci/lint.sh
|
||||
WarningsAsErrors: "bugprone-use-after-move,\
|
||||
clang-analyzer-*,\
|
||||
readability-identifier-naming,\
|
||||
clang-diagnostic-*,\
|
||||
google-objc-*,\
|
||||
google-explicit-constructor,\
|
||||
google-readability-avoid-underscore-in-googletest-name,\
|
||||
performance-move-const-arg,\
|
||||
performance-unnecessary-value-param"
|
||||
|
||||
CheckOptions:
|
||||
- key: modernize-use-default-member-init.UseAssignment
|
||||
value: true
|
||||
|
||||
@@ -134,8 +134,7 @@ class Command {
|
||||
WorkerJob createLintJob(Options options) {
|
||||
final List<String> args = <String>[
|
||||
filePath,
|
||||
if (options.warningsAsErrors != null)
|
||||
'--warnings-as-errors=${options.warningsAsErrors}',
|
||||
'--warnings-as-errors=${options.warningsAsErrors ?? '*'}',
|
||||
if (options.checks != null)
|
||||
options.checks!,
|
||||
if (options.fix) ...<String>[
|
||||
|
||||
@@ -379,19 +379,21 @@ Future<int> main(List<String> args) async {
|
||||
final WorkerJob jobNoFix = command.createLintJob(noFixOptions);
|
||||
expect(jobNoFix.command[0], endsWith('../../buildtools/mac-x64/clang/bin/clang-tidy'));
|
||||
expect(jobNoFix.command[1], endsWith(filePath.replaceAll('/', io.Platform.pathSeparator)));
|
||||
expect(jobNoFix.command[2], '--');
|
||||
expect(jobNoFix.command[3], '');
|
||||
expect(jobNoFix.command[4], endsWith(filePath));
|
||||
expect(jobNoFix.command[2], '--warnings-as-errors=*');
|
||||
expect(jobNoFix.command[3], '--');
|
||||
expect(jobNoFix.command[4], '');
|
||||
expect(jobNoFix.command[5], endsWith(filePath));
|
||||
|
||||
final Options fixOptions = Options(buildCommandsPath: io.File('.'), fix: true);
|
||||
final WorkerJob jobWithFix = command.createLintJob(fixOptions);
|
||||
expect(jobWithFix.command[0], endsWith('../../buildtools/mac-x64/clang/bin/clang-tidy'));
|
||||
expect(jobWithFix.command[1], endsWith(filePath.replaceAll('/', io.Platform.pathSeparator)));
|
||||
expect(jobWithFix.command[2], '--fix');
|
||||
expect(jobWithFix.command[3], '--format-style=file');
|
||||
expect(jobWithFix.command[4], '--');
|
||||
expect(jobWithFix.command[5], '');
|
||||
expect(jobWithFix.command[6], endsWith(filePath));
|
||||
expect(jobWithFix.command[2], '--warnings-as-errors=*');
|
||||
expect(jobWithFix.command[3], '--fix');
|
||||
expect(jobWithFix.command[4], '--format-style=file');
|
||||
expect(jobWithFix.command[5], '--');
|
||||
expect(jobWithFix.command[6], '');
|
||||
expect(jobWithFix.command[7], endsWith(filePath));
|
||||
});
|
||||
|
||||
test('Command getLintAction flags third_party files', () async {
|
||||
|
||||
Reference in New Issue
Block a user