-
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. |
| } | ||
|
|
||
| const std::size_t fileNameHash = std::hash<std::string> {}(file.spath()); | ||
| filename = mSettings.plistOutput + filename.substr(0, filename.find('.')) + "_" + std::to_string(fileNameHash) + ".plist"; |
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 it's not your code.. but I wonder why we decided to hash the filename. could you lookup the commit that added the fileNameHash using git blame and see if that explains it?
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.
No problem. It came from this PR.
From the description, it looks like it is needed for supporting files with the same name in different
directories.
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.
ok thanks that explains it.
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.
could you add a comment like:
// the hash is added to handle when files in different folders have the same name
|
| 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.



No description provided.