Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seperate output for clang-format and clang-tidy #168

Closed
makslevental opened this issue Dec 2, 2023 · 5 comments · Fixed by #169
Closed

Seperate output for clang-format and clang-tidy #168

makslevental opened this issue Dec 2, 2023 · 5 comments · Fixed by #169
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@makslevental
Copy link

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.

@2bndy5
Copy link
Collaborator

2bndy5 commented Dec 2, 2023

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().

@2bndy5
Copy link
Collaborator

2bndy5 commented Dec 2, 2023

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).

@makslevental
Copy link
Author

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

@2bndy5
Copy link
Collaborator

2bndy5 commented Dec 2, 2023

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.

@makslevental
Copy link
Author

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

2bndy5 added a commit to cpp-linter/cpp-linter that referenced this issue Dec 2, 2023
@2bndy5 2bndy5 added enhancement New feature or request good first issue Good for newcomers labels Dec 2, 2023
2bndy5 added a commit to cpp-linter/cpp-linter that referenced this issue Dec 4, 2023
2bndy5 added a commit that referenced this issue Dec 4, 2023
resolves #168

adds 2 new output variables:
- clang-tidy-checks-failed
- clang-format-checks-failed
2bndy5 added a commit that referenced this issue Dec 5, 2023
resolves #168

adds 2 new output variables:
- clang-tidy-checks-failed
- clang-format-checks-failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants