Skip to content

CodeChecker analyze should warn if the compilation datbase is empty #4222

@dkrupp

Description

@dkrupp

In CodeChecker 6.23.0 when you analyze a file with an empty compilation database or the file to be analyzed is not found in the compilation database and therefore nothing is analyzed, CodeChecker returns with success.

This is not a good behaviour, because in fact nothing was analyzed which may not be what the user expected. So change the log level from info to warning for the following log events:
[INFO 2024-04-17 14:31] - No analysis is required. There were no compilation commands in the provided compilation database or all of them were skipped.

Reproduction:
Compilation db:

[{
		"directory": "/workspace/sei_cert_test_suite/cpp",
		"command": "/usr/bin/gcc -Itests -c tests/FLP37-C-A.c -o obj/FLP37-C-A.o",
		"file": "tests/FLP37-C-A.c"
}]
CodeChecker analyze --output /local/workspace/sei_cert_test_suite/.codechecker/reports /local/workspace/sei_cert_test_suite/cpp/compile_commands.json --file /local/workspace/sei_cert_test_suite/cpp/tests/FLP37-C-A.c --analyzers clang-tidy clangsa -e cert
[INFO 2024-04-17 14:31] - No analysis is required.
There were no compilation commands in the provided compilation database or all of them were skipped.

The following behaviour is expected:

CodeChecker analyze --output /local/workspace/sei_cert_test_suite/.codechecker/reports /local/workspace/sei_cert_test_suite/cpp/compile_commands.json --file /local/workspace/sei_cert_test_suite/cpp/tests/FLP37-C-A.c --analyzers clang-tidy clangsa -e cert
[WARNING 2024-04-17 14:31] - No analysis is required.
[WARNING  2024-04-17 14:31] There were no compilation commands in the provided compilation database or all of them were skipped.

Metadata

Metadata

Assignees

Labels

analyzer 📈Related to the analyze commands (analysis driver)bug 🐛ld-logger 📃tools 🛠️Meta-tag for all the additional tools supplied with CodeChecker: plist2html, tu_collector, etc.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions