forked from openkylin/platform_build
Recognize more warning patterns.
* add more Java, Kotlin, and Rust warning patterns * recognize more clang-tidy cert-* and bugprone-* warnings; still keep the catch-all 'cert' and 'bugprone' groups. Test: warn.py build.log > warnings.html Change-Id: I909ec09822f42f60493ebe943c055bf0d4b69938
This commit is contained in:
parent
3728312005
commit
445ad810c8
|
@ -485,16 +485,24 @@ warn_patterns = [
|
|||
java_medium('Static method should be qualified',
|
||||
[r'.*\.java:.*: warning: \[static\] static method should be qualified']),
|
||||
medium('AbstractInner'),
|
||||
medium('BothPackageInfoAndHtml'),
|
||||
medium('CallbackName'),
|
||||
medium('ExecutorRegistration'),
|
||||
medium('HiddenTypeParameter'),
|
||||
medium('JavaApiUsedByMainlineModule'),
|
||||
medium('ListenerLast'),
|
||||
medium('MinMaxConstant'),
|
||||
medium('MissingBuildMethod'),
|
||||
medium('NoByteOrShort'),
|
||||
medium('OverlappingConstants'),
|
||||
medium('SetterReturnsThis'),
|
||||
medium('StreamFiles'),
|
||||
medium('Typo'),
|
||||
medium('UseIcu'),
|
||||
medium('fallthrough'),
|
||||
medium('overrides'),
|
||||
medium('serial'),
|
||||
medium('try'),
|
||||
high('AndroidInjectionBeforeSuper',
|
||||
'AndroidInjection.inject() should always be invoked before calling super.lifecycleMethod()'),
|
||||
high('AndroidJdkLibsChecker',
|
||||
|
@ -783,6 +791,8 @@ warn_patterns = [
|
|||
# Other javac tool warnings
|
||||
java_medium('addNdkApiCoverage failed to getPackage',
|
||||
[r".*: warning: addNdkApiCoverage failed to getPackage"]),
|
||||
java_medium('bad path element',
|
||||
[r".*: warning: \[path\] bad path element .*\.jar"]),
|
||||
java_medium('Supported version from annotation processor',
|
||||
[r".*: warning: Supported source version .+ from annotation processor"]),
|
||||
]
|
||||
|
|
|
@ -42,14 +42,20 @@ def asm(description, pattern_list):
|
|||
return warn('asm', Severity.MEDIUM, description, pattern_list)
|
||||
|
||||
|
||||
def kotlin(description, pattern_list):
|
||||
return warn('Kotlin', Severity.MEDIUM, description, pattern_list)
|
||||
def kotlin(description, pattern):
|
||||
return warn('Kotlin', Severity.MEDIUM, description,
|
||||
[r'.*\.kt:.*: warning: ' + pattern])
|
||||
|
||||
|
||||
def yacc(description, pattern_list):
|
||||
return warn('yacc', Severity.MEDIUM, description, pattern_list)
|
||||
|
||||
|
||||
def rust(severity, description, pattern):
|
||||
return warn('Rust', severity, description,
|
||||
[r'.*\.rs:.*: warning: ' + pattern])
|
||||
|
||||
|
||||
warn_patterns = [
|
||||
# pylint:disable=line-too-long,g-inconsistent-quotes
|
||||
# aapt warnings
|
||||
|
@ -109,26 +115,31 @@ warn_patterns = [
|
|||
'description': 'Proto: Import not used',
|
||||
'patterns': [r".*: warning: Import .*/.*\.proto but not used.$"]},
|
||||
# Kotlin warnings
|
||||
kotlin('never used parameter or variable',
|
||||
[r".*\.kt:.*: warning: (parameter|variable) '.*' is never used$",
|
||||
r".*\.kt:.*: warning: (parameter|variable) '.*' is never used, could be renamed to _$"]),
|
||||
kotlin('initializer is redundant',
|
||||
[r".*\.kt:.*: warning: .* initializer is redundant$"]),
|
||||
kotlin('never used parameter or variable', '.+ \'.*\' is never used'),
|
||||
kotlin('multiple labels', '.+ more than one label .+ in this scope'),
|
||||
kotlin('type mismatch', 'type mismatch: '),
|
||||
kotlin('is always true', '.+ is always \'true\''),
|
||||
kotlin('no effect', '.+ annotation has no effect for '),
|
||||
kotlin('no cast needed', 'no cast needed'),
|
||||
kotlin('accessor not generated', 'an accessor will not be generated '),
|
||||
kotlin('initializer is redundant', '.* initializer is redundant$'),
|
||||
kotlin('elvis operator always returns ...',
|
||||
[r".*\.kt:.*: warning: elvis operator \(\?:\) always returns .+"]),
|
||||
kotlin('shadowed name',
|
||||
[r".*\.kt:.*: warning: name shadowed: .+"]),
|
||||
kotlin('unchecked cast',
|
||||
[r".*\.kt:.*: warning: unchecked cast: .* to .*$"]),
|
||||
'elvis operator (?:) always returns .+'),
|
||||
kotlin('shadowed name', 'name shadowed: .+'),
|
||||
kotlin('unchecked cast', 'unchecked cast: .* to .*$'),
|
||||
kotlin('unreachable code', 'unreachable code'),
|
||||
kotlin('unnecessary assertion', 'unnecessary .+ assertion .+'),
|
||||
kotlin('unnecessary safe call on a non-null receiver',
|
||||
[r".*\.kt:.*: warning: unnecessary safe call on a non-null receiver"]),
|
||||
'unnecessary safe call on a non-null receiver'),
|
||||
kotlin('Deprecated in Java',
|
||||
[r".*\.kt:.*: warning: '.*' is deprecated. Deprecated in Java"]),
|
||||
'\'.*\' is deprecated. Deprecated in Java'),
|
||||
kotlin('Replacing Handler for Executor',
|
||||
[r".*\.kt:.*: warning: .+ Replacing Handler for Executor in "]),
|
||||
'.+ Replacing Handler for Executor in '),
|
||||
kotlin('library has Kotlin runtime',
|
||||
[r".*: warning: library has Kotlin runtime bundled into it",
|
||||
r".*: warning: some JAR files .* have the Kotlin Runtime library"]),
|
||||
'.+ has Kotlin runtime (bundled|library)'),
|
||||
warn('Kotlin', Severity.MEDIUM, 'bundled Kotlin runtime',
|
||||
['.*warning: .+ (has|have the) Kotlin (runtime|Runtime library) bundled']),
|
||||
kotlin('other warnings', '.+'), # catch all other Kotlin warnings
|
||||
# Yacc warnings
|
||||
yacc('deprecate directive',
|
||||
[r".*\.yy?:.*: warning: deprecated directive: "]),
|
||||
|
@ -138,15 +149,20 @@ warn_patterns = [
|
|||
'description': 'yacc: fix-its can be applied',
|
||||
'patterns': [r".*\.yy?: warning: fix-its can be applied."]},
|
||||
# Rust warnings
|
||||
{'category': 'Rust', 'severity': Severity.HIGH,
|
||||
'description': 'Rust: Does not derive Copy',
|
||||
'patterns': [r".*: warning: .+ does not derive Copy"]},
|
||||
{'category': 'Rust', 'severity': Severity.MEDIUM,
|
||||
'description': 'Rust: Deprecated range pattern',
|
||||
'patterns': [r".*: warning: .+ range patterns are deprecated"]},
|
||||
{'category': 'Rust', 'severity': Severity.MEDIUM,
|
||||
'description': 'Rust: Deprecated missing explicit \'dyn\'',
|
||||
'patterns': [r".*: warning: .+ without an explicit `dyn` are deprecated"]},
|
||||
rust(Severity.HIGH, 'Does not derive Copy', '.+ does not derive Copy'),
|
||||
rust(Severity.MEDIUM, '... are deprecated',
|
||||
('(.+ are deprecated$|' +
|
||||
'use of deprecated item .* (use .* instead|is now preferred))')),
|
||||
rust(Severity.MEDIUM, 'never used', '.* is never used:'),
|
||||
rust(Severity.MEDIUM, 'unused import', 'unused import: '),
|
||||
rust(Severity.MEDIUM, 'unnecessary attribute',
|
||||
'.+ no longer requires an attribute'),
|
||||
rust(Severity.MEDIUM, 'unnecessary parentheses',
|
||||
'unnecessary parentheses around'),
|
||||
# Catch all RenderScript warnings
|
||||
{'category': 'RenderScript', 'severity': Severity.LOW,
|
||||
'description': 'RenderScript warnings',
|
||||
'patterns': [r'.*\.rscript:.*: warning: ']},
|
||||
# Broken/partial warning messages will be skipped.
|
||||
{'category': 'Misc', 'severity': Severity.SKIP,
|
||||
'description': 'skip, ,',
|
||||
|
|
|
@ -78,6 +78,7 @@ warn_patterns = [
|
|||
group_tidy_warn_pattern('android'),
|
||||
simple_tidy_warn_pattern('abseil-string-find-startswith'),
|
||||
simple_tidy_warn_pattern('bugprone-argument-comment'),
|
||||
simple_tidy_warn_pattern('bugprone-branch-clone'),
|
||||
simple_tidy_warn_pattern('bugprone-copy-constructor-init'),
|
||||
simple_tidy_warn_pattern('bugprone-fold-init-type'),
|
||||
simple_tidy_warn_pattern('bugprone-forward-declaration-namespace'),
|
||||
|
@ -89,6 +90,9 @@ warn_patterns = [
|
|||
simple_tidy_warn_pattern('bugprone-macro-parentheses'),
|
||||
simple_tidy_warn_pattern('bugprone-misplaced-widening-cast'),
|
||||
simple_tidy_warn_pattern('bugprone-move-forwarding-reference'),
|
||||
simple_tidy_warn_pattern('bugprone-parent-virtual-call'),
|
||||
simple_tidy_warn_pattern('bugprone-posix-return'),
|
||||
simple_tidy_warn_pattern('bugprone-sizeof-container'),
|
||||
simple_tidy_warn_pattern('bugprone-sizeof-expression'),
|
||||
simple_tidy_warn_pattern('bugprone-string-constructor'),
|
||||
simple_tidy_warn_pattern('bugprone-string-integer-assignment'),
|
||||
|
@ -96,10 +100,25 @@ warn_patterns = [
|
|||
simple_tidy_warn_pattern('bugprone-suspicious-missing-comma'),
|
||||
simple_tidy_warn_pattern('bugprone-suspicious-string-compare'),
|
||||
simple_tidy_warn_pattern('bugprone-suspicious-semicolon'),
|
||||
simple_tidy_warn_pattern('bugprone-terminating-continue'),
|
||||
simple_tidy_warn_pattern('bugprone-too-small-loop-variable'),
|
||||
simple_tidy_warn_pattern('bugprone-undefined-memory-manipulation'),
|
||||
simple_tidy_warn_pattern('bugprone-unhandled-self-assignment'),
|
||||
simple_tidy_warn_pattern('bugprone-unused-raii'),
|
||||
simple_tidy_warn_pattern('bugprone-unused-return-value'),
|
||||
simple_tidy_warn_pattern('bugprone-use-after-move'),
|
||||
group_tidy_warn_pattern('bugprone'),
|
||||
simple_tidy_warn_pattern('cert-dcl16-c'),
|
||||
simple_tidy_warn_pattern('cert-dcl21-cpp'),
|
||||
simple_tidy_warn_pattern('cert-dcl50-cpp'),
|
||||
simple_tidy_warn_pattern('cert-dcl54-cpp'),
|
||||
simple_tidy_warn_pattern('cert-dcl59-cpp'),
|
||||
simple_tidy_warn_pattern('cert-env33-c'),
|
||||
simple_tidy_warn_pattern('cert-err34-c'),
|
||||
simple_tidy_warn_pattern('cert-err52-cpp'),
|
||||
simple_tidy_warn_pattern('cert-msc30-c'),
|
||||
simple_tidy_warn_pattern('cert-msc50-cpp'),
|
||||
simple_tidy_warn_pattern('cert-oop54-cpp'),
|
||||
group_tidy_warn_pattern('cert'),
|
||||
group_tidy_warn_pattern('clang-diagnostic'),
|
||||
group_tidy_warn_pattern('cppcoreguidelines'),
|
||||
|
|
Loading…
Reference in New Issue