Open vodorok opened 7 months ago
Wouldn't it be better to resolve the relative paths to the location of the compile_commands.json (instead of the CodeChecker invocation dir) and the plist files?
The advantage would be that you could run the CodeChecker (analyze/parse) from any directory because the location of real files could be calculated from the location of the compile_commands.json and the plist files.
Certain tools (bazel) produce such an output, where absolute paths cannot be used in a cross-environment way. Absolute paths in the
.plist
output make the CodeChecker store and diff commands unusable as (for example the Bazel) cache folder prefixes would not allow the proper identification of the source files.A dedicated flag should be added to the
CodeChecker analyze
command, which would enable the option of the use of relative paths during the whole CodeChecker workflow.I propose the
--use-relative-paths
flag for the function mentioned above.analyze:
When using the analyze command with a compilation command, that contains
"."
The current implementation defines the meaning of the relative directory in the compilation database in the following way: If the
"directory"
is a"."
CodeChecker will pass thecurrent working directory
to theexec()
function call in thecwd
parameter. Eg. the actual analysis command will be executed from theCodeChecker analysis
invocation location._We had an issue with the passing of a filename with leading path elements in the
–file
option.4180 Should fix the problem with the
--file
option._When the
--use-relative-paths
flag is active, all of the paths should be considered, and resolvable from the originalCodeChecker analyze
invocation, in every output format.Considering the following directory layout:
Example
.plist
The paths in the
.plist
file should be relative to the CodeChecker invocation location.parse, store, cmd, and server:
The support for relative paths should also be added to the report management command line (parse/store/cmd) utilities, and possibly to the server too.
Because the
.plist
contains paths to the source files relative to theCodeChecker analyze
invocation location, the user must invoke theCodeChecker store|parse|cmd
from the original invocation location ofCodeChecker analyze