mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-14 20:48:00 +00:00
Create clang-tidy CI (#12653)
Update clang-tidy config to prepare for creating a CI workflow to run clang-tidy. Added clangtidy check in CI Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com>
This commit is contained in:
parent
5f1bc8ff56
commit
402e1995f0
2 changed files with 75 additions and 27 deletions
84
.clang-tidy
84
.clang-tidy
|
|
@ -1,30 +1,60 @@
|
||||||
---
|
---
|
||||||
# turn off readability-braces-around-statements to allow single line statement like 'if (x == y) doSomething();'
|
|
||||||
Checks: '-*,cppcoreguidelines-*,google-*,readability-*,modernize-*,-readability-braces-around-statements,-google-runtime-references,-cppcoreguidelines-pro-type-reinterpret-cast'
|
# NOTE:
|
||||||
WarningsAsErrors: ''
|
# The check is a multiline string here. Comment must not be moved into the string.
|
||||||
|
# Be sure to keep the disabled rules alphabetically sorted.
|
||||||
|
#
|
||||||
|
# Checks that are turned off:
|
||||||
|
#
|
||||||
|
# -cppcoreguidelines-macro-usage: There are a lot of false-positives like Function-like macro 'Foo' used; consider a 'constexpr' template function
|
||||||
|
# -cppcoreguidelines-pro-type-reinterpret-cast: Originally turned off.
|
||||||
|
# -google-readability-todo: Not enforced.
|
||||||
|
# -google-runtime-references: https://github.com/microsoft/onnxruntime/blob/main/docs/Coding_Conventions_and_Standards.md#c-code-style.
|
||||||
|
# -modernize-concat-nested-namespaces: We don't use it.
|
||||||
|
# -modernize-use-trailing-return-type: Stylistic preference we do not enforce.
|
||||||
|
# -readability-identifier-length: A lot of numerical code rely on short names to improve readability.
|
||||||
|
# -readability-uppercase-literal-suffix: We accept lowercase suffixes
|
||||||
|
|
||||||
|
Checks: >
|
||||||
|
-*,
|
||||||
|
cppcoreguidelines-*,
|
||||||
|
google-*,
|
||||||
|
readability-*,
|
||||||
|
modernize-*,
|
||||||
|
bugprone-*,
|
||||||
|
performance-*,
|
||||||
|
misc-*,
|
||||||
|
-cppcoreguidelines-macro-usage,
|
||||||
|
-cppcoreguidelines-pro-type-reinterpret-cast,
|
||||||
|
-google-readability-todo,
|
||||||
|
-google-runtime-references,
|
||||||
|
-modernize-concat-nested-namespaces,
|
||||||
|
-modernize-use-trailing-return-type,
|
||||||
|
-readability-identifier-length,
|
||||||
|
-readability-uppercase-literal-suffix,
|
||||||
|
WarningsAsErrors: ""
|
||||||
HeaderFilterRegex: '.*onnxruntime\/core\/.*'
|
HeaderFilterRegex: '.*onnxruntime\/core\/.*'
|
||||||
AnalyzeTemporaryDtors: false
|
AnalyzeTemporaryDtors: false
|
||||||
FormatStyle: none
|
FormatStyle: none
|
||||||
CheckOptions:
|
CheckOptions:
|
||||||
- key: google-readability-braces-around-statements.ShortStatementLines
|
- key: google-readability-braces-around-statements.ShortStatementLines
|
||||||
value: '1'
|
value: "1"
|
||||||
- key: google-readability-function-size.StatementThreshold
|
- key: google-readability-function-size.StatementThreshold
|
||||||
value: '800'
|
value: "800"
|
||||||
- key: google-readability-namespace-comments.ShortNamespaceLines
|
- key: google-readability-namespace-comments.ShortNamespaceLines
|
||||||
value: '10'
|
value: "10"
|
||||||
- key: google-readability-namespace-comments.SpacesBeforeComments
|
- key: google-readability-namespace-comments.SpacesBeforeComments
|
||||||
value: '2'
|
value: "2"
|
||||||
- key: modernize-loop-convert.MaxCopySize
|
- key: modernize-loop-convert.MaxCopySize
|
||||||
value: '16'
|
value: "16"
|
||||||
- key: modernize-loop-convert.MinConfidence
|
- key: modernize-loop-convert.MinConfidence
|
||||||
value: reasonable
|
value: reasonable
|
||||||
- key: modernize-loop-convert.NamingStyle
|
- key: modernize-loop-convert.NamingStyle
|
||||||
value: CamelCase
|
value: CamelCase
|
||||||
- key: modernize-pass-by-value.IncludeStyle
|
- key: modernize-pass-by-value.IncludeStyle
|
||||||
value: google
|
value: google
|
||||||
- key: modernize-replace-auto-ptr.IncludeStyle
|
- key: modernize-replace-auto-ptr.IncludeStyle
|
||||||
value: google
|
value: google
|
||||||
- key: modernize-use-nullptr.NullMacros
|
- key: modernize-use-nullptr.NullMacros
|
||||||
value: 'NULL'
|
value: "NULL"
|
||||||
...
|
---
|
||||||
|
|
||||||
|
|
|
||||||
18
.github/workflows/lint.yml
vendored
18
.github/workflows/lint.yml
vendored
|
|
@ -81,6 +81,24 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
|
- name: Install ninja
|
||||||
|
run: python -m pip install --upgrade ninja
|
||||||
|
- name: Generate compile_commands.json
|
||||||
|
run: |
|
||||||
|
python tools/ci_build/build.py \
|
||||||
|
--cmake_generator "Ninja" \
|
||||||
|
--build_dir build \
|
||||||
|
--update \
|
||||||
|
--cmake_extra_defines CMAKE_EXPORT_COMPILE_COMMANDS=ON
|
||||||
|
- name: Generate ONNX protobuf files
|
||||||
|
run: cmake --build build/Debug --config Debug --target onnx_proto
|
||||||
|
- name: Run clang-tidy
|
||||||
|
uses: ZedThree/clang-tidy-review@526cbfb043719639f1ebdeedae0cc1eacd219d8f
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.github_token }}
|
||||||
|
build_dir: "build/Debug"
|
||||||
|
config_file: ".clang-tidy"
|
||||||
|
lgtm_comment_body: ""
|
||||||
- uses: reviewdog/action-cpplint@master
|
- uses: reviewdog/action-cpplint@master
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.github_token }}
|
github_token: ${{ secrets.github_token }}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue