Skip to content

Fix CLI parse status filter#4784

Merged
bruntib merged 1 commit intoEricsson:masterfrom
barnabasdomozi:parse_status_rel_path
Apr 6, 2026
Merged

Fix CLI parse status filter#4784
bruntib merged 1 commit intoEricsson:masterfrom
barnabasdomozi:parse_status_rel_path

Conversation

@barnabasdomozi
Copy link
Copy Markdown
Collaborator

The parse status file filter now correctly handles relative file paths in the compile_commands.json file. Additonally, a bug was fixed when the filter was used for nonexistent files.

@barnabasdomozi barnabasdomozi added the CLI 💻 Related to the command-line interface, such as the cmd, store, etc. commands label Feb 19, 2026
@barnabasdomozi barnabasdomozi force-pushed the parse_status_rel_path branch 3 times, most recently from d7024a3 to 83d2ec1 Compare February 19, 2026 15:13
dkrupp
dkrupp previously requested changes Feb 19, 2026
Copy link
Copy Markdown
Member

@dkrupp dkrupp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but
can you pls add a testcase with relative path in the compile_commands.json?

The parse status file filter now correctly handles
relative file paths in the compile_commands.json file.
Additonally, a bug was fixed when the filter was used
for nonexistent files.
@barnabasdomozi
Copy link
Copy Markdown
Collaborator Author

@dkrupp Added test cases in commit ba0fac8.

Comment on lines +421 to +424
if invalid_file_filter:
LOG.error("File filter (--file) contains nonexistent files:")
LOG.error(invalid_file_filter)
sys.exit(1)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of checking the existence of the file? I think, it can be a valid scenario to ask the users to send me their report folder and I make some queries about their analyzed files on my machine where the project code is not available.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, we assume the report_dir/ and the source files are on the same system.
Typical use case for the --status command with --file option is to check whether a local file has been analysed or not. This is also used heavily in the VSCode plugin. Moreover, we would also like to know if a file has been recently analyzed or outdated, thus we check the modification time of the local source file in function get_report_dir_status. If the modification time of the source file is more recent than the creation of the report_dir/, we consider the analysis status outdated.

This all assumes the report directory and the source files are on the same system. If this is the case, it is pointless to use the --file filter on a nonexisting file, thus an error was added.

I think, it can be a valid scenario to ask the users to send me their report folder and I make some queries about their analyzed files on my machine where the project code is not available.

While this is valid, I believe this is a separate use case. As an alternative, maybe we could add a flag like --ignore-nonexisting-files or something like that. But in the above case, we should at least somehow inform the user that they tried to query analysis information of non-existing files.

@bruntib bruntib dismissed dkrupp’s stale review April 6, 2026 21:07

Tests are implemented.

@bruntib bruntib merged commit 1b412ad into Ericsson:master Apr 6, 2026
9 checks passed
@barnabasdomozi barnabasdomozi deleted the parse_status_rel_path branch April 15, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLI 💻 Related to the command-line interface, such as the cmd, store, etc. commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants