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

Add Clang-Tidy to the Project #54

Conversation

franziska-wegner
Copy link
Owner

@franziska-wegner franziska-wegner commented Dec 27, 2023

This PR enables clang-tidy in the main CMake file [5]. Clang-tidy will help to enable developer guidelines such as [1,2]. The C++ Core Guidelines checkers are more a MSVC tool, which is not usable in a multi-platform development framework. A documentation for clang-tidy can be found in [4].

References:
[1] https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines
[2] https://developers.google.com/style/
[3] https://github.com/MicrosoftDocs/cpp-docs/blob/main/docs/code-quality/using-the-cpp-core-guidelines-checkers.md
[4] https://clang.llvm.org/extra/clang-tidy/
[5] https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_CLANG_TIDY.html

The standard llvm installation on MacOS does not contain clang-tidy, see the below 2 screenshots.
Screenshot 2023-12-27 at 12 48 55 PM
Screenshot 2023-12-27 at 12 49 17 PM

The brew installation contains clang-tidy. We add the installation step for MacOS with brew install llvm to the GitHub workflow and add a path HINT to find_program.
Screenshot 2023-12-27 at 12 49 03 PM

 Changes to be committed:
	modified:   CMakeLists.txt
	new file:   cmake/FindClangTidy.cmake
@franziska-wegner franziska-wegner added enhancement New feature or request CI/CD Changes in the CI process labels Dec 27, 2023
@franziska-wegner franziska-wegner self-assigned this Dec 27, 2023
@franziska-wegner franziska-wegner marked this pull request as ready for review December 27, 2023 20:09
Copy link

codecov bot commented Dec 27, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (fe424e7) 93.26% compared to head (2586932) 93.26%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #54   +/-   ##
=======================================
  Coverage   93.26%   93.26%           
=======================================
  Files          29       29           
  Lines        2823     2823           
=======================================
  Hits         2633     2633           
  Misses        190      190           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@franziska-wegner franziska-wegner changed the title Add Clang-Tidy to the Project Add Clang-Tidy to the Project Dec 27, 2023
Why?
* The CXX compiler identification is AppleClang 14.0.0.14000029
* ls -la /Library/Developer/CommandLineTools/usr/bin/c*
* For more information, see https://stackoverflow.com/questions/53111082/how-to-install-clang-tidy-on-macos

Changes to be committed:
	modified:   .github/workflows/cmake-multi-platform.yml
Changes to be committed:
	modified:   CMakeLists.txt
	modified:   cmake/FindClangTidy.cmake
@franziska-wegner franziska-wegner merged commit 6a26946 into main Dec 27, 2023
15 checks passed
@franziska-wegner franziska-wegner deleted the franziska-wegner/2023/december/CI/clang-tidy-cmake-integration branch December 27, 2023 21:31
github-actions bot added a commit that referenced this pull request Dec 27, 2023
This PR enables `clang-tidy` in the main CMake file [5]. Clang-tidy will help to enable developer guidelines such as [1,2]. The C++ Core Guidelines checkers are more a MSVC tool, which is not usable in a multi-platform development framework. A documentation for `clang-tidy` can be found in [4].

References:
[1] https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines
[2] https://developers.google.com/style/
[3] https://github.com/MicrosoftDocs/cpp-docs/blob/main/docs/code-quality/using-the-cpp-core-guidelines-checkers.md
[4] https://clang.llvm.org/extra/clang-tidy/
[5] https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_CLANG_TIDY.html

* Add Clang-Tidy to the project
* Install LLVM for Clang-Tidy on MacOS
   Why?
   * The CXX compiler identification is AppleClang 14.0.0.14000029
   * ls -la /Library/Developer/CommandLineTools/usr/bin/c*
   * For more information, see https://stackoverflow.com/questions/53111082/how-to-install-clang-tidy-on-macos
* Add GitHub's `homebrew` path hint to `find_program` 6a26946
github-actions bot added a commit that referenced this pull request Dec 27, 2023
This PR enables `clang-tidy` in the main CMake file [5]. Clang-tidy will help to enable developer guidelines such as [1,2]. The C++ Core Guidelines checkers are more a MSVC tool, which is not usable in a multi-platform development framework. A documentation for `clang-tidy` can be found in [4].

References:
[1] https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines
[2] https://developers.google.com/style/
[3] https://github.com/MicrosoftDocs/cpp-docs/blob/main/docs/code-quality/using-the-cpp-core-guidelines-checkers.md
[4] https://clang.llvm.org/extra/clang-tidy/
[5] https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_CLANG_TIDY.html

* Add Clang-Tidy to the project
* Install LLVM for Clang-Tidy on MacOS
   Why?
   * The CXX compiler identification is AppleClang 14.0.0.14000029
   * ls -la /Library/Developer/CommandLineTools/usr/bin/c*
   * For more information, see https://stackoverflow.com/questions/53111082/how-to-install-clang-tidy-on-macos
* Add GitHub's `homebrew` path hint to `find_program` 6a26946
github-actions bot added a commit that referenced this pull request Dec 27, 2023
This PR enables `clang-tidy` in the main CMake file [5]. Clang-tidy will help to enable developer guidelines such as [1,2]. The C++ Core Guidelines checkers are more a MSVC tool, which is not usable in a multi-platform development framework. A documentation for `clang-tidy` can be found in [4].

References:
[1] https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines
[2] https://developers.google.com/style/
[3] https://github.com/MicrosoftDocs/cpp-docs/blob/main/docs/code-quality/using-the-cpp-core-guidelines-checkers.md
[4] https://clang.llvm.org/extra/clang-tidy/
[5] https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_CLANG_TIDY.html

* Add Clang-Tidy to the project
* Install LLVM for Clang-Tidy on MacOS
   Why?
   * The CXX compiler identification is AppleClang 14.0.0.14000029
   * ls -la /Library/Developer/CommandLineTools/usr/bin/c*
   * For more information, see https://stackoverflow.com/questions/53111082/how-to-install-clang-tidy-on-macos
* Add GitHub's `homebrew` path hint to `find_program` 6a26946
github-actions bot added a commit that referenced this pull request Dec 27, 2023
This PR enables `clang-tidy` in the main CMake file [5]. Clang-tidy will help to enable developer guidelines such as [1,2]. The C++ Core Guidelines checkers are more a MSVC tool, which is not usable in a multi-platform development framework. A documentation for `clang-tidy` can be found in [4].

References:
[1] https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines
[2] https://developers.google.com/style/
[3] https://github.com/MicrosoftDocs/cpp-docs/blob/main/docs/code-quality/using-the-cpp-core-guidelines-checkers.md
[4] https://clang.llvm.org/extra/clang-tidy/
[5] https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_CLANG_TIDY.html

* Add Clang-Tidy to the project
* Install LLVM for Clang-Tidy on MacOS
   Why?
   * The CXX compiler identification is AppleClang 14.0.0.14000029
   * ls -la /Library/Developer/CommandLineTools/usr/bin/c*
   * For more information, see https://stackoverflow.com/questions/53111082/how-to-install-clang-tidy-on-macos
* Add GitHub's `homebrew` path hint to `find_program` 6a26946
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/CD Changes in the CI process enhancement New feature or request
Projects
Development

Successfully merging this pull request may close these issues.

1 participant