Skip to content
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

Cppcheck & clang-tidy fixes #744

Merged
merged 6 commits into from
Feb 21, 2025
Merged

Cppcheck & clang-tidy fixes #744

merged 6 commits into from
Feb 21, 2025

Conversation

zjeffer
Copy link
Collaborator

@zjeffer zjeffer commented Feb 9, 2025

Command used:

cppcheck --enable=all --inconclusive --force --inline-suppr --library=qt --project=build/compile_commands.json --suppress="*:3rdParty*" --suppress="*:build/*" -i 3rdParty/ -i build --suppress=missingIncludeSystem --suppress=missing
Include --suppress=useStlAlgorithm --quiet -j$(nproc) --disable=unusedFunction --check-level=exhaustive  2>&1 | tee cppcheck.txt

All warnings are now fixed.

The command has 3 suppresions:

  • --suppress=missingIncludeSystem: because it can't find any Qt system libraries. Not sure how to fix this, we already pass --library=qt...
  • --suppress=missingInclude: same reason
  • --suppress=useStlAlgorithm: it often suggests changing a simple for-loop to a much less readable std::transform call.

@nuttyartist
Copy link
Owner

Wow so many fixes...The branch seems to work in my testing. The lqtutils_enum file is failing during lint like always (I usually discard clang-format changes to this file since the lint doesn't like its formatting for some reason).

@zjeffer zjeffer force-pushed the fix/zjeffer/fixes branch 2 times, most recently from f522f60 to 49148ce Compare February 15, 2025 23:13
@zjeffer zjeffer marked this pull request as ready for review February 15, 2025 23:21
@zjeffer
Copy link
Collaborator Author

zjeffer commented Feb 15, 2025

In 13a1f6b, I opted to replace the SpecialNodeId namespace + Value enum with simpler auto constexpr variables (see nodedata.h). I think it's cleaner this way.

@zjeffer zjeffer changed the title Cppcheck fixes Cppcheck & clang-tidy fixes Feb 16, 2025
@zjeffer
Copy link
Collaborator Author

zjeffer commented Feb 16, 2025

Added some clang-tidy fixes in latest commits (sorry 😄)

@guihkx
Copy link
Collaborator

guihkx commented Feb 18, 2025

This seems like a great thing to have on our CI/CD as well! Do you plan to do that in this PR?

On a side note, the openSUSE job is spewing a few compiler warnings in the build step. Can you a look at those, please?

@nuttyartist
Copy link
Owner

This seems like a great thing to have on our CI/CD as well! Do you plan to do that in this PR?

On a side note, the openSUSE job is spewing a few compiler warnings in the build step. Can you a look at those, please?

That would be a really great addition to our CI indeed.

@zjeffer
Copy link
Collaborator Author

zjeffer commented Feb 18, 2025

This seems like a great thing to have on our CI/CD as well! Do you plan to do that in this PR?

I created an issue for it but I don't plan to add it to this PR. First I wanted to fix all the errors ;)

@zjeffer
Copy link
Collaborator Author

zjeffer commented Feb 18, 2025

On a side note, the openSUSE job is spewing a few compiler warnings in the build step. Can you a look at those, please?

Fixed it. Not sure why my system and the other jobs didn't show that warning though. -Wpedantic should be enabled when using GCC or Clang according to the cmakelists.txt, I'm using clang and I didn't get the error 🤔

@guihkx
Copy link
Collaborator

guihkx commented Feb 19, 2025

Fixed it. Not sure why my system and the other jobs didn't show that warning though.

Must be some quirk/bug of GCC 10 — which only openSUSE is using. Thanks for fixing it, though. :)

As for all the code changes, I didn't go through all of them, but even if I did, I wouldn't understand most of them anyway, because most C++ concepts are still voodoo to me. 😅

Anyway, I did at least test the AppImage on Linux and it seems to be working okay.

I also went to test the Windows build, and got hit by a regression unrelated to this PR, but after reverting the offending commit, I verified that the Windows build also seems to be working okay.

Still, I'm deferring the actual review to @nuttyartist. But if I may nitpick, I'd just squash up some of these commits for a cleaner merge.

Copy link
Owner

@nuttyartist nuttyartist left a comment

Choose a reason for hiding this comment

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

Seems to work well on my machine (macoS). @zjeffer thanks for this! Ready to merge imo, your call on whether to squash.

@zjeffer zjeffer merged commit 67b6351 into master Feb 21, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants