Skip to content

fixed #13990/#13991 - reworked platform lookup #7639

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

firewave
Copy link
Collaborator

@firewave firewave commented Jul 1, 2025

  • provide a list of paths to look into to the platform loading
  • look relative to project file first (fixes #13990)
  • do not look into CWD for each path provided (fixes #13991)

if (!filesdir.empty()) {
if (filesdir.back() != '/')
filesdir += '/';
// TODO: look in filesdir?
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If we would also look into that folder it could just be one of the lookup paths above.

std::string ppath = Path::fromNativeSeparators(path);
if (ppath.back() != '/')
ppath += '/';
// TODO: look in platforms first?
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As the platforms folder is the proper location for these files it is weird that we do not look there first.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@@ -341,44 +341,40 @@ def test_platform_lookup_builtin(tmpdir):
]


@pytest.mark.skip # TODO: performs additional lookups when run via symlink in CI
Copy link
Collaborator Author

@firewave firewave Jul 4, 2025

Choose a reason for hiding this comment

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

The problem are the CWD lookups because if you run the test from the root it contains the configuration folders and it finds them. If the tests are run from the test folder it will look into that first which does not contain them. So it makes me wonder even more if we should remove those lookups.

Copy link
Owner

Choose a reason for hiding this comment

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

I can understand that point.. but it should be possible to put cppcheck configuration files in a project folder. custom cppcheck configurations should not be stored in the cppcheck installation folders.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can understand that point.. but it should be possible to put cppcheck configuration files in a project folder.

It still is.

custom cppcheck configurations should not be stored in the cppcheck installation folders.

That is up to the user or the packager.

But that is not the "problem" I am referring to (and it is also not in the scope of this PR). It is about the usage of CWD in the lookup.

It will look in the folder you run Cppcheck from. So on Linux, if you have files in your user folder (like we support in the GUI). And you open a new shell - which by default will start in the user folder. And you run Cppcheck immediately - it might pick up the files in the user folder (because it is the current CWD) before others. In that case supporting the CWD seems rather unexpected and arbitrary.

But making the decision about that is what #7613 is about and I would like to have that discussion there.

@firewave firewave changed the title reworked platform lookup fixed #13990/#13991 - reworked platform lookup Jul 6, 2025
@firewave firewave marked this pull request as ready for review July 6, 2025 20:43
@firewave firewave marked this pull request as draft July 6, 2025 20:50
@firewave firewave marked this pull request as ready for review July 6, 2025 20:51
@firewave
Copy link
Collaborator Author

firewave commented Jul 6, 2025

The platform loading code is now essentially what will be the shared code for all loading. There is still a few things to resolve and I need to check it against the code in the UI before moving to that.

Comment on lines +407 to +408
# TODO: test with invalid file in project path
# TODO: test with non-file in project path
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will be addressed in a follow-up to not cramp more stuff into this.

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