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

Less checkers in enable all #3013

Merged
merged 2 commits into from
Nov 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion analyzer/codechecker_analyzer/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ def perform_analysis(args, skip_handler, context, actions, metadata_tool,
state, _ = data
metadata_info['checkers'].update({
check: state == CheckerState.enabled})
enabled_checkers[analyzer].append(check)
if state == CheckerState.enabled:
enabled_checkers[analyzer].append(check)

version = config_map[analyzer].get_version(check_env)
metadata_info['analyzer_statistics']['version'] = version
Expand Down
12 changes: 8 additions & 4 deletions analyzer/codechecker_analyzer/analyzers/config_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,15 @@ def initialize_checkers(self,
self.set_checker_enabled(checker)

# If enable_all is given, almost all checkers should be enabled.
disabled_groups = ["alpha.", "debug.", "osx.", "abseil-", "android-",
"darwin-", "objc-", "cppcoreguidelines-",
"fuchsia.", "fuchsia-", "hicpp-", "llvm-",
"llvmlibc-", "google-", "zircon-"]
if enable_all:
for checker_name, enabled in checkers:
if not checker_name.startswith("alpha.") and \
not checker_name.startswith("debug.") and \
not checker_name.startswith("osx."):
for checker_name, _ in checkers:
if not any(checker_name.startswith(d_grp) for d_grp in
disabled_groups):

# There are a few exceptions, though, which still need to
# be manually enabled by the user: alpha and debug.
self.set_checker_enabled(checker_name)
Expand Down
7 changes: 6 additions & 1 deletion analyzer/codechecker_analyzer/cmd/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,12 @@ def add_arguments_to_parser(parser):
default=argparse.SUPPRESS,
help="Force the running analyzers to use "
"almost every checker available. The "
"checker groups 'alpha.', 'debug.' and "
"checker groups 'alpha.', 'debug.',"
"'osx.', 'abseil-', 'android-', "
"'darwin-', 'objc-', "
"'cppcoreguidelines-', 'fuchsia.', "
"'fuchsia-', 'hicpp-', 'llvm-', "
"'llvmlibc-', 'google-', 'zircon-', "
"'osx.' (on Linux) are NOT enabled "
"automatically and must be EXPLICITLY "
"specified. WARNING! Enabling all "
Expand Down
7 changes: 6 additions & 1 deletion analyzer/codechecker_analyzer/cmd/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,12 @@ def add_arguments_to_parser(parser):
default=argparse.SUPPRESS,
help="Force the running analyzers to use "
"almost every checker available. The "
"checker groups 'alpha.', 'debug.' and "
"checker groups 'alpha.', 'debug.',"
"'osx.', 'abseil-', 'android-', "
"'darwin-', 'objc-', "
"'cppcoreguidelines-', 'fuchsia.', "
"'fuchsia-', 'hicpp-', 'llvm-', "
"'llvmlibc-', 'google-', 'zircon-', "
"'osx.' (on Linux) are NOT enabled "
"automatically and must be EXPLICITLY "
"specified. WARNING! Enabling all "
Expand Down
4 changes: 2 additions & 2 deletions analyzer/tests/functional/analyze/test_analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ def test_analyzer_and_checker_config(self):
print(out)
# First it's printed as the member of enabled checkers at the beginning
# of the output. Second it is printed as a found report.
self.assertEqual(out.count('hicpp-use-nullptr'), 2)
self.assertEqual(out.count('hicpp-use-nullptr'), 1)

analyze_cmd = [self._codechecker_cmd, "check", "-l", build_json,
"--analyzers", "clang-tidy", "-o", self.report_dir,
Expand All @@ -914,7 +914,7 @@ def test_analyzer_and_checker_config(self):

# First it's printed as the member of enabled checkers at the beginning
# of the output. Second and third it is printed as a found report.
self.assertEqual(out.count('hicpp-use-nullptr'), 3)
self.assertEqual(out.count('hicpp-use-nullptr'), 2)

analyze_cmd = [self._codechecker_cmd, "check", "-l", build_json,
"--analyzers", "clangsa", "-o", self.report_dir,
Expand Down
30 changes: 18 additions & 12 deletions docs/analyzer/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -375,12 +375,15 @@ checker configuration:
labeled: 'profile:security' or 'guideline:sei-cert'.
--enable-all Force the running analyzers to use almost every
checker available. The checker groups 'alpha.',
'debug.' and 'osx.' (on Linux) are NOT enabled
automatically and must be EXPLICITLY specified.
WARNING! Enabling all checkers might result in the
analysis losing precision and stability, and could
even result in a total failure of the analysis. USE
WISELY AND AT YOUR OWN RISK!
'debug.','osx.', 'abseil-', 'android-', 'darwin-',
'objc-', 'cppcoreguidelines-', 'fuchsia.', 'fuchsia-',
'hicpp-', 'llvm-', 'llvmlibc-', 'google-', 'zircon-',
'osx.' (on Linux) are NOT enabled automatically and
must be EXPLICITLY specified. WARNING! Enabling all
checkers might result in the analysis losing precision
and stability, and could even result in a total
failure of the analysis. USE WISELY AND AT YOUR OWN
RISK!

output arguments:
--print-steps Print the steps the analyzers took in finding the
Expand Down Expand Up @@ -1258,12 +1261,15 @@ checker configuration:
labeled: 'profile:security' or 'guideline:sei-cert'.
--enable-all Force the running analyzers to use almost every
checker available. The checker groups 'alpha.',
'debug.' and 'osx.' (on Linux) are NOT enabled
automatically and must be EXPLICITLY specified.
WARNING! Enabling all checkers might result in the
analysis losing precision and stability, and could
even result in a total failure of the analysis. USE
WISELY AND AT YOUR OWN RISK!
'debug.','osx.', 'abseil-', 'android-', 'darwin-',
'objc-', 'cppcoreguidelines-', 'fuchsia.', 'fuchsia-',
'hicpp-', 'llvm-', 'llvmlibc-', 'google-', 'zircon-',
'osx.' (on Linux) are NOT enabled automatically and
must be EXPLICITLY specified. WARNING! Enabling all
checkers might result in the analysis losing precision
and stability, and could even result in a total
failure of the analysis. USE WISELY AND AT YOUR OWN
RISK!
```

Both `--enable` and `--disable` take individual checkers, checker groups or
Expand Down