-
-
Notifications
You must be signed in to change notification settings - Fork 230
clang-tidy support
#3722
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
Merged
Merged
clang-tidy support
#3722
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
3467092
Add clang-tidy performance config
schnellerhase 2a43126
Add clang tidy support to cmake
schnellerhase d633df6
Add clang-tidy CI for C++ build
schnellerhase 9b7c2b2
Apply clang-tidy performance fixes
schnellerhase d7ba1cc
Add clang-tidy flag no-unknown-warning-option
schnellerhase 32506d7
Merge branch 'main' into clang-tidy
schnellerhase 6ee162c
Merge branch 'main' into clang-tidy
schnellerhase 222ba45
Merge branch 'main' into clang-tidy
garth-wells a94e57d
Merge branch 'main' into clang-tidy
schnellerhase 81c0227
Tidy cmake command
schnellerhase dce7402
More fine tuning
schnellerhase 5298a3e
Remove tab
schnellerhase f5687b6
Add clang-tidy option to C++ tests
schnellerhase fd319e5
Remove catch2 clang-tidy lints by using system installed version
schnellerhase 2503d8c
Fix tests
schnellerhase 452729e
Add clang-tidy cmake option to python module
schnellerhase 47ab3be
Add build dependencies install
schnellerhase f209e8b
Merge branch 'main' into clang-tidy
schnellerhase 3cea74c
Fix python module
schnellerhase 8c373eb
Remove too new config option
schnellerhase 98ad05b
Merge branch 'main' into clang-tidy
schnellerhase 9706ae4
Adapt to changes on main
schnellerhase 5abfbdd
Merge branch 'main' into clang-tidy
schnellerhase File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,8 @@ | ||
| WarningsAsErrors: "*" | ||
| UseColor: true | ||
| HeaderFilterRegex: '^(?!MPI_api.h$|PETSc_api.h$).*' # Pulled in from python packages and not classified as system headers | ||
| ExtraArgsBefore: | ||
| - '-Wno-unknown-warning-option' | ||
| Checks: > | ||
| -*, | ||
| performance* |
This file contains hidden or 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,83 @@ | ||
| name: clang-tidy | ||
|
|
||
| on: | ||
| schedule: | ||
| # daily at 1am | ||
| - cron: "0 1 * * *" | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| push: | ||
| branches: | ||
| - "**" | ||
| tags: | ||
| - "v*" | ||
| merge_group: | ||
| branches: | ||
| - main | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| clang-tidy: | ||
| runs-on: ubuntu-latest | ||
| container: "ghcr.io/fenics/test-env:current-openmpi" | ||
| env: | ||
| PETSC_ARCH: linux-gnu-real64-32 | ||
| OMPI_ALLOW_RUN_AS_ROOT: 1 | ||
| OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1 | ||
| PRTE_MCA_rmaps_default_mapping_policy: :oversubscribe | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| apt-get update | ||
| apt-get install -y clang-tidy catch2 | ||
| pip install -r python/build-requirements.txt | ||
|
|
||
| - name: Load environment variables | ||
| run: cat .github/workflows/fenicsx-refs.env >> $GITHUB_ENV | ||
|
|
||
| - name: Install FEniCS Python components | ||
| run: | | ||
| pip install git+https://github.com/FEniCS/ufl.git@${{ env.ufl_ref }} | ||
| pip install git+https://github.com/FEniCS/basix.git@${{ env.basix_ref }} | ||
| pip install git+https://github.com/FEniCS/ffcx.git@${{ env.ffcx_ref }} | ||
|
|
||
| - name: Configure (C++ lib) | ||
| run: > | ||
| cmake -G Ninja | ||
| -B build | ||
| -S cpp/ | ||
| -DCMAKE_BUILD_TYPE=Developer | ||
| -DENABLE_CLANG_TIDY=ON | ||
| -DDOLFINX_ENABLE_ADIOS2=ON | ||
| -DDOLFINX_ENABLE_KAHIP=ON | ||
| -DDOLFINX_ENABLE_PETSC=ON | ||
| -DDOLFINX_ENABLE_SCOTCH=ON | ||
| -DDOLFINX_ENABLE_SLEPC=ON | ||
| -DDOLFINX_ENABLE_PARMETIS=OFF | ||
|
|
||
| - name: Build (C++ lib) | ||
| run: cmake --build build | ||
|
|
||
| - name: Install (C++ lib) | ||
| run: cmake --install build | ||
|
|
||
| - name: Configure (C++ test) | ||
| run: > | ||
| cmake -G Ninja | ||
| -B build-test | ||
| -S cpp/test/ | ||
| -DENABLE_CLANG_TIDY=ON | ||
|
|
||
| - name: Build (C++ test) | ||
| run: cmake --build build-test | ||
|
|
||
| - name: Build (Python) | ||
| working-directory: python | ||
| run: > | ||
| pip install . | ||
| --no-build-isolation | ||
| --verbose | ||
| --config-settings=cmake.define.ENABLE_CLANG_TIDY=ON |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this recommended? Surprised.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, https://clang.llvm.org/extra/clang-tidy/checks/performance/avoid-endl.html - buffer flushing that is implied with
std::endlis discouraged.