Skip to content

Commit 888bd70

Browse files
committed
ci: add clang-tidy check
1 parent 6ebb6a8 commit 888bd70

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

.clang-tidy

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
Checks: 'clang-diagnostic-*,clang-analyzer-*'
3+
WarningsAsErrors: ''
4+
HeaderFileExtensions:
5+
- ''
6+
- h
7+
- hh
8+
- hpp
9+
- hxx
10+
ImplementationFileExtensions:
11+
- c
12+
- cc
13+
- cpp
14+
- cxx
15+
HeaderFilterRegex: ''
16+
ExcludeHeaderFilterRegex: ''
17+
FormatStyle: none
18+
User: xuyunze
19+
CheckOptions:
20+
cert-dcl16-c.NewSuffixes: 'L;LL;LU;LLU'
21+
cert-err33-c.AllowCastToVoid: 'true'
22+
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;'
23+
cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField: 'false'
24+
cert-str34-c.DiagnoseSignedUnsignedCharComparisons: 'false'
25+
cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic: 'true'
26+
google-readability-braces-around-statements.ShortStatementLines: '1'
27+
google-readability-function-size.StatementThreshold: '800'
28+
google-readability-namespace-comments.ShortNamespaceLines: '10'
29+
google-readability-namespace-comments.SpacesBeforeComments: '2'
30+
llvm-else-after-return.WarnOnConditionVariables: 'false'
31+
llvm-else-after-return.WarnOnUnfixable: 'false'
32+
llvm-qualified-auto.AddConstToQualified: 'false'
33+
SystemHeaders: false
34+
...
35+

.github/workflows/lint.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Copyright 2025 Yunze Xu
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Lint
16+
17+
on:
18+
pull_requests:
19+
branches:
20+
- main
21+
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.ref }}
24+
cancel-in-progress: true
25+
26+
jobs:
27+
28+
lint:
29+
name: Lint check
30+
runs-on: ubuntu-latest
31+
timeout-minutes: 60
32+
33+
steps:
34+
- uses: actions/checkout@v3
35+
with:
36+
fetch-depth: 0
37+
submodules: recursive
38+
39+
- name: Build
40+
run: |
41+
cmake -B build
42+
cmake --build build -j4
43+
44+
- name: Tidy
45+
run: |
46+
apt install -y clang-tidy
47+
run-clang-tidy -p build -j4 -header-filter='.*'

0 commit comments

Comments
 (0)