cpp-linter / cpp-linter-action

A Github Action for linting C/C++ code integrating clang-tidy and clang-format to collect feedback provided in the form of file-annotations, thread-comments, workflow step-summary, and Pull Request reviews.

Home Page:https://cpp-linter.github.io/cpp-linter-action/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Seperate output for `clang-format` and `clang-tidy`

makslevental opened this issue · comments

Would you take a PR that separates steps.linter.outputs.checks-failed into steps.linter.outputs.clang-format-checks-failed and steps.linter.outputs.clang-tidy-checks-failed? I would like to block on formatting but only post the comments from clang-tidy.

I think adding more specific outputs is a good idea. Hint: the tally of checks-failed is counted in make_annotations() (despite the value of file-annotations input). IIRC, the output value is set in set_exit_code().

Currently, you could work around the generic output by running the action once for clang-tidy and once for clang-format:

steps:
  # ...
  - name: Run clang-tidy only
    id: clang-tidy
    uses: cpp-linter/cpp-linter-action@v2
    with:
      style: '' # disable clang-format
      # other applicable inputs...
  - name: clang-tidy check-failed?
    run: echo "${{ steps.clang-tidy.outputs.checks-failed }} clang-tidy concerns"

  - name: Run clang-format only
    id: clang-format
    uses: cpp-linter/cpp-linter-action@v2
    with:
      tidy-checks: '-*' # disable clang-tidy
      # other applicable inputs...
  - name: clang-format check-failed?
    run: echo "${{ steps.clang-format.outputs.checks-failed }} clang-format concerns"

Note

The above workflow is just a pseudo coded idea. Other cpp-linter-action inputs may apply as needed (namely version).

you know i was wondering if an empty string disabled clang-format. Thanks!

you know i was wondering if an empty string disabled clang-format. Thanks!

No problem. It is noted in the README. See also the tidy-checks explanation in README.

Reading comprehension ++ (also I've been up for like 40 hours lol). Thanks again.