Skip to content

Commit

Permalink
Release v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ZedThree committed May 30, 2020
1 parent 2ad79d0 commit 3df0acf
Show file tree
Hide file tree
Showing 7 changed files with 297 additions and 69 deletions.
19 changes: 19 additions & 0 deletions Dockerfile
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"]
45 changes: 45 additions & 0 deletions README.md
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 review](example_review.png)

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
50 changes: 50 additions & 0 deletions action.yml
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 }}
3 changes: 3 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

/review.py $*
Binary file added example_review.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PyGithub~=1.51
unidiff~=0.6.0
Loading

0 comments on commit 3df0acf

Please sign in to comment.