Bug 1486729 - [Static-Analysis][Clang-Tidy] As default, a checker should be publish by default. r=sylvestre

Differential Revision: https://phabricator.services.mozilla.com/D4436

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andi-Bogdan Postelnicu 2018-08-29 10:10:54 +00:00
parent 3323938896
commit 64682f8e84
2 changed files with 15 additions and 58 deletions

View File

@ -1972,12 +1972,20 @@ class StaticAnalysis(MachCommandBase):
with concurrent.futures.ThreadPoolExecutor(max_workers=max_workers) as executor:
futures = []
for item in config['clang_checkers']:
# Do not test mozilla specific checks nor the default '-*'
if not (item['publish'] and ('restricted-platforms' in item
and platform not in item['restricted-platforms']
or 'restricted-platforms' not in item)
and item['name'] not in ['mozilla-*', '-*'] and
(checker_names == [] or item['name'] in checker_names)):
# Skip if any of the following statements is true:
# 1. Checker attribute 'publish' is False.
not_published = not bool(item.get('publish', True))
# 2. Checker has restricted-platforms and current platform is not of them.
ignored_platform = 'restricted-platforms' in item and platform not in item['restricted-platforms']
# 3. Checker name is mozilla-* or -*.
ignored_checker = item['name'] in ['mozilla-*', '-*']
# 4. List checker_names is passed and the current checker is not part of the
# list or 'publish' is False
checker_not_in_list = checker_names and (item['name'] not in checker_names or not_published)
if not_published or \
ignored_platform or \
ignored_checker or \
checker_not_in_list:
continue
futures.append(executor.submit(self._verify_checker, item))
@ -2189,7 +2197,7 @@ class StaticAnalysis(MachCommandBase):
try:
config = yaml.safe_load(f)
for item in config['clang_checkers']:
if item['publish']:
if item.get('publish', True):
checks += ',' + item['name']
except Exception:
print('Looks like config.yaml is not valid, so we are unable to '

View File

@ -12,127 +12,76 @@ clang_checkers:
- name: -*
publish: !!bool no
- name: bugprone-argument-comment
publish: !!bool yes
- name: bugprone-assert-side-effect
publish: !!bool yes
- name: bugprone-bool-pointer-implicit-conversion
publish: !!bool yes
- name: bugprone-forward-declaration-namespace
publish: !!bool yes
- name: bugprone-macro-repeated-side-effects
publish: !!bool yes
- name: bugprone-string-constructor
publish: !!bool yes
- name: bugprone-string-integer-assignment
publish: !!bool yes
- name: bugprone-suspicious-memset-usage
publish: !!bool yes
- name: bugprone-suspicious-missing-comma
publish: !!bool yes
- name: bugprone-suspicious-semicolon
publish: !!bool yes
- name: bugprone-swapped-arguments
publish: !!bool yes
- name: bugprone-unused-raii
publish: !!bool yes
- name: clang-analyzer-cplusplus.NewDelete
publish: !!bool yes
- name: clang-analyzer-cplusplus.NewDeleteLeaks
publish: !!bool yes
- name: clang-analyzer-deadcode.DeadStores
publish: !!bool yes
- name: clang-analyzer-security.FloatLoopCounter
publish: !!bool yes
- name: clang-analyzer-security.insecureAPI.getpw
publish: !!bool yes
# We don't add clang-analyzer-security.insecureAPI.gets here; it's deprecated.
- name: clang-analyzer-security.insecureAPI.mkstemp
publish: !!bool yes
- name: clang-analyzer-security.insecureAPI.mktemp
publish: !!bool yes
- name: clang-analyzer-security.insecureAPI.rand
publish: !!bool no
- name: clang-analyzer-security.insecureAPI.strcpy
publish: !!bool no
- name: clang-analyzer-security.insecureAPI.UncheckedReturn
publish: !!bool yes
- name: clang-analyzer-security.insecureAPI.vfork
publish: !!bool yes
- name: clang-analyzer-unix.Malloc
publish: !!bool yes
- name: clang-analyzer-unix.cstring.BadSizeArg
publish: !!bool yes
- name: clang-analyzer-unix.cstring.NullArg
publish: !!bool yes
- name: misc-unused-alias-decls
publish: !!bool yes
- name: misc-unused-using-decls
publish: !!bool yes
- name: modernize-avoid-bind
publish: !!bool yes
restricted-platforms:
- win32
- win64
- name: modernize-loop-convert
publish: !!bool yes
- name: modernize-raw-string-literal
publish: !!bool yes
- name: modernize-redundant-void-arg
publish: !!bool no
- name: modernize-shrink-to-fit
publish: !!bool yes
- name: modernize-use-auto
# Controversial, see bug 1371052.
publish: !!bool no
- name: modernize-use-bool-literals
publish: !!bool yes
- name: modernize-use-equals-default
publish: !!bool yes
- name: modernize-use-equals-delete
publish: !!bool yes
- name: modernize-use-nullptr
publish: !!bool yes
- name: modernize-use-override
# Too noisy because of the way how we implement NS_IMETHOD. See Bug 1420366.
publish: !!bool no
- name: mozilla-*
publish: !!bool yes
- name: performance-faster-string-find
publish: !!bool yes
- name: performance-for-range-copy
publish: !!bool yes
# Only available from clang tidy 6.0. We are currently using 5.0
# - name: performance-implicit-conversion-in-loop
# publish: !!bool yes
- name: performance-inefficient-string-concatenation
publish: !!bool yes
- name: performance-inefficient-vector-operation
publish: !!bool yes
- name: performance-type-promotion-in-math-fn
publish: !!bool yes
- name: performance-unnecessary-copy-initialization
publish: !!bool yes
- name: performance-unnecessary-value-param
publish: !!bool yes
- name: readability-container-size-empty
publish: !!bool yes
- name: readability-else-after-return
publish: !!bool yes
- name: readability-misleading-indentation
publish: !!bool yes
- name: readability-redundant-control-flow
publish: !!bool yes
- name: readability-redundant-smartptr-get
publish: !!bool no
- name: readability-redundant-string-cstr
publish: !!bool yes
- name: readability-redundant-string-init
publish: !!bool yes
- name: readability-uniqueptr-delete-release
publish: !!bool yes
# Only available from clang tidy 6.0. We are currently using 5.0
# - name: readability-static-accessed-through-instance
# publish: !!bool yes
# Third party files from mozilla-central
third_party: tools/rewriting/ThirdPartyPaths.txt