Skip to content

Conversation

@GNL10
Copy link
Contributor

@GNL10 GNL10 commented Oct 25, 2025

No description provided.

@GNL10
Copy link
Contributor Author

GNL10 commented Oct 25, 2025

Currently after the UTs finish there is a file that does not get deleted (e.g. outputfile_18314070737314589129.plist).
This is caused by the UT added in this PR. When reportErr is called inside in the negative scenario.

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";
Copy link
Owner

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?

Copy link
Contributor Author

@GNL10 GNL10 Oct 27, 2025

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.

Copy link
Owner

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.

Copy link
Owner

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

@sonarqubecloud
Copy link

const std::size_t dotPosition = filename.find('.');

if (dotPosition == std::string::npos) {
ErrorMessage::FileLocation loc(filename, 0, 0);
Copy link
Owner

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.

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.

2 participants