Skip to content

Commit

Permalink
support new extra-args option (#104)
Browse files Browse the repository at this point in the history
* Support new extra-args option

* Update action.yml

Co-authored-by: Brendan <2bndy5@gmail.com>

* Update action.yml

Co-authored-by: Brendan <2bndy5@gmail.com>

* Update action.yml and README.md

Co-authored-by: Brendan <2bndy5@gmail.com>
  • Loading branch information
shenxianpeng and 2bndy5 committed Sep 9, 2022
1 parent 8d99b60 commit 952be34
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
5 changes: 5 additions & 0 deletions README.md
Expand Up @@ -139,6 +139,11 @@ jobs:
- **Description**: The directory containing compilation database (like compile_commands.json) file.
- Default: ''

#### `extra-args`

- **Description**: A string of extra arguments passed to clang-tidy for use as compiler arguments (like `-std=c++14 -Wall`).
- Default: ''

### Outputs

This action creates 1 output variable named `checks-failed`. Even if the linting checks fail for source files this action will still pass, but users' CI workflows can use this action's output to exit the workflow early if that is desired.
Expand Down
15 changes: 10 additions & 5 deletions action.yml
Expand Up @@ -41,15 +41,15 @@ inputs:
required: false
default: "12"
verbosity:
description: A hidden option to control the action's log verbosity. This is the `logging` level (degaults to DEBUG)
description: A hidden option to control the action's log verbosity. This is the `logging` level (defaults to DEBUG).
required: false
default: "10"
lines-changed-only:
description: Set this option to 'true' to only analyse changes in the event's diff. Defaults to 'false'.
description: Set this option to 'true' to only analyze changes in the event's diff. Defaults to 'false'.
required: false
default: false
files-changed-only:
description: Set this option to 'false' to analyse any source files in the repo. Defaults to 'true'.
description: Set this option to 'false' to analyze any source files in the repo. Defaults to 'true'.
required: false
default: true
ignore:
Expand All @@ -74,6 +74,10 @@ inputs:
description: The directory containing compile_commands.json file.
required: false
default: ""
extra-args:
description: A string of extra arguments passed to clang-tidy for use as compiler arguments. Multiple arguments are separated by spaces so the argument name and value should use an '=' sign instead of a space.
required: false
default: ""
outputs:
checks-failed:
description: An integer that can be used as a boolean value to indicate if all checks failed.
Expand All @@ -83,7 +87,7 @@ runs:
steps:
- name: Install action dependencies
shell: bash
run: python3 -m pip install clang-tools cpp-linter
run: python3 -m pip install clang-tools cpp-linter==1.4.7
- name: Install clang-tools binary executables
shell: bash
run: clang-tools -i ${{ inputs.version }} -b
Expand All @@ -103,4 +107,5 @@ runs:
--thread-comments=${{ inputs.thread-comments }} \
--ignore="${{ inputs.ignore }}" \
--database=${{ inputs.database }} \
--file-annotations=${{ inputs.file-annotations }}
--file-annotations=${{ inputs.file-annotations }} \
--extra-arg="${{ inputs.extra-args }}"

0 comments on commit 952be34

Please sign in to comment.