Coder Social home page Coder Social logo

truebrain / actions-flake8 Goto Github PK

View Code? Open in Web Editor NEW
25.0 25.0 9.0 36 KB

Flake8 with GitHub Actions -- including annotations for Pull Requests

License: MIT License

Shell 76.30% Python 23.70%
actions annotations flake8 github-actions linter python

actions-flake8's People

Contributors

adriandsg avatar dependabot[bot] avatar lt-mayonesa avatar peternewman avatar pyup-bot avatar truebrain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

actions-flake8's Issues

feature request: annotate warnings diff only

It is possible to run the action on only those files that have changes in the PR via:

- uses: actions/checkout@v2
  with:
    fetch-depth: -1
- name: Setup Python
  uses: actions/setup-python@v2
  with:
    python-version: 3.9
- id: find_changed_files
  run: echo ::set-output name=changed_files::$(git diff --name-only ${{github.sha}} ${{github.event.pull_request.base.sha}} | tr ' ' '\n' | grep .py | tr '\n' ' ')
- uses: TrueBrain/actions-flake8@v2
  with:
    plugins: flake8-docstrings dlint flake8-bugbear flake8-simplify flake8-debugger flake8-print flake8-pep3101
    only_warn: 1
    extra_arguments: "${{steps.find_changed_files.outputs.changed_files}}"

It would be nice if this was supported directly (although, just documenting would be good also). Also it would be nice if warnings could be shown only for changed files while errors are shown for all files. One simple way of doing so is to run flake8 twice, a much more difficult way of getting this done is to skip the changed files in the regex.

support of pyproject.toml?

If I provide a pyproject.toml file where I store the configuration parameter for flake8, like max-line-length, will the action use these?
EDIT: also, is it possible to use both, pyproject.toml and action parameter?

Seems to not filter on flake8-simplify class errors

When using

      - name: flake8 Lint
        uses: TrueBrain/actions-flake8@v2
        with:
          plugins: flake8-simplify
          error_classes: 'E,F'
          warning_classes:'SIM'

I would expect SIM errors to become a warning, but it becomes a failing error

cannot add multiple per-file-ignores to extra arguments

Hello! Thanks for the great action.

I'm trying to add a list of items to the flake8 --per-file-ignores argument. I've tried just about everything I can think of to supply it via the extra arguments line. The relevant part of my .yml:

- name: Annotate PR after running flake8
   uses: TrueBrain/actions-flake8@v2
   with:
     max_line_length: 88
     extra_arguments:
       --per-file-ignores=__init__.py:F401 test_granules.py:E501

results in a file-not-found error for test_granules.py. I've tried every combination of spaces, newlines, quotes, etc. I can think of and cannot figure out how to properly pass multiple --per-file-ignores to flake8 via this action. For reference, passing --per-file-ignores='__init__.py:F401 test_granules.py:E501' to flake8 locally has the expected/desired behavior.

Any suggestions for how to make this work? Thanks!

Initial Update

The bot created this issue to inform you that pyup.io has been set up on this repo.
Once you have closed it, the bot will open pull requests for updates as soon as they are available.

Allow to specify a working directory

flake8 automatically reads configuration from files like setup.cfg โ€“ however, my setup.cfg is placed in my src directory. With this (very cool, btw) action, my settings file would never get parsed, because it will invoke flake8 src.

I'd like to suggest a new option, "working-directory", to allow for this kind of scenario.

Tasks using v1.3 fail when there are no linting errors

I tested the same source code with v1.2 and v1.3, and when using v1.3, my workflow fails even though there aren't any linting errors. I'm seeing output in the logs of Flake8 found no problems.

It appears that the issue is within the final lines of entrypoint.sh as you're using $res for the exit code, but that variable is no longer being set in the new version.

# If we are in warn-only mode, return always as if we pass
if [ -n "${INPUT_ONLY_WARN}" ]; then
    exit 0
else
    exit $res
fi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.