A flake8 formatter that turns output into Github Annotations
Project description
flake8-github-annotations
A formatter plugin for flake8 that turns flake8 errors into Github Anotations.
Table of Contents
Installation
pip install flake8-github-annotations
Usage
To enable the formatter,
and turn flake8 output into Github Annotations,
provide the --format
argument when invoking flake8
.
flake8 --format github
This turns flake8 output into lines like this:
::error file=./src/flake8_github_annotations/file_with_error.py,line=1,col=1,title=F401::'collections' imported but unused
This is not useful when running flake8 locally, but will be turned into Github Annotations if ran in a GitHub Action.
You could add a Github Action like this .github/workflows/ci.yml
:
name: Lint
on: [push]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: pip install flake8 flake8-github-annotations
- name: Lint with flake8
run: flake8 --format github
Alternative project
Using this project to format flake8 output makes the output hard to read for a human,
and you will probably need to call flake8 without the --format
argument when linting
locally.
If you don't wish to add an extra argument to flake8 when running in CI, you can use the GithubAction rbialon/flake8-annotations, which uses regex to detect flake8 output. A drawback of this apporach is that the project currently (2023-03-29), only supports a predefined set of error code prefixes, and might not detect errors from your favourite flake8 plugin.
License
flake8-github-annotations
is distributed under the terms of the MIT license.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file flake8_github_annotations-0.1.0.tar.gz
.
File metadata
- Download URL: flake8_github_annotations-0.1.0.tar.gz
- Upload date:
- Size: 23.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.23.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b78b8e25c09a6a8cb1d140be46666a3f6dbcd32159933aa96e9af1fbde652e7d |
|
MD5 | 23cd1b980b504cb305e1b4eedd971a2e |
|
BLAKE2b-256 | 2f8af303c076e9bffd4ec8794ca5376cfc82d713712cf0406af6b73dea8d9c50 |
File details
Details for the file flake8_github_annotations-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: flake8_github_annotations-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.23.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05bea6f01027cae1fad2e88314d69dfe1bf4581f2969c74a477fb8acc087f5ab |
|
MD5 | 2aff58dc6c354a3a203596570db95878 |
|
BLAKE2b-256 | b3cb917a2ad35f5162102542990a66d1b2f0e1ce85a1a638018b9b64f64ac52e |