GitHub Action
Flake8 with annotations
This GitHub Actions runs flake8 over your code. Any warnings or errors will be annotated in the Pull Request.
steps:
- uses: actions/checkout@v4
- uses: TrueBrain/actions-flake8@v2
By default, it uses the default Python version as installed on the GitHub Runner.
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.9
- uses: TrueBrain/actions-flake8@v2
with:
path: src
In some cases you might want to pin a certain flake8 version.
This parameter is optional; by default the latest flake8 will be installed (if no flake8 is installed yet).
steps:
- uses: actions/checkout@v4
- uses: TrueBrain/actions-flake8@v2
with:
flake8_version: 6.1.0
Alternatively, you can pre-install flake8 before executing this action:
steps:
- uses: actions/checkout@v4
- run: pip install flake8==3.8.0
- uses: TrueBrain/actions-flake8@v2
If needed, this also allows you to install other flake8-plugins.
Indicates the path to run flake8
in.
This can be useful if your project is more than Python code.
This parameter is optional; by default flake8
will run on your whole repository.
steps:
- uses: actions/checkout@v4
- uses: TrueBrain/actions-flake8@v2
with:
path: src
Indicates errors and warnings to skip.
This parameter is optional; by default no alerts will be ignored
steps:
- uses: actions/checkout@v4
- uses: TrueBrain/actions-flake8@v2
with:
ignore: E4,W
Indicates the maximum allowed line length.
This parameter is optional; by default flake8's default line length will be used.
steps:
- uses: actions/checkout@v4
- uses: TrueBrain/actions-flake8@v2
with:
max_line_length: 90
Only warn about problems. All errors and warnings are annotated in Pull Requests, but it will act like everything was fine anyway. (In other words, the exit code is always 0.)
This parameter is optional; setting this to any value will enable it.
steps:
- uses: actions/checkout@v4
- uses: TrueBrain/actions-flake8@v2
with:
only_warn: 1
List of plugins to install before running, This is passed directly to pip install
.
This parameter is optional; setting this to any value will enable it.
steps:
- uses: actions/checkout@v4
- uses: TrueBrain/actions-flake8@v2
with:
plugins: flake8-bugbear cohesion==0.9.1
List of flake8 error classes to classify as Error.
This parameter is optional; by default E
and F
classes will be considered errors.
steps:
- uses: actions/checkout@v4
- uses: TrueBrain/actions-flake8@v2
with:
error_classes: E,H
List of flake8 error classes to classify as Warning.
This parameter is optional; by default all classes not contained in error_classes
will be considered a warning.
steps:
- uses: actions/checkout@v4
- uses: TrueBrain/actions-flake8@v2
with:
warning_classes: W,B,D
Extra arguments to give to flake8.
Useful when you need to give an argument this action otherwise doesn't supply (like --max-complexity
, --hang-closing
, ...).
This parameter is optional; by default it is empty.
steps:
- uses: actions/checkout@v4
- uses: TrueBrain/actions-flake8@v2
with:
extra_arguments: "--hang-closing"
Change the current working-directory to execute flake8 in.
This parameter is optional; by default it is set to ".".
steps:
- uses: actions/checkout@v4
- uses: TrueBrain/actions-flake8@v2
with:
working_directory: "src"