Code linters

Лев Коваленко — Senior DS Engineer

Linters

Flake8 plugins

Flake8 settings

[tool.flake8]
ignore = "E203,E266,H106,H904"
max-line-length = 88
max-complexity = 25

Ruff

0s20s40s60sRuffAutoflakeFlake8PyflakesPycodestylePylint0.29s6.18s12.26s15.79s46.92s> 60s
  • И линтер и форматер в одном лице
  • Быстрее чем Flake8 и Black
  • Сопоставим с Flake8, isort, and Black
  • Интегрируем в VSCode

Mypy проверка типов

From Python…

def fib(n):
    a, b = 0, 1
    while a < n:
        yield a
        a, b = b, a+b

…to statically typed Python

def fib(n: int) -> Iterator[int]:
    a, b = 0, 1
    while a < n:
        yield a
        a, b = b, a+b