forked from ZedThree/clang-tidy-review
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
297 additions
and
69 deletions.
There are no files selected for viewing
This file contains 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,19 @@ | ||
FROM ubuntu:latest | ||
|
||
COPY requirements.txt /requirements.txt | ||
|
||
RUN apt update && apt install -y --no-install-recommends\ | ||
clang-tidy-6.0 \ | ||
clang-tidy-7 \ | ||
clang-tidy-8 \ | ||
clang-tidy-9 \ | ||
clang-tidy-10 \ | ||
git curl\ | ||
python3 python3-pip && \ | ||
pip3 install --upgrade pip && \ | ||
pip3 install -r requirements.txt | ||
|
||
COPY review.py /review.py | ||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains 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,45 @@ | ||
# clang-tidy review | ||
|
||
Create a pull-request review based on the warnings from clang-tidy. | ||
|
||
Doesn't spam by repeating identical warnings for the same line. | ||
|
||
 | ||
|
||
Example usage: | ||
|
||
```yaml | ||
name: clang-tidy-review | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: ZedThree/[email protected] | ||
id: review | ||
- if: steps.review.outpus.total_comments > 0 | ||
run: exit 1 | ||
``` | ||
## Inputs | ||
- `token`: Authentication token | ||
- default: `${{ github.token }}` | ||
- `build_dir`: Directory containing the `compile_commands.json` file | ||
- default: `'.'` | ||
- `clang_tidy_version`: Version of clang-tidy to use; one of 6.0, 7, 8, 9, 10 | ||
- default: '10' | ||
- `clang_tidy_checks`: List of checks | ||
- default: `'-*,performance-*,readability-*,bugprone-*,clang-analyzer-*,cppcoreguidelines-*,mpi-*,misc-*'` | ||
- `include`: Comma-separated list of files or patterns to include | ||
- default: `"*.[ch],*.[ch]xx,*.[ch]pp,*.[ch]++,*.cc,*.hh"` | ||
- `exclude`: Comma-separated list of files or patterns to exclude | ||
- default: '' | ||
|
||
## Outputs: | ||
|
||
- `total_comments`: Total number of warnings from clang-tidy |
This file contains 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,50 @@ | ||
name: 'clang-tidy review' | ||
author: 'Peter Hill' | ||
description: 'Create a pull request review based on warnings from clang-tidy' | ||
branding: | ||
icon: 'pen-tool' | ||
color: 'red' | ||
inputs: | ||
token: | ||
description: 'Authentication token' | ||
default: ${{ github.token }} | ||
required: false | ||
build_dir: | ||
description: 'Directory containing the compile_commands.json file' | ||
default: '.' | ||
required: false | ||
clang_tidy_version: | ||
description: 'Version of clang-tidy to use; one of 6.0, 7, 8, 9, 10' | ||
default: '10' | ||
required: false | ||
clang_tidy_checks: | ||
description: 'List of checks' | ||
default: '-*,performance-*,readability-*,bugprone-*,clang-analyzer-*,cppcoreguidelines-*,mpi-*,misc-*' | ||
required: false | ||
include: | ||
description: 'Comma-separated list of files or patterns to include' | ||
default: '"*.[ch],*.[ch]xx,*.[ch]pp,*.[ch]++,*.cc,*.hh"' | ||
required: false | ||
exclude: | ||
description: 'Comma-separated list of files or patterns to exclude' | ||
required: false | ||
default: '' | ||
pr: | ||
default: ${{ github.event.pull_request.number }} | ||
repo: | ||
default: ${{ github.repository }} | ||
outputs: | ||
total_comments: | ||
description: 'Total number of warnings from clang-tidy' | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
args: | ||
- --clang_tidy_binary=clang-tidy-${{ inputs.clang_tidy_version }} | ||
- --token=${{ inputs.token }} | ||
- --repo=${{ inputs.repo }} | ||
- --pr=${{ inputs.pr }} | ||
- --build_dir=${{ inputs.build_dir }} | ||
- --clang_tidy_checks=${{ inputs.clang_tidy_checks }} | ||
- --include ${{ inputs.include }} | ||
- --exclude ${{ inputs.exclude }} |
This file contains 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,3 @@ | ||
#!/bin/sh | ||
|
||
/review.py $* |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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,2 @@ | ||
PyGithub~=1.51 | ||
unidiff~=0.6.0 |
Oops, something went wrong.