codechecker icon indicating copy to clipboard operation
codechecker copied to clipboard

the deprecated way to pass options to Analyzers seems to be non-working too

Open aag-norbert-lange opened this issue 9 months ago • 1 comments

Describe the bug

CodeChecker seems to ignore passing options to cppcheck the "old way". I will find alot reports stating Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches. despite adding this flag.

CodeChecker version


Kind | Version

Base package version | 6.25.0
Package build date | 2025-03-13T16:02
Git commit ID (hash) | 90df5ab5a6748ad55b0ad5aebf7da30d765089f6 Git tag information | 6.25
Server supported Thrift API version | 6.61
Client Thrift API version | 6.61

To Reproduce Steps to reproduce the behaviour:

  1. echo "--check-level=exhaustive" > /tmp/cppcheckargs.txt
  2. CodeChecker analyze --report-hash context-free-v2 --analyzers cppcheck --cppcheckargs /tmp/cppcheckargs.txt -i "${BUILD_TEMPDIR}"/_file.list -o "${BUILD_TEMPDIR}"/_plists "$BUILDDIR"/compile_commands.json

[WARNING 2025-03-17 16:29] - "--cppcheckargs" is deprecated. Use "--analyzer-config cppcheck:cc-verbatim-args-file=" instead.

Expected behaviour

cppcheck should use the flags from the file

Desktop (please complete the following information)

  • OS: Linux

(podman container)

Additional context

Note that before version 6.25 the only way to add the --check-level=exhaustive flag is via --cppcheckarg, and I have existing projects (and their branches) depend on it. With Version 6.25 its now deprecated and not working, means updating CodeChecker alone will end up with tons of new reports.

aag-norbert-lange avatar Mar 17 '25 16:03 aag-norbert-lange

The bug is at analyzer/codechecker_analyzer/cli/analyze.py:1102

it should be cppcheck instead of clang-tidy: f'clang-tidy:cc-verbatim-args-file={args.cppcheck_args_cfg_file}'))

I did change the following bit in the release-v6.25 branch and this solved the issue for me (apart from #4498 requiring another hack):

--- a/analyzer/codechecker_analyzer/cmd/analyze.py
+++ b/analyzer/codechecker_analyzer/cmd/analyze.py
@@ -1102,7 +1102,7 @@ def __transform_deprecated_flags(args):
             'clang-tidy:cc-verbatim-args-file=<filepath>" instead.')
     if hasattr(args, 'cppcheck_args_cfg_file'):
         args.analyzer_config.append(analyzer_config(
-            f'clang-tidy:cc-verbatim-args-file={args.cppcheck_args_cfg_file}'))
+            f'cppcheck:cc-verbatim-args-file={args.cppcheck_args_cfg_file}'))
         delattr(args, 'cppcheck_args_cfg_file')
         LOG.warning(
             '"--cppcheckargs" is deprecated. Use "--analyzer-config '
-- 

aag-norbert-lange avatar Apr 08 '25 14:04 aag-norbert-lange