diff --git a/README.md b/README.md index 62388954..7ffd188e 100644 --- a/README.md +++ b/README.md @@ -98,8 +98,9 @@ jobs: #### `verbosity` -- **Description**: This controls the action's verbosity in the workflow's logs. Supported options are defined by the [python logging library's log levels](https://docs.python.org/3/library/logging.html#logging-levels). This option does not affect the verbosity of resulting thread comments or file annotations. -- Default: '10' +- **Description**: This controls the action's verbosity in the workflow's logs. Supported options are `info` or `debug`. This option does not affect the verbosity of resulting thread comments or file annotations. + - The verbosity can also be engaged by enabling debug logs when [re-running jobs or workflows](https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs). +- Default: 'info' #### `lines-changed-only` @@ -168,6 +169,24 @@ jobs: - **Description**: A string of extra arguments passed to clang-tidy for use as compiler arguments (like `-std=c++14 -Wall`). - Default: '' +#### `tidy-review` + +**Beta feature** 🚧 + +- **Description**: Set this option to true to enable pull request reviews from clang-tidy. + - To use Pull Request reviews, the `GITHUB_TOKEN` (provided by Github to each repository) must be declared as an environment + variable. See [Authenticating with the GITHUB_TOKEN](https://docs.github.com/en/actions/reference/authentication-in-a-workflow) + - See also [the PR review feature caveats](https://cpp-linter.github.io/cpp-linter/pr_review_caveats.html) +- Default: false + +#### `format-review` + +- **Description**: Set this option to true to enable pull request reviews from clang-format. + - To use Pull Request reviews, the `GITHUB_TOKEN` (provided by Github to each repository) must be declared as an environment + variable. See [Authenticating with the GITHUB_TOKEN](https://docs.github.com/en/actions/reference/authentication-in-a-workflow) + - See also [the PR review feature caveats](https://cpp-linter.github.io/cpp-linter/pr_review_caveats.html) +- Default: false + ### Outputs This action creates 3 output variables. Even if the linting checks fail for source files this action will still pass, but users' CI workflows can use this action's outputs to exit the workflow early if that is desired. @@ -202,6 +221,18 @@ The total number of concerns raised by clang-format only. ![step summary](https://raw.githubusercontent.com/cpp-linter/cpp-linter-action/main/docs/images/step-summary.png) +### Pull Request Review + +Using only clang-tidy (`tidy-review`): + +![sample tidy-review](https://raw.githubusercontent.com/cpp-linter/cpp-linter-action/main/docs/images/tidy-review.png) + +Using only clang-format (`format-review`): + +![sample format-review](https://raw.githubusercontent.com/cpp-linter/cpp-linter-action/main/docs/images/format-review.png) + +![sample tidy-review](https://raw.githubusercontent.com/cpp-linter/cpp-linter-action/main/docs/images/format-suggestion.png) + ## Add C/C++ Linter Action badge in README diff --git a/action.yml b/action.yml index 7cfd6d9f..e95d6e16 100644 --- a/action.yml +++ b/action.yml @@ -62,9 +62,9 @@ inputs: required: false default: "12" verbosity: - description: A hidden option to control the action's log verbosity. This is the `logging` level (defaults to DEBUG). + description: A hidden option to control the action's log verbosity. This is the `logging` level (defaults to `info`). required: false - default: "10" + default: info lines-changed-only: description: Set this option to 'true' to only analyze changes in the event's diff. Defaults to 'false'. required: false @@ -99,6 +99,14 @@ inputs: 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: "" + tidy-review: + description: Set this to true to enable PR reviews from clang-tidy. See also https://cpp-linter.github.io/cpp-linter/pr_review_caveats.html + required: false + default: false + format-review: + description: Set this to true to enable PR reviews from clang-format.See also https://cpp-linter.github.io/cpp-linter/pr_review_caveats.html + required: false + default: false outputs: checks-failed: description: An integer that can be used as a boolean value to indicate if any checks failed by clang-tidy and clang-format. @@ -166,7 +174,9 @@ runs: --ignore="${{ inputs.ignore }}" \ --database=${{ inputs.database }} \ --file-annotations=${{ inputs.file-annotations }} \ - --extra-arg="${{ inputs.extra-args }}" + --extra-arg="${{ inputs.extra-args }}" \ + --tidy-review="${{ inputs.tidy-review }}" \ + --format-review="${{ inputs.format-review }}" - name: Setup python venv (Windows) if: runner.os == 'Windows' @@ -199,6 +209,8 @@ runs: ' --ignore="${{ inputs.ignore }}"' + ' --database=${{ inputs.database }}' + ' --file-annotations=${{ inputs.file-annotations }}' + - ' --extra-arg="${{ inputs.extra-args }}"' + ' --extra-arg="${{ inputs.extra-args }}"' + + ' --tidy-review="${{ inputs.tidy-review }}"' + + ' --format-review="${{ inputs.format-review }}"' Invoke-Expression -Command $app diff --git a/docs/images/format-review.png b/docs/images/format-review.png new file mode 100644 index 00000000..30be6b30 Binary files /dev/null and b/docs/images/format-review.png differ diff --git a/docs/images/format-suggestion.png b/docs/images/format-suggestion.png new file mode 100644 index 00000000..02168619 Binary files /dev/null and b/docs/images/format-suggestion.png differ diff --git a/docs/images/tidy-review.png b/docs/images/tidy-review.png new file mode 100644 index 00000000..8b58a41d Binary files /dev/null and b/docs/images/tidy-review.png differ diff --git a/requirements.txt b/requirements.txt index 1bbc9ff5..5aab7810 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,4 @@ clang-tools==0.11.1 # cpp-linter core Python executable package # For details please see: https://github.com/cpp-linter/cpp-linter -cpp-linter==1.6.5 +cpp-linter==1.7.1