Skip to content

Fix #13556 (Import project: exclude missing files)#7644

Merged
firewave merged 6 commits intocppcheck-opensource:mainfrom
glankk:13556
Jul 7, 2025
Merged

Fix #13556 (Import project: exclude missing files)#7644
firewave merged 6 commits intocppcheck-opensource:mainfrom
glankk:13556

Conversation

@glankk
Copy link
Copy Markdown
Collaborator

@glankk glankk commented Jul 4, 2025

No description provided.

@glankk glankk changed the title Fix 13556 (Import project: exclude missing files) Fix #13556 (Import project: exclude missing files) Jul 4, 2025
@firewave
Copy link
Copy Markdown
Collaborator

firewave commented Jul 5, 2025

This needs to at least generate a warning if a file does not exist. Otherwise you could be unintentionally not analyzing files which would be a security concern.

@glankk
Copy link
Copy Markdown
Collaborator Author

glankk commented Jul 6, 2025

This needs to at least generate a warning if a file does not exist. Otherwise you could be unintentionally not analyzing files which would be a security concern.

Warnings for missing files are emitted when the checking is done, as it is for other project types. This change removes the failure to import which only happens for json projects.

@firewave
Copy link
Copy Markdown
Collaborator

firewave commented Jul 6, 2025

Warnings for missing files are emitted when the checking is done, as it is for other project types. This change removes the failure to import which only happens for json projects.

Then the tests which were removed should be restored and adjusted to reflect that.

Comment thread test/cli/project_test.py

ret, _, stderr = cppcheck(["--project=" + str(project_file)])
assert 0 == ret
assert f"{missing_file}:1:0: error: File is missing: {missing_file_posix} [syntaxError]\n\n^\n" == stderr
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Something for later - we should give this its own ID.

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.

Yeah this caught me off-guard, but it's beyond the scope of this pr.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Some of the changes related to this behavior have been a bit bandaid-y but there is big picture stuff. Which is why I am on the fence on some of these when they appear to be low-hanging fruits (if they actually were I would have posted fixes). I want to prevent multiple behavior changes for users like we have here that they now need to suppress syntaxError and will have to suppress a different ID in the future - and with the unmatched suppression handling still partially broken, it is a different can of worms (things are quite interconnected)...but I digress.

Copy link
Copy Markdown
Collaborator

@danmar danmar left a comment

Choose a reason for hiding this comment

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

lgtm.
I agree the ID should be changed.. however it must be a "critical error id".

@firewave firewave merged commit 8833e3e into cppcheck-opensource:main Jul 7, 2025
60 checks passed
@glankk glankk deleted the 13556 branch July 7, 2025 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants