Skip to content

reviewdog/action-flake8

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reviewdog/action-flake8 composite GitHub Action

Test reviewdog depup release GitHub release (latest SemVer) action-bumpr supported

github-pr-review example picture github-check example picture

This composite action runs flake8 with reviewdog on pull requests to lint to lint python source files while creating annotations. It does this by installing the Python flake8 package in an environment with a Python interpreter and executes flake8 stylistic and logical linting of Python source files. Following reviewdog is used to parse the bash output into GitHub annotations. This (composite) action is meant to be run inside an existing workflow and therefore, does not install python or set up a python environment.

Quick Start

In it's simplest form this action can be used to annotate the changes that are suggested by the flake8 linter.

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@v4
      - name: Set up Python environment
        uses: actions/setup-python@v5
        with:
          python-version: "3.8"
      # Install specific flake8 version (this step is not required. Default is "latest").
      - run: pip install flake8==6.0.0
      # Install flake8 extensions (this step is not required. Default is "None").
      - run: pip install flake8-docstrings flake8-simplify flake8-unused-arguments flake8-quotes
      - name: flake8 Lint
        uses: reviewdog/action-flake8@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}

See the Inputs section below for details on the defaults and optional configuration settings.

Inputs

github_token

Required. The GITHUB_TOKEN. Must be in form of github_token: ${{ secrets.github_token }}. Defaults to ${{ github.token }}.

workdir

Optional. The directory to run flake8 in. Defaults to ..

flake8_args

Optional. Command-line arguments to the flake8 executable. Defaults to "".

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.

level

Optional. The log level of the reviewdog reporter. Options: [info, warning, error]. Defaults to error.

reporter

Optional. Reporter of reviewdog command [github-pr-check, github-pr-review, github-check]. Defaults to github-pr-check.

filter_mode

Optional. Filtering mode for the reviewdog command [added, diff_context, file, nofilter]. Defaults to added.

fail_on_error

Optional. Exit code for reviewdog when errors are found [true, false]. Defaults to false.

reviewdog_flags

Optional. Additional reviewdog flags. Defaults to "".

tool_name

Optional. Tool name to use for reviewdog reporter. Defaults to flake8..

error_format

Optional. Pre-defined error format [flake8, pep8]. Defaults to flake8.