Skip to content

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

Notifications You must be signed in to change notification settings

py-actions/flake8

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

Repository files navigation

py-actions/flake8 GitHub Action

Version Linux CI macOS CI Windows CI Lint CodeQL

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.

Quick Start

Default

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 custom settings

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.

Inputs

Configure the Action with the following optional settings:

flake8-version

Optional flake8 version for testing. Options: ['latest', 'main', 'master', '[VERSION NUMBER]'].Default = "latest".

path

Optional The path to the Python source file(s) or directory. Default = ".".

args

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.

exclude

Optional Comma-delimited list of ignored file paths. Default = flake8 default.

ignore

Optional Comma-delimited list of ignored flake8 rule codes. Default = flake8 default.

max-line-length

Optional Integer value (as string) representing maximum acceptable line length. Default = flake8 default.

update-pip

Optional Update pip before the flake8 install. Options: ["true", "false"]. Default = "false".

plugins

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.

Outputs

None

License

Apache License, v2.0

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •