LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

flake8

Python code linter and style checker

TLDR

Check Python file
$ flake8 [file.py]
copy
Check directory
$ flake8 [src/]
copy
Show specific errors
$ flake8 --select=[E,W] [file.py]
copy
Ignore specific errors
$ flake8 --ignore=[E501] [file.py]
copy
Set max line length
$ flake8 --max-line-length=[120] [file.py]
copy

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.

INSTALL

sudo apk add py3-flake8
copy
brew install flake8
copy

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.

SEE ALSO

pylint(1), black(1), ruff(1)

RESOURCES

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid