reviewdog / action-brakeman

Run brakeman with reviewdog 🐶
MIT License
39 stars 24 forks source link

Error: Process completed with exit code 3 but no PR comments #38

Closed carl-printreleaf closed 2 years ago

carl-printreleaf commented 2 years ago

Using the following config on Github Actions:

name: reviewdog
on: [pull_request]
jobs:
  brakeman:
    name: runner / brakeman
    runs-on: ubuntu-latest
    steps:
      - name: Check out code
        uses: actions/checkout@v1
      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 3.0.3
      - name: brakeman
        uses: reviewdog/action-brakeman@v2
        with:
          brakeman_version: 4.10.1
          reporter: github-pr-review # Default is github-pr-check

Github Actions outputs:

Error: Process completed with exit code 3.

But does not add pull request comments on a line of code that brakeman complains about locally.

bogn83 commented 2 years ago

Same here, could only make use of the action and not let it fail our builds with this extra config:

          brakeman_flags: '--no-exit-on-warn --no-exit-on-error'

actually it is

          fail_on_error: true
          brakeman_flags: '--no-exit-on-warn --no-exit-on-error'

now for us which seems to contradict on first sight (fail on error but no exit on error) but to my understanding it tells the brakeman process itself not to exit with non-zero (this being the problem of this issue 38 here) but the action to report with failure and not just a warning hidden in the checks tab.

What I don't get is why this change was necessary. The only change in any of the relevant areas is that we renamed our main branch to main 20 days ago. But there were countless successful builds since then with no changes to the linting workflow which was using v1 of this action. Only this morning we started to get: reviewdog: failed to run 'git rev-parse --show-prefix': exit status 128.

Updating to v2 brought up the error in this issue here. Workaround for now is what I wrote in the beginning, but specifying these brakeman_flags for default behavior seems kind of inappropriate.

carl-printreleaf commented 2 years ago

@bogn83 that's helpful thanks

Mason-Seeger commented 2 years ago

I have a brakeman action set up as follows:

brakeman:
    name: Brakeman
    runs-on: ubuntu-latest
    steps:
      - name: Check out code
        uses: actions/checkout@v1

      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: 2.7.2

      - name: brakeman
        uses: reviewdog/action-brakeman@v2
        with:
          brakeman_version: 4.8.2
          github_token: ${{ secrets.github_token }}
          reporter: github-pr-check
          fail_on_error: true
          brakeman_flags: --skip-files app/jobs/some_file_name.rb

This results in the action getting to the Running brakeman with reviewdog 🐶 ... step and only logging out Error: Process completed with exit code 7. I have not really been able to find anything on what exit code 7 means and there is no indication as to what the issue might be from the error.

Additionally, using the reviewdog/action-brakeman@v1 with all the same configurations results in the reviewdog: failed to run 'git rev-parse --show-prefix': exit status 128 error that has been a problem with many reviewdog repos that started in the last 24 hours or so.

basti commented 2 years ago

Thanks @bogn83 adding --no-exit-on-warn --no-exit-on-error helped. We had the exact same scenario as you did.

bogn83 commented 2 years ago

@Mason-Seeger that's exit on errors found, looked that up here: https://github.com/presidentbeef/brakeman/blob/b9a1ac8ca844cbdb26d949895ccfcaa84efb1d02/lib/brakeman.rb#L21

the brakeman_flags: --no-exit-on-warn --no-exit-on-error should help you with that and it still reports issues the way you'd expect.

carl-printreleaf commented 2 years ago

The latest version fixes this issue, thank you for the quick patch