Giter Site home page Giter Site logo

py-actions / flake8 Goto Github PK

View Code? Open in Web Editor NEW
63.0 2.0 20.0 1.81 MB

A GitHub Action that installs and executes flake8 Python source linting during continuous integration testing. Supports flake8 configuration and plugin installation in the GitHub Action settings.

License: Apache License 2.0

Makefile 7.52% JavaScript 82.75% Python 9.73%
python python3 flake8 github-actions ci lint linting flake8-plugin actions linter

flake8's People

Contributors

chrissimpkins avatar dependabot-preview[bot] avatar dependabot[bot] avatar roythearsonist 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

flake8's Issues

Add plugins input

Please add an input to specify a list of additional plugins (with versions) to install with pip for Flake8. For example plugins: flake8-bugbear==22.1.11 as input would install the flake8-bugbear PyPI package version 22.1.11.

TypeError: argument of type 'NoneType' is not iterable

I can run linting locally using python -m flake8 --ignore E128,E302,E305,W292,BLK100 --max-line-length 120 --exclude .venv command without showing up any errors, but my linting GitHub Action suddenly started failing with the following error. Everything was working as expected until a few days ago.

/opt/hostedtoolcache/Python/3.12.0/x64/bin/flake8 --ignore E128,E302,E305,W292,BLK100 --max-line-length 120 backend
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
                    ^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/flake8/checker.py", line 83, in _mp_run
    ).run_checks()
      ^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/flake8/checker.py", line 526, in run_checks
    self.run_ast_checks()
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/flake8/checker.py", line 428, in run_ast_checks
    for line_number, offset, text, _ in runner:
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/bugbear.py", line 61, in run
    if self.should_warn(e.message[:4]):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/bugbear.py", line 153, in should_warn
    if code[:i] in self.options.select:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.12.0/x64/bin/flake8", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/flake8/main/cli.py", line 23, in main
    app.run(argv)
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/flake8/main/application.py", line 198, in run
    self._run(argv)
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/flake8/main/application.py", line 187, in _run
    self.run_checks()
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/flake8/main/application.py", line 103, in run_checks
    self.file_checker_manager.run()
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/flake8/checker.py", line 236, in run
    self.run_parallel()
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/flake8/checker.py", line 205, in run_parallel
    self.results = list(pool.imap_unordered(_mp_run, self.filenames))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/multiprocessing/pool.py", line 873, in next
    raise value
TypeError: argument of type 'NoneType' is not iterable
Error: The process '/opt/hostedtoolcache/Python/3.12.0/x64/bin/flake8' failed with exit code 1

Snippet of the workflow file:

- name: Flake8 linting
          uses: py-actions/flake8@v2
          with:
            ignore: "E128,E302,E305,W292,BLK100"
            max-line-length: 120
            path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
            plugins: "flake8-bugbear==22.1.11 flake8-black"

ERROR: Action failed during execution

Hello! So, I'm trying this action with the default settings:

image

Flake8 doesn't have any problems to detect all the errors in the project, but in the end, after printing all the flake8 errors, this error appears:

ERROR: Action failed during execution with error: The process '/opt/hostedtoolcache/Python/3.8.12/x64/bin/flake8' failed with exit code 1

image

I wouldn't have a problem if I only wanted to use that one step. But I wan't to add a few more steps on this action, more flake8 checks on other folders, and since the first one fails, the next one won't start.

Is it normal that the action throws that error? @chrissimpkins

`pyproject.toml` support

Does this actions pick-up pyproject.toml settings?

Something like this,

[tool.isort]
# https://github.com/timothycrosley/isort/
py_version = 37
line_length = 79

known_typing = ["typing", "types", "typing_extensions", "mypy", "mypy_extensions"]
sections = ["FUTURE", "TYPING", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
include_trailing_comma = true
multi_line_output = 3
indent = 4
color_output = true
use_parentheses = true

Action does not work with flake8 plugin 'pyproject-flake8'

I've tried to use this gh action with flake8 plugin 'pyproject-flake8' but it does not seem to work (commented out below). It does not pick up the configuration in pyproject.toml (e.g. max-lines).

It works however with a standard hatch run as exampled below.

      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: 3.9
      - run: pip install hatch pyproject-flake8
      - run: hatch run lint:flake8
      # - uses: py-actions/flake8@v2          
      #   with:
      #     plugins: "pyproject-flake8"

Unrecognized Arguments

I didn't set path like the default configuration but I got this error:

/opt/hostedtoolcache/Python/3.8.11/x64/bin/flake8 --ignore F403,F405, W503, W504 --exclude */migrations/* --max-line-length 120 .
usage: flake8 [options] file file ...
flake8: error: unrecognized arguments: .
Error: ERROR: Action failed during execution with error: The process '/opt/hostedtoolcache/Python/3.8.11/x64/bin/flake8' failed with exit code 2

Here is my yml file:

name: flake8 Lint # https://github.com/marketplace/actions/python-flake8-lint

on: [push, pull_request]

jobs:
  flake8-lint:
    runs-on: ubuntu-latest
    name: Lint
    steps:
      - name: Check out source repository
        uses: actions/checkout@v2
      - name: Set up Python environment
        uses: actions/setup-python@v1
        with:
          python-version: "3.8"
      - name: flake8 Lint
        uses: py-actions/flake8@v1
        with:
          max-line-length: "120"
          exclude: "*/migrations/*"
          ignore: "F403,F405, W503, W504"

Allow Select Parameter

For example:
flake8 --ignore F401,F541,F811,F841,E,W --select E999 --max-line-length 100 .

I want ignore all E rules, except for what is shown in select

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.