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

Enable code analysis via clang-tidy in Visual Studio #2187

Merged
merged 2 commits into from
Feb 27, 2024
Merged

Enable code analysis via clang-tidy in Visual Studio #2187

merged 2 commits into from
Feb 27, 2024

Conversation

theComputeKid
Copy link
Contributor

@theComputeKid theComputeKid commented Feb 17, 2024

What does this PR do?

This PR enables the selection of clang-tidy as a code analyser when the code analyser action of Visual Studio is run in the IDE. Further details can be found in the official documentation.

How does this PR change Premake's behavior?

Add configuration-scoped option clangtidy for Visual Studio 2019 and above.

I have tried to follow pre-existing conventions:

  • The option name was a lowercase boolean based on compilebuildoutputs as an example.
  • The test_output_props tests for vs2019 were based on vs2022 test_output_props.
  • A test was also added to ensure pre-vs2019 configs were not affected.
  • Documentation was added based on the buildstlmodules example, which was a similar boolean.

Did you check all the boxes?

  • Focus on a single fix or feature; remove any unrelated formatting or code changes

  • Add unit tests showing fix or feature works; all tests pass

  • Mention any related issues (put closes #XXXX in comment to auto-close issue when PR is merged)

  • Follow our coding conventions

  • Minimize the number of commits

  • Align documentation to your changes

@@ -169,6 +169,12 @@
}
}

api.register {
Copy link
Contributor

Choose a reason for hiding this comment

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

As it seems visualstudio specific, put it in vstudio/_preload.lua instead.
Or maybe other generators "just" have to call clang-tidy source.cpp $(CXXFLAGS) after cxx source.cpp $(CXXFLAGS)...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As it seems visualstudio specific, put it in vstudio/_preload.lua instead.

This suggestion is easier, and something I have now added a commit for. Perhaps clang-tidy for other generators can be future work.

Copy link
Contributor

@Jarod42 Jarod42 left a comment

Choose a reason for hiding this comment

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

ok for me

@samsinsane samsinsane merged commit 4ca288b into premake:master Feb 27, 2024
14 checks passed
@theComputeKid theComputeKid deleted the patch-1 branch February 28, 2024 10:57
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.

3 participants