actions-rs / clippy-check

📎 GitHub Action for PR annotations with clippy warnings
https://github.com/marketplace/actions/rust-clippy-check
MIT License
288 stars 41 forks source link

Option: Set commit status to failed if any lint warnings are posted #81

Closed scouten closed 4 years ago

scouten commented 4 years ago

Motivation

I'd like my project to build with zero lint warnings.

Currently I use clippy-check as one of the GitHub warnings and –as advertised– it adds warnings to diffs generated in a pull request.

I would like it to go further and to set the status of any commit that has such warnings to "failed", so that I can use that status to block merging of any PR that introduces new warnings.

Workflow example

For backward compatibility, this could be a new opt-in flag, similar to the below:

jobs:
  clippy_check:
    name: Run Clippy lint checks
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - run: rustup component add clippy
      - uses: actions-rs/clippy-check@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          args: --all-features
        fail-on-warning: true

(I'm agnostic on the naming.)

svartalf commented 4 years ago

Hi, @scouten!

It seems unreasonable to add another input to do that, since clippy already able to fail execution if any warning occured with -D warnings option, as in this example.

In your case you just need to append it to the args input:

- uses: actions-rs/clippy-check@v1
  with:
    args: --all-features  -- -D warnings
scouten commented 4 years ago

@svartalf thank you for pointing that out. Had Googled various ways and not found that, but I have added that now to my project and it does indeed work as advertised.

Withdrawing the feature request.