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

Reviewdog does not seem to report errors from flake8-docstring-checker #52

Open
sstendahl opened this issue Sep 7, 2023 · 1 comment

Comments

@sstendahl
Copy link

Hey,

It seems like reviewdog does not report errors from flake8-docstring-checker. The plug in installs correctly, and is reported in the output:

Run reviewdog/action-flake8@v3
Run $GITHUB_ACTION_PATH/entrypoint.sh
[action-flake8] Installing reviewdog...
reviewdog/reviewdog info checking GitHub for tag 'v0.15.0'
reviewdog/reviewdog info found version: 0.15.0 for v0.15.0/Linux/x86_64
reviewdog/reviewdog info installed /tmp/reviewdog
[action-flake8] Flake8 version:
6.1.0 (flake8-docstring-checker: 1.2, flake8-quotes: 3.3.2, mccabe: 0.7.0,
pycodestyle: 2.11.0, pyflakes: 3.1.0) CPython 3.10.13 on Linux
[action-flake8] Checking python code with the flake8 linter and reviewdog...
2023/09/07 12:39:54 [flake8] reported: https://github.com/jfkcooper/HOGBEN/runs/16581598432 (conclusion=success)
[action-flake8] Clean up reviewdog...

But the actual errors (missing docstrings) are ignored. Locally (just running Flake8 myself), this works fine and I get the following error:

./tests/test_optimise.py:24:1: DC102 Missing docstring in public function test_optimise_angle_times_length
./tests/test_optimise.py:37:1: DC102 Missing docstring in public function test_optimise_optimise_contrasts
./tests/test_optimise.py:54:1: DC102 Missing docstring in public function test_angle_times_func_result

Maybe it has something to do with the error format not being recognized? Not completely sure how to solve this here. For completeness sake, this is how I've got the linter set up right now:

  flake8-lint:
    name: flake8
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Set up Python environment
        uses: actions/setup-python@v4
        with:
          python-version: "3.10"
      # Install flake8 extensions (this step is not required. Default is "None").
      - name: Set up flake8
        run: pip install flake8-quotes flake8-docstring-checker
      - name: flake8 Lint
        uses: reviewdog/action-flake8@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          fail_on_error: true

@rickstaa
Copy link
Member

rickstaa commented Oct 15, 2023

Hey @Sjoerd1993, big thanks for reporting that bug! The error format in our action is defined in the reviewdog/errorformat repository, specifically at this location. It looks something like this:

%f:%l:%c: %t%n %m

For more details, you can check out the errorformat README, which explains that reviewdog uses Vim's quick-fix errorformat.

I haven't had the chance to dive into the issue yet, but my hunch is that because flake8-docstring-checker uses the DC docstring, the error type might not be picked up correctly. You can experiment with the errorformat playground to figure out the syntax needed to make reviewdog catch the errors from flake8-docstring-checker. Once you've got it right, you can open a pull request here to update the flake8 error format. Given that not everyone is using the flake8-docstring-checker plugin, it might be better to use the reviewdog_flags input argument to tweak the error format syntax. Feel free to let me know if you need any help 😃.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants