Skip to main content
Flake8 is a Python linting utility that wraps PyFlakes, pycodestyle, and McCabe to check your Python or Jupyter Notebook code for style and logical errors. CodeRabbit runs Flake8 v7.4.1.

Supported Files

Flake8 will run on files with the following extensions:
  • *.py
  • *.ipynb (using nbQA)

Configuration

boolean
default:true
Enable Flake8
.coderabbit.yaml
Flake8 supports the following config files:
  • .flake8
CodeRabbit searches the repository recursively for the first .flake8 file outside common generated and dependency directories and GitHub Actions or CircleCI pipeline paths. It uses that configuration for all reviewed Python and notebook files. setup.cfg and tox.ini do not enable Flake8 in CodeRabbit. CodeRabbit will not run Flake8 if no .flake8 file is found. CodeRabbit runs Flake8 in a sandbox and skips configurations containing a [flake8:local-plugins] section, because local plugins can import and execute repository-controlled code. Project plugins are not installed during the review.

When we skip Flake8

CodeRabbit will skip running Flake8 when:
  • No config file is found (.flake8).
  • Flake8 is already running in GitHub Actions, GitLab CI, CircleCI, or Azure Pipelines.
  • The .flake8 configuration contains a [flake8:local-plugins] section.
  • The discovered .flake8 file disappears before CodeRabbit can inspect it.

Excluded codes

The following Flake8 codes are automatically excluded (style and whitespace issues that won’t cause runtime errors):
  • E501 - line too long
  • E302, E303, E305 - blank line issues
  • W291, W292, W293, W391 - whitespace issues
  • E201, E202, E203, E211 - whitespace around brackets
  • E221, E222, E225, E226, E227, E228 - whitespace around operators
  • E231, E241, E242, E251 - whitespace around commas
  • E261, E262 - inline comment spacing
  • E271, E272, E273, E274, E275 - whitespace around keywords
  • E301, E304, E306 - blank line issues
  • E401, E402, E411 - import grouping issues
  • E502 - redundant backslash
  • W191 - indentation contains tabs
  • E266 - too many leading ’#’ for block comment

Profile behavior

In Chill mode, Flake8 reports error and info findings and filters out warnings and conventions. In Assertive mode, Flake8 reports findings of all severities. The excluded codes listed above apply in both profiles.

Features

Flake8 can detect many issues such as:
  • Style violations (PEP 8)
  • Logical errors and unused imports
  • Code complexity issues
  • Syntax errors
  • And many more