Fix #11797 crash on missing/renamed files
As usual - please add a unit test for this.
This looks related to #5411 which I still need to finish up.
Also didn't we already add such code? I remember having a discussion with @danmar about something similar (with me having quite some opinion on this).
As usual - please add a unit test for this.
This looks related to #5411 which I still need to finish up.
Also didn't we already add such code? I remember having a discussion with @danmar about something similar (with me having quite some opinion on this).
It's not finished yet. Should have marked it as draft
Also didn't we already add such code? I remember having a discussion with @danmar about something similar (with me having quite some opinion on this).
I don't know.. I had a vague feeling we added something like this. But we do reproduce crashes with latest git head.
with me having quite some opinion on this
@firewave sorry but I don't have the discussion in my head.. please feel free to comment on this.
- This approach will mean that "fileNotFound" errors are written in the gui + xml report which is desired behavior imho.
- If the file is deleted/renamed for some reason after the project is imported then cppcheck will not crash but show the error report
This is okay as a catch-all to avoid the crashes (which is the most important in the short-term) but I still think it should be caught earlier.
This needs a release notes entry.
We also need Python tests for each project input which is lacking a file. I do not feel like adding tests later on which should have been there in the first place - again.
firewave has made an effort to make sure tests can be executed from different folders. As your test is written I fear it must be executed from inside test/cli folder.
@firewave
but I still think it should be caught earlier.
Overall I think that it is a good strategy to fail immediately/early... But we should probably think more carefully about how we report problems. If we just report it directly in plain text on stdout/stderr then it is likely that cppcheck plugins will not accept it as expected output - the user might not get any information about what goes wrong. We also need to ensure that the problem is properly logged in the GUI.