Skip to content

Commit a125fb6

Browse files
authored
run clang-tidy using a common config and reduced set of tests (#1923)
* move clang-tidy config somewhere central and reduce it
1 parent 835365f commit a125fb6

File tree

2 files changed

+39
-8
lines changed

2 files changed

+39
-8
lines changed

.clang-tidy

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,37 @@
11
---
2-
Checks: 'clang-analyzer-*,readability-redundant-*,performance-*'
3-
WarningsAsErrors: 'clang-analyzer-*,readability-redundant-*,performance-*'
4-
HeaderFilterRegex: '.*'
2+
Checks: >
3+
abseil-*,
4+
bugprone-*,
5+
clang-analyzer-*,
6+
cppcoreguidelines-*,
7+
google-*,
8+
misc-*,
9+
performance-*,
10+
readability-*,
11+
-clang-analyzer-deadcode*,
12+
-clang-analyzer-optin*,
13+
-readability-identifier-length
14+
WarningsAsErrors: ''
15+
HeaderFilterRegex: ''
516
FormatStyle: none
6-
User: user
17+
CheckOptions:
18+
llvm-else-after-return.WarnOnConditionVariables: 'false'
19+
modernize-loop-convert.MinConfidence: reasonable
20+
modernize-replace-auto-ptr.IncludeStyle: llvm
21+
cert-str34-c.DiagnoseSignedUnsignedCharComparisons: 'false'
22+
google-readability-namespace-comments.ShortNamespaceLines: '10'
23+
cert-err33-c.CheckedFunctions: '::aligned_alloc;::asctime_s;::at_quick_exit;::atexit;::bsearch;::bsearch_s;::btowc;::c16rtomb;::c32rtomb;::calloc;::clock;::cnd_broadcast;::cnd_init;::cnd_signal;::cnd_timedwait;::cnd_wait;::ctime_s;::fclose;::fflush;::fgetc;::fgetpos;::fgets;::fgetwc;::fopen;::fopen_s;::fprintf;::fprintf_s;::fputc;::fputs;::fputwc;::fputws;::fread;::freopen;::freopen_s;::fscanf;::fscanf_s;::fseek;::fsetpos;::ftell;::fwprintf;::fwprintf_s;::fwrite;::fwscanf;::fwscanf_s;::getc;::getchar;::getenv;::getenv_s;::gets_s;::getwc;::getwchar;::gmtime;::gmtime_s;::localtime;::localtime_s;::malloc;::mbrtoc16;::mbrtoc32;::mbsrtowcs;::mbsrtowcs_s;::mbstowcs;::mbstowcs_s;::memchr;::mktime;::mtx_init;::mtx_lock;::mtx_timedlock;::mtx_trylock;::mtx_unlock;::printf_s;::putc;::putwc;::raise;::realloc;::remove;::rename;::scanf;::scanf_s;::setlocale;::setvbuf;::signal;::snprintf;::snprintf_s;::sprintf;::sprintf_s;::sscanf;::sscanf_s;::strchr;::strerror_s;::strftime;::strpbrk;::strrchr;::strstr;::strtod;::strtof;::strtoimax;::strtok;::strtok_s;::strtol;::strtold;::strtoll;::strtoul;::strtoull;::strtoumax;::strxfrm;::swprintf;::swprintf_s;::swscanf;::swscanf_s;::thrd_create;::thrd_detach;::thrd_join;::thrd_sleep;::time;::timespec_get;::tmpfile;::tmpfile_s;::tmpnam;::tmpnam_s;::tss_create;::tss_get;::tss_set;::ungetc;::ungetwc;::vfprintf;::vfprintf_s;::vfscanf;::vfscanf_s;::vfwprintf;::vfwprintf_s;::vfwscanf;::vfwscanf_s;::vprintf_s;::vscanf;::vscanf_s;::vsnprintf;::vsnprintf_s;::vsprintf;::vsprintf_s;::vsscanf;::vsscanf_s;::vswprintf;::vswprintf_s;::vswscanf;::vswscanf_s;::vwprintf_s;::vwscanf;::vwscanf_s;::wcrtomb;::wcschr;::wcsftime;::wcspbrk;::wcsrchr;::wcsrtombs;::wcsrtombs_s;::wcsstr;::wcstod;::wcstof;::wcstoimax;::wcstok;::wcstok_s;::wcstol;::wcstold;::wcstoll;::wcstombs;::wcstombs_s;::wcstoul;::wcstoull;::wcstoumax;::wcsxfrm;::wctob;::wctrans;::wctype;::wmemchr;::wprintf_s;::wscanf;::wscanf_s;'
24+
cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField: 'false'
25+
cert-dcl16-c.NewSuffixes: 'L;LL;LU;LLU'
26+
google-readability-braces-around-statements.ShortStatementLines: '1'
27+
cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic: 'true'
28+
google-readability-namespace-comments.SpacesBeforeComments: '2'
29+
modernize-loop-convert.MaxCopySize: '16'
30+
modernize-pass-by-value.IncludeStyle: llvm
31+
modernize-use-nullptr.NullMacros: 'NULL'
32+
llvm-qualified-auto.AddConstToQualified: 'false'
33+
modernize-loop-convert.NamingStyle: CamelCase
34+
llvm-else-after-return.WarnOnUnfixable: 'false'
35+
google-readability-function-size.StatementThreshold: '800'
36+
...
37+

.github/workflows/clang-tidy.yml renamed to .github/workflows/clang-tidy-lint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ jobs:
1717
run: sudo apt update && sudo apt -y install clang-tidy
1818

1919
- name: create build environment
20-
run: cmake -E make_directory ${{ runner.workspace }}/_build
20+
run: cmake -E make_directory ${{ github.workspace }}/_build
2121

2222
- name: configure cmake
2323
shell: bash
24-
working-directory: ${{ runner.workspace }}/_build
24+
working-directory: ${{ github.workspace }}/_build
2525
run: >
2626
cmake $GITHUB_WORKSPACE
2727
-DBENCHMARK_ENABLE_ASSEMBLY_TESTS=OFF
@@ -34,5 +34,5 @@ jobs:
3434
3535
- name: run
3636
shell: bash
37-
working-directory: ${{ runner.workspace }}/_build
38-
run: run-clang-tidy -checks=*,-clang-analyzer-deadcode*,-clang-analyzer-optin*
37+
working-directory: ${{ github.workspace }}/_build
38+
run: run-clang-tidy -config-file=$GITHUB_WORKSPACE/.clang-tidy

0 commit comments

Comments
 (0)