-
Couldn't load subscription status.
- Fork 1.5k
Add check for npos, when checkInternal receives file with missing dot #7911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Currently after the UTs finish there is a file that does not get deleted (e.g. outputfile_18314070737314589129.plist). Not entirely sure what the most appropriate way to delete that file should be. |
lib/cppcheck.cpp
Outdated
| const std::size_t dotPosition = filename.find('.'); | ||
|
|
||
| if (dotPosition == std::string::npos) { | ||
| ErrorMessage::FileLocation loc(filename, 0, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cppcheck will not check files without extension unless they are explicitly added somehow. So it's not analyzed by mistake.
Can we try to handle such files instead.. if there is no dot then skip the substr below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I think in the end there might be no issues with the code at all.
The initial issue was pointing to this:
filename2.substr(0, filename2.find('.'))
However filename2.substr(0, std::string::npos) is valid. It basically just keeps the string unchanged and copies it from start to finish.
It isn't immediately obvious, but it is what happens.
When file does not have suffix, the full name is used.
|
|
I like this PR. But CI fails right now. |
|
strange it seems to complain about the test you added: |



No description provided.