forked from teeworlds/teeworlds
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request teeworlds#3155 from Robyt3/Clang-Tidy
Add clang-tidy to CI and enable clang-analyzer checks
- Loading branch information
Showing
18 changed files
with
139 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Why we disabled individual checks: | ||
# | ||
# clang-analyzer-optin.cplusplus.UninitializedObject | ||
# TODO: Occurs commonly in graphics_threaded.h | ||
# clang-analyzer-optin.cplusplus.VirtualCall | ||
# Occurs very commonly all over | ||
# clang-analyzer-optin.performance.Padding | ||
# Too annoying to always align for perfect padding | ||
# clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling, | ||
# TODO: Requires C11 to fix | ||
# misc-unused-parameters | ||
# TODO: Many changes | ||
|
||
Checks: > | ||
-*, | ||
bugprone-*, | ||
-bugprone-assignment-in-if-condition, | ||
-bugprone-branch-clone, | ||
-bugprone-easily-swappable-parameters, | ||
-bugprone-implicit-widening-of-multiplication-result, | ||
-bugprone-incorrect-roundings, | ||
-bugprone-integer-division, | ||
-bugprone-macro-parentheses, | ||
-bugprone-narrowing-conversions, | ||
-bugprone-parent-virtual-call, | ||
-bugprone-reserved-identifier, | ||
-bugprone-suspicious-include, | ||
-bugprone-unhandled-self-assignment, | ||
clang-analyzer-*, | ||
-clang-analyzer-optin.cplusplus.UninitializedObject, | ||
-clang-analyzer-optin.cplusplus.VirtualCall, | ||
-clang-analyzer-optin.performance.Padding, | ||
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling, | ||
cppcoreguidelines-avoid-goto, | ||
cppcoreguidelines-interfaces-global-init, | ||
cppcoreguidelines-slicing, | ||
cppcoreguidelines-virtual-class-destructor, | ||
misc-*, | ||
-misc-const-correctness, | ||
-misc-no-recursion, | ||
-misc-non-private-member-variables-in-classes, | ||
-misc-static-assert, | ||
-misc-unused-parameters, | ||
performance-*, | ||
-performance-no-int-to-ptr, | ||
portability-*, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Check clang-tidy | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- master | ||
- staging.tmp | ||
- trying.tmp | ||
- staging-squash-merge.tmp | ||
pull_request: | ||
|
||
jobs: | ||
check-clang-tidy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: true | ||
|
||
- name: Install clang-tidy | ||
run: | | ||
sudo apt-get update -y | ||
sudo apt-get install pkg-config cmake ninja-build libfreetype6-dev libsdl2-dev clang-tidy -y | ||
- name: Build with clang-tidy | ||
run: | | ||
mkdir clang-tidy | ||
cd clang-tidy | ||
cmake -G Ninja -DCMAKE_CXX_CLANG_TIDY="clang-tidy;-warnings-as-errors=*" -DCMAKE_C_CLANG_TIDY="clang-tidy;-warnings-as-errors=*" -DCMAKE_BUILD_TYPE=Debug -Werror=dev .. | ||
cmake --build . --config Debug --target everything -- -k 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Need at least one check, otherwise clang-tidy fails, use one that can't | ||
# happen in our code since we don't use OpenMP API. | ||
Checks: '-*,openmp-exception-escape' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.