Skip to content

Linter

Level: Starter☕

flake8 is used for linting.

Invoke Flake8

https://flake8.pycqa.org/en/latest/user/invocation.html

$ flake8 my_project

a.py:112:14: E225 missing whitespace around operator
b.py:117:24: E128 continuation line under-indented for visual indent
c.py:119:24: E128 continuation line under-indented for visual indent
d.py:120:56: E231 missing whitespace after ','
e.py:62:80: E501 line too long (96 > 79 characters)
How to only discover certain errors?
flake8 --select E123 my_project

Read and Practice

Configuration

https://flake8.pycqa.org/en/latest/user/configuration.html https://flake8.pycqa.org/en/latest/user/options.html#options-list

  • How to configure flake8 to ignore a certain error/violation?
  • How to configure flake8 to ignore a certain file/folder?
  • How to configure flake8 to use a different max line length

Ignore Violations

https://flake8.pycqa.org/en/latest/user/violations.html

  • How to ignore a violation of a line?
  • How to ignore any violation of a file?