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

clang-tidy.yml: updated to Clang 17 #302

Merged
merged 5 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 53 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,5 +1,57 @@
---
Checks: '*,-abseil-*,-altera-*,-android-*,-cert-*,-cppcoreguidelines-*,-fuchsia-*,-google-*,-hicpp-*,-linuxkernel-*,-llvm-*,-llvmlibc-*,-mpi-*,-objc-*,-openmp-*,-zircon-*,-misc-non-private-member-variables-in-classes,-modernize-avoid-c-arrays,-modernize-use-default-member-init,-modernize-use-using,-readability-braces-around-statements,-readability-function-size,-readability-implicit-bool-conversion,-readability-isolate-declaration,-readability-magic-numbers,-readability-simplify-boolean-expr,-readability-uppercase-literal-suffix,-modernize-use-auto,-modernize-use-trailing-return-type,-bugprone-branch-clone,-modernize-pass-by-value,-modernize-loop-convert,-modernize-use-emplace,-modernize-use-equals-default,-performance-noexcept-move-constructor,-modernize-use-equals-delete,-readability-identifier-length,-readability-function-cognitive-complexity,-modernize-return-braced-init-list,-misc-no-recursion,-bugprone-easily-swappable-parameters,-bugprone-narrowing-conversions,-concurrency-mt-unsafe,-modernize-loop-convert,-clang-analyzer-*,-performance-move-constructor-init,-performance-inefficient-string-concatenation,-performance-no-automatic-move,-modernize-use-override,-misc-use-anonymous-namespace,-modernize-use-nodiscard'
Checks: >
*,
-abseil-*,
-altera-*,
-android-*,
-cert-*,
-clang-analyzer-*,
-cppcoreguidelines-*,
-fuchsia-*,
-google-*,
-hicpp-*,
-linuxkernel-*,
-llvm-*,
-llvmlibc-*,
-mpi-*,
-objc-*,
-openmp-*,
-zircon-*,
-bugprone-branch-clone,
-bugprone-easily-swappable-parameters,
-bugprone-narrowing-conversions,
-bugprone-switch-missing-default-case,
-concurrency-mt-unsafe,
-misc-no-recursion,
-misc-non-private-member-variables-in-classes,
-misc-use-anonymous-namespace,
-modernize-avoid-c-arrays,
-modernize-loop-convert,
-modernize-pass-by-value,
-modernize-return-braced-init-list,
-modernize-use-auto,
-modernize-use-emplace,
-modernize-use-equals-default,
-modernize-use-equals-delete,
-modernize-use-default-member-init,
-modernize-use-nodiscard,
-modernize-use-override,
-modernize-use-trailing-return-type,
-modernize-use-using,
-readability-braces-around-statements,
-readability-function-cognitive-complexity,
-readability-function-size,
-readability-implicit-bool-conversion,
-readability-identifier-length,
-readability-isolate-declaration,
-readability-magic-numbers,
-readability-simplify-boolean-expr,
-readability-uppercase-literal-suffix,
-performance-avoid-endl,
-performance-inefficient-string-concatenation,
-performance-move-constructor-init,
-performance-no-automatic-move,
-performance-noexcept-move-constructor
HeaderFilterRegex: '.*'
WarningsAsErrors: '*'
CheckOptions:
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@ jobs:
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 16
sudo apt-get install clang-tidy-16
sudo ./llvm.sh 17
sudo apt-get install clang-tidy-17

- name: Verify clang-tidy configuration
run: |
clang-tidy-17 --verify-config

- name: Prepare CMake
run: |
cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DDISABLE_CPP03_SYNTAX_CHECK=ON
env:
CXX: clang-16
CXX: clang-17

- name: Clang-Tidy
run: |
run-clang-tidy-16 -q -j $(nproc) -p=cmake.output
run-clang-tidy-17 -q -j $(nproc) -p=cmake.output
7 changes: 6 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@

#include "simplecpp.h"

#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <cstring>
#include <map>
#include <string>
#include <utility>
#include <vector>

int main(int argc, char **argv)
{
Expand Down
9 changes: 9 additions & 0 deletions simplecpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@
#define SIMPLECPP_WINDOWS
#define NOMINMAX
#endif

#include "simplecpp.h"

#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
Expand All @@ -33,13 +36,18 @@
#include <fstream> // IWYU pragma: keep
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <set>
#include <sstream> // IWYU pragma: keep
#include <stack>
#include <stdexcept>
#include <string>
#if __cplusplus >= 201103L
#include <unordered_map>
#endif
#include <utility>
#include <vector>

#ifdef SIMPLECPP_WINDOWS
#include <windows.h>
Expand Down Expand Up @@ -3132,6 +3140,7 @@ static void getLocaltime(struct tm &ltime)
time_t t;
time(&t);
#ifndef _WIN32
// NOLINTNEXTLINE(misc-include-cleaner) - false positive
localtime_r(&t, &ltime);
#else
localtime_s(&ltime, &t);
Expand Down
11 changes: 9 additions & 2 deletions test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,18 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/

#include "simplecpp.h"

#include <cctype>
#include <cstdlib>
#include <cstring>
#include <exception>
#include <iostream>
#include <limits>
#include <map>
#include <sstream>
#include <stdexcept>
#include <string>
#include <vector>
#include "simplecpp.h"

static int numberOfFailedAssertions = 0;

Expand Down