flake8
Python code linter and style checker
TLDR
Check Python file
SYNOPSIS
flake8 [options] [files...]
DESCRIPTION
flake8 is a Python linting tool combining PyFlakes, pycodestyle, and McCabe complexity checker. It finds programming errors, style issues, and overly complex code.
The tool enforces PEP 8 style guidelines and catches common errors like undefined variables, unused imports, and syntax problems. Plugins extend checking for additional frameworks and patterns.
flake8 integrates with editors, CI pipelines, and pre-commit hooks for automated code quality enforcement.
PARAMETERS
FILES
Python files or directories to check.--select ERRORS
Check only specific error codes.--ignore ERRORS
Ignore specific error codes.--max-line-length N
Maximum line length (default 79).--exclude PATTERNS
Exclude matching files/directories.--config FILE
Configuration file.--format FORMAT
Output format.--help
Display help information.
CONFIGURATION
setup.cfg
Project-level flake8 configuration in the [flake8] section..flake8
Dedicated flake8 configuration file for project settings.~/.config/flake8
User-level global configuration file.
CAVEATS
Strict defaults may require customization. Some checks overlap with other tools. Plugin ecosystem varies in quality.
HISTORY
flake8 was created by Tarek Ziadé to unify Python linting tools. It wraps multiple checkers under a single interface with consistent configuration and output.
