Flake8¶
This guide explains how to run Flake8 with CloudAEye.
Overview¶
Flake8 is a popular and extensible Python linting tool that combines style checks, logical error detection, and plugin-based validation into a single framework. It builds on PyFlakes for bug detection, integrates pycodestyle for style checking, and supports a wide variety of plugins for additional linting capabilities.
Highly configurable, Flake8 lets you customize rules, ignore specific paths or errors, and adjust the behavior using configuration files (.flake8, setup.cfg, or tox.ini).
Flake8 helps maintain clean, readable, and error-free Python code.
Prerequisites¶
Step 1: Register¶
Sign up with CloudAEye SaaS.
Step 2: Install GitHub App¶
Integrate with GitHub by installing the GitHub app.
Step 3: Connect Github Repositorie¶
Connect the repositories where you would like to use CloudAEye Code Review features.
Step 4: Configure the Linter¶
Configure the desired linter.
Configuration¶
If your repository already has Flake8 configured, CloudAEye will automatically use that setup. You may also enter your desired configuration.
Use repo config¶
CloudAEye automatically reads your repository’s existing Flake8 configuration and uses it as is. No additional setup is needed.
Common Flake8 Configuration File Locations & Formats¶
You can define Flake8 settings in any of these files:
setup.cfg– A common location for Python project settings, including Flake8.tox.ini– Often used in projects that rely on tox, but also supports Flake8 configuration..flake8– A dedicated configuration file specifically for Flake8.pyproject.toml– Supported in newer versions; allows centralizing tool config in one file.
Flake8 will automatically pick up configuration from whichever of these files is present, with precedence rules defined in its documentation.
Manual¶
You may enter the Flake8 configuration you would like to use.
Example Configuration¶
[flake8]
# Set a sane line length (Black uses 88; 100–120 is also common)
max-line-length = 100
# Ignore rules that conflict with auto-formatters like Black
extend-ignore =
E203 # Whitespace before ':'
W503 # Line break before binary operator
# Exclude common directories
exclude =
.git,
__pycache__,
.venv,
venv,
build,
dist,
migrations
# Set complexity threshold (optional)
max-complexity = 10
# Show source code for each violation
show-source = true
# Enable useful built-in plugins if available
select = C,E,F,W,B,B950
Keeps Flake8 compatible with Black¶
Black formats code in ways that conflict with some Flake8 rules (e.g., E203 and W503), so these are commonly ignored.
Supports maintainable code¶
max-line-length = 100is readable but not restrictive.max-complexity = 10helps prevent overly complex methods.
Avoids noise¶
Excluding virtual environments, caches, and build directories avoids unnecessary linting.
Improved diagnostics¶
show-source = true makes issues easier to understand.
Better rule coverage¶
select = C,E,F,W,B,B950 includes:
- PyFlakes (
F) - Pycodestyle (
E,W) - McCabe complexity checks (
C) - Bugbear rules (
B, if installed)
File Extensions¶
Flake8 will run on files that use any of the following extensions:
.py
References¶
- Flake8 project
- Flake8 configuration
- Flake8 documentation