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
- Web UI
.coderabbit.yaml
.flake8
.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
.flake8configuration contains a[flake8:local-plugins]section. - The discovered
.flake8file 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 longE302,E303,E305- blank line issuesW291,W292,W293,W391- whitespace issuesE201,E202,E203,E211- whitespace around bracketsE221,E222,E225,E226,E227,E228- whitespace around operatorsE231,E241,E242,E251- whitespace around commasE261,E262- inline comment spacingE271,E272,E273,E274,E275- whitespace around keywordsE301,E304,E306- blank line issuesE401,E402,E411- import grouping issuesE502- redundant backslashW191- indentation contains tabsE266- 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