Ericsson / codechecker

CodeChecker is an analyzer tooling, defect database and viewer extension for the Clang Static Analyzer and Clang Tidy
https://codechecker.readthedocs.io
Apache License 2.0
2.15k stars 357 forks source link

List reports from header files in CLI (with parse) #4266

Open vodorok opened 1 week ago

vodorok commented 1 week ago

CodeChecker cannot list the reports on a given header file (It can only list reports for a given source file) with the cli parse, nor on the Web GUI.

Reports are stored in .plist files. There is a source file <-> plist file mapping in the metadata.json. However the header findings are located inside these .plist files (frequently in a duplicated form) and there is no header <–> plist file mapping.

Down below are two possible solution to this problem.

A plist <-> header mapping scould be added to the metadata.json file. Without modification of the current we output reports into the .plist files this would potentially not be a practical approach as a header file is analyzed in the context of many translation units. Thus to be able to fully list header related findings, CodeChecker would need to parse many different .plist files. If we would store the the header related reports into a header.plist file, the parsing would be simpler.

Another possibility would be to create a simple index of all reports in for example an sqlite database. This indexed database would only contain each report once and could have a source file - unique report indexing. However this database would be very similar in structure to the CodeChecker server database and such code duplication could be questionable.

Currently: CodeChecker parse ./report_dir –file source.c # lists the source.c file reprots

Proposed: CodeChecker parse ./report_dir –file header.h # lists the header.h reports, currently cannot list the reports from header.h.