FLAKE8(1)

πŸ’… FLAKE8(1) β€” the general commands manual, but make it fashion

okay bestie, sit down, hydrate, because we're about to talk about flake8 β€” the command in section 1 of the general commands manual β€” and she is that girl. ✨


🌸 NAME 🌸

flake8 β€” a code checker that runs on pycodestyle and pyflakes, and she will absolutely tell you about your line that's 80 characters long. no cap.


πŸŽ€ SYNOPSIS πŸŽ€

flake8 [options] input ...

like. that's it. that's the whole summoning ritual. πŸ’«


πŸ¦‹ DESCRIPTION πŸ¦‹

so flake8 is a command-line utility for enforcing style consistency across Python projects, and honestly? she's the friend who tells you your outfit is cute but also that your tag is sticking out. πŸ’–

by default she includes:

  • lint checks from the PyFlakes project πŸ”
  • PEP-0008-inspired style checks from the PyCodeStyle project πŸŽ€
  • McCabe complexity checking from the McCabe project 🧠

and if third-party extensions are found and installed, she'll run those too. she's inclusive like that. periodt. πŸ‘‘


✨ OPTIONS ✨

so many options. it's giving menu at a boba shop. let's go one by one, we're not skipping a single one because we don't do that here. πŸ§‹

  • --version β€” shows the program's version number and then dips. exit stage left. πŸ’¨
  • -h, --help β€” shows this help message and exits. the "what do i do" button. iconic. 🫢
  • -v, --verbose β€” prints more information about what's happening inside flake8. and bestie, this one is repeatable β€” every time you repeat it, the verbosity goes up another notch. stack 'em like bracelets. πŸ“Ώ
  • -q, --quiet β€” reports only file names, or nothing at all. also repeatable. the "i don't want the details, just tell me if it's bad" energy. 🀫
  • --count β€” prints the total number of errors and warnings to standard error, and sets the exit code to 1 if that total isn't empty. receipts. 🧾
  • --diff β€” reports changes only within line number ranges in the unified diff that the user provides on standard in. so you pipe her a diff and she only yells about the lines in it. πŸ’…
  • --exclude=patterns β€” a comma-separated list of files or directories to exclude. (Default: .svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg) β€” yes she's excluding all the version control noise, she said not today. πŸ™ˆ
  • --filename=patterns β€” only checks filenames that match the patterns in this comma-separated list. (Default: *.py) 🐍
  • --stdin-display-name=STDIN_DISPLAY_NAME β€” the name used when reporting errors from code passed via stdin. super useful for editors that pipe file contents into flake8. (Default: stdin) 🎬
  • --format=format β€” formats errors according to the chosen formatter. glow-up for your error messages. ✨
  • --hang-closing β€” hangs the closing bracket instead of matching the indentation of the opening bracket's line. let her dangle. 🎐
  • --ignore=errors β€” a comma-separated list of errors and warnings to ignore (or skip). for example, --ignore=E4,E51,W234. (Default: E121,E123,E126,E226,E24,E704,W503,W504) β€” the block list. 🚫
  • --max-line-length=n β€” the maximum allowed line length for the entirety of this run. (Default: 79) β€” yes, 79. the classic. πŸ“
  • --select=errors β€” a comma-separated list of errors and warnings to enable. for example, --select=E4,E51,W234. (Default: E,F,W,C90) β€” the allow list. the VIP section. 🎟️
  • --disable-noqa β€” disables the effect of "# noqa". this means errors will be reported on lines that have "# noqa" at the end. no hiding. she sees you. πŸ‘€
  • --show-source β€” shows the source that generated each error or warning. context, bestie. we love context. πŸ“–
  • --statistics β€” counts errors and warnings. numbers go brrr. πŸ“Š
  • --enable-extensions=ENABLE_EXTENSIONS β€” enables plugins and extensions that are otherwise disabled by default. waking the sleepers. πŸŒ™
  • --exit-zero β€” exits with status code "0" even if there are errors. she's being nice about it. 😌
  • --install-hook=INSTALL_HOOK β€” installs a hook that runs prior to a commit, for the supported version control system. pre-commit gatekeeping, but make it helpful. πŸͺ
  • -j JOBS, --jobs=JOBS β€” the number of subprocesses to use to run checks in parallel. this is ignored on Windows. the default, "auto", auto-detects the number of processors available to use. (Default: auto) β€” parallel girlies rise. ⚑
  • --output-file=OUTPUT_FILE β€” redirects the report to a file. πŸ—‚οΈ
  • --tee β€” writes to stdout and output-file. both. why not both. 🍡
  • --append-config=APPEND_CONFIG β€” provides extra config files to parse in addition to the files Flake8 finds by default. these files are the last ones read, so they take the highest precedence when multiple files provide the same option. last word wins, periodt. πŸ†
  • --config=CONFIG β€” the path to the config file that will be the authoritative config source. this will cause Flake8 to ignore all other configuration files. one true config. πŸ‘‘
  • --isolated β€” ignores all found configuration files. no influence. clean slate. 🧼
  • --benchmark β€” prints benchmark information about this run of Flake8. how fast was she? very. ⏱️
  • --max-complexity=MAX_COMPLEXITY β€” the McCabe complexity threshold. 🧠
  • --bug-report β€” prints the information necessary when preparing a bug report. for when you gotta snitch on her (lovingly). πŸ›
  • --builtins=BUILTINS β€” defines more built-ins, comma separated. πŸ”§
  • --doctests β€” checks the syntax of the doctests. πŸ“
  • --include-in-doctest=INCLUDE_IN_DOCTEST β€” runs doctests only on these files. 🎯
  • --exclude-from-doctest=EXCLUDE_FROM_DOCTEST β€” skips these files when running doctests. πŸšͺ

🧚 CONFIGURATION 🧚

okay so the project options get read from the [flake8] section of the tox.ini file, or the setup.cfg file, located in any parent folder of the path(s) being processed. she's checking upstairs, she's checking the whole building. 🏒

the allowed options are:

  • exclude
  • filename
  • select
  • ignore
  • max-line-length
  • hang-closing
  • count
  • format
  • quiet
  • showpep8
  • show-source
  • statistics
  • verbose
  • max-complexity
  • builtins

πŸ’€ lowkey reminder: options are options, they're not suggestions you can vibe your way out of. if you --disable-noqa, she's reporting everything and you asked for it. πŸ™ˆ

and that's the whole page, bestie. this one's from November 2016, and it lives under the FLAKE8(1) name in the general commands manual. slay, stay linted, and may your lines always be ≀ 79. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«ΆπŸ‘‘πŸŒˆβ­πŸ“πŸ§šπŸ’œ

πŸ“¦ where this page comes from