This GitHub Action installs the Python flake8 package in an environment with a Python interpreter and executes flake8 stylistic and logical linting of Python source files. flake8 installation and execution defaults, and flake8 plugins can be configured with optional Action settings.
The project is tested against the latest GitHub Actions Linux, macOS, and Windows runner environment cPython versions 3.9.x - 3.12.x interpreters on a nightly basis.
name: flake8 Lint
on: [push, pull_request]
jobs:
flake8-lint:
runs-on: ubuntu-latest
name: Lint
steps:
- name: Check out source repository
uses: actions/checkout@v3
- name: Set up Python environment
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: flake8 Lint
uses: py-actions/flake8@v2
name: flake8 Lint
on: [push, pull_request]
jobs:
flake8-lint:
runs-on: ubuntu-latest
name: Lint
steps:
- name: Check out source repository
uses: actions/checkout@v3
- name: Set up Python environment
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: flake8 Lint
uses: py-actions/flake8@v2
with:
ignore: "F401"
exclude: "src/ignoreme.py"
max-line-length: "100"
path: "src"
plugins: "flake8-bugbear==22.1.11 flake8-black"
See the Inputs section below for details on the defaults and optional configuration settings.
Configure the Action with the following optional settings:
Optional flake8 version for testing. Options: ['latest', 'main', 'master', '[VERSION NUMBER]'].Default = "latest"
.
- 'latest' = current PyPI release version
- 'main' = current GitHub source repository main branch version
- '[VERSION NUMBER]' = the version number of the flake8 PyPI package (e.g.,
"3.7.9"
)
Optional The path to the Python source file(s) or directory. Default = "."
.
Optional Command line arguments to the flake8 executable. Default = None.
Please note that some command line arguments can be defined with other fields in your configuration. You may combine the args
setting with the other settings below, or use args
to configure flake8 without the other Action settings.
See the inputs below for additional details.
Optional Comma-delimited list of ignored file paths. Default = flake8 default.
Optional Comma-delimited list of ignored flake8 rule codes. Default = flake8 default.
Optional Integer value (as string) representing maximum acceptable line length. Default = flake8 default.
Optional Update pip
before the flake8 install. Options: ["true"
, "false"
]. Default = "false"
.
Optional Space delimited list of flake8 plugin packages to install with pip prior to flake8 execution. Default = none.
Use the syntax:
[PACKAGE NAME]
: for current PyPI release version across Action runs[PACKAGE NAME]==[VERSION]
: for a fixed PyPI release version on every Action run
See the "With custom settings" example above.
None