julianwachholz / flake8-action

Run flake8 linter in your Python project.
https://github.com/marketplace/actions/python-flake8
MIT License
29 stars 9 forks source link

how to add flake8 plugins #22

Open elisim opened 2 years ago

elisim commented 2 years ago

Hi,

Thank you for the great action! I would like to use flake8 additional plugins (e.g. pep8-naming).

How should I do it using the action?

I saw this line in the source code https://github.com/julianwachholz/flake8-action/blob/a61bd56b820b13d9aba277ae84ebbbebccd4a092/dist/index.js#L17

It seems to me that it could be inserted there, but I'm not sure.

Thank you, Eli

julianwachholz commented 2 years ago

Thanks for the suggestion! The plugins can now be specified.

elisim commented 2 years ago

Thank you!

Strangely, now when running the action on pull_request, the build is passing even if the linting failed. Log:

image

My .yaml file:

# Based on https://github.com/julianwachholz/flake8-action

name: Code Quality

on:
  pull_request:
#    paths:
#      - '*.py'
    branches:
      - main
      - develop

jobs:
  lint:
    name: Python Lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
        with:
          python-version: "3.8"
      - name: Run flake8
        uses: julianwachholz/flake8-action@v2
        with:
          checkName: "Python Lint"
          path: .
          plugins: "pep8-naming==0.12.1 flake8-comprehensions==3.6.1"
          config: .flake8
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

I took insipration from your yaml file here, and the only difference that I spot was on push (your code) whereas in mine is on pull_request.

What do you think?

BTW: consider adding in the README.md how to add multiple plugins: plugins: "pep8-naming==0.12.1 flake8-comprehensions==3.6.1"

julianwachholz commented 2 years ago

I will investigate! Thank you for reporting this. Maybe there are still some issues with the token somewhere?

elisim commented 2 years ago

Will check with my organization too, thanks

Edit: It seems that the token is valid, I double cheeked that. I tried to change the trigger to push and it still not falling when flake8 outputs an error.

Did you try to run the action in a private repository? I think it might be related. It can be done by just changing flake8-action-test repo to private to test that.

Edit2: I saw your index.js, it seems that core.setFailed(error.message); is not working for me. I'm running on private repo. I didn't create any new secret, maybe it is the problem?

Thank you again, Eli