Add a config for flake8 (#654)

Co-authored-by: Abhinav Singh <mailsforabhinav@gmail.com>
This commit is contained in:
Sviatoslav Sydorenko 2021-11-03 13:01:59 +01:00 committed by GitHub
parent 6aa53e2440
commit 0e5ecec057
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 236 additions and 0 deletions

236
.flake8 Normal file
View File

@ -0,0 +1,236 @@
[flake8]
# Don't even try to analyze these:
extend-exclude =
# No need to traverse egg info dir
*.egg-info,
# GitHub configs
.github,
# Cache files of MyPy
.mypy_cache,
# Cache files of pytest
.pytest_cache,
# Temp dir of pytest-testmon
.tmontmp,
# Occasional virtualenv dir
.venv,
# VS Code
.vscode,
# Temporary build dir
build,
# This contains sdists and wheels of proxy.py that we don't want to check
dist,
# Occasional virtualenv dir
env,
# Metadata of `pip wheel` cmd is autogenerated
pip-wheel-metadata,
# IMPORTANT: avoid using ignore option, always use extend-ignore instead
# Completely and unconditionally ignore the following errors:
extend-ignore =
I # flake8-isort is drunk + we have isort integrated into pre-commit
B009 # FIXME: `getattr()` called with a constant arg
C812 # FIXME: missing trailing comma
C819 # FIXME: inline trailing comma
D101
D102
D103
D105
D106
D107
D203
D205
D208
D209
D212
D213
D300
D400
D401
D402
D403
D404
D405
D407
D412
D413
D415
DAR101 # FIXME: undocumented docstring param
DAR201 # FIXME: no "returns" in docstring
DAR301 # FIXME: no "yields" in docstring
DAR401 # FIXME: no "raises" in docstring
E800 # FIXME: commented out code
N400 # FIXME: escaping with backslash at EOL
N801 # FIXME: class name should use ProudCamelCase
N802 # FIXME: func name should be lowercase
N816 # FIXME: mixed case var name
P101 # FIXME: format string with unindexed params
PT009 # FIXME: pytest encourages use of `assert`
PT018 # FIXME: use multiple `assert`s instead of one complex
Q000 # FIXME: inconsistent double quotes use when single ones are needed
Q001 # FIXME: use double quotes in multiline strings
Q002 # FIXME: use double quote docstrings
Q003 # FIXME: avoid escaping in-string quotes
RST201 # FIXME: missing trailing blank line in docstring
RST203 # FIXME: no trailing blank line in docstring
RST301 # FIXME: unexpected indent in docstring
S101 # FIXME: assertions are thrown away in optimized mode, needs audit
S104 # FIXME: bind-all interface listen
S105 # FIXME: hardcoded password?
S303 # FIXME: insecure hash func
S311 # FIXME: `random` needs auditing
S404 # FIXME: `subprocess` use needs auditing
S603 # FIXME: audit untrusted `subprocess.Popen` input
S607 # FIXME: running subprocess with a non-absolute executable path
WPS100 # FIXME: unhelpful module name
WPS102 # FIXME: incorrect module name pattern
WPS110 # FIXME: unhelpful var name
WPS111 # FIXME: too short var name
WPS114 # FIXME: underscored numbers in var name
WPS115 # FIXME: uppercase class attr
WPS118 # FIXME: long func name
WPS120 # FIXME: regular name w/ trailing underscore
WPS121 # FIXME: unused var used 0_O
WPS122 # FIXME: unused var definition 0_O
WPS201 # FIXME: too many imports
WPS202 # FIXME: too many mod members
WPS203 # FIXME: too many mod imported names
WPS204 # FIXME: too much copy-paste
WPS210 # FIXME: too many local vars
WPS211 # FIXME: too many "__init__()" args
WPS212 # FIXME: too many "return"s
WPS213 # FIXME: too many expressions
WPS214 # FIXME: too many methods
WPS216 # FIXME: too many decorators
WPS219 # FIXME: deep object access is unreadable
WPS220 # FIXME: deep code nesting
WPS221 # FIXME: too big inline complexity / tested instructions
WPS222 # FIXME: too much logic in condition
WPS223 # FIXME: the code is too branchy
WPS225 # FIXME: too many "except"s
WPS226 # FIXME: magic string constant used too much, put it in a var
WPS229 # FIXME: try/except should wrap exactly one instruction
WPS230 # FIXME: too many public instance attrs
WPS231 # FIXME: insane complexity/code nesting in a function
WPS232 # FIXME: module is too complex
WPS234 # FIXME: annotation is too complex
WPS235 # FIXME: too many imported names from a single module
WPS237 # FIXME: too complex f-string
WPS300 # local folder imports are needed
WPS301 # FIXME: dotted import
WPS305 # this project is Python 3 only and so f-strings are allowed
WPS306 # this project is Python 3 so it doesn't need an explicit class base
WPS313 # FIXME: parens after keyword
WPS317 # enforces weird indents
WPS318 # enforces weird indents
WPS319 # FIXME: asymmetric closing bracket
WPS320 # FIXME: multiline func type annotation
WPS322 # FIXME: inline multiline str
WPS323 # false-positive: %-formatting in logging
WPS324 # FIXME: inconsistent "return" in func
WPS326 # doesn't allow implicit string concat
WPS328 # FIXME: useless `while` node
WPS336 # FIXME: explicit string concat
WPS337 # FIXME: multiline conditions
WPS338 # FIXME: unordered class methods
WPS339 # FIXME: meaningless leading zeros in number
WPS349 # FIXME: redundant slice
WPS360 # FIXME: unnecessary r-string
WPS361 # FIXME: inconsistent comprehension structure
WPS403 # FIXME: `# noqa` overuse
WPS407 # FIXME: mutable mod const
WPS408 # FIXME: duplicate logical condition
WPS410 # allow `__all__`
WPS412 # FIXME: logic in `__init__`
WPS414 # FIXME: consusing unpacking target
WPS420 # FIXME: pointless keyword like `pass`
WPS421 # FIXME: call to `print()`
WPS425 # FIXME: bool non-keyword arg
WPS427 # FIXME: unreachable code
WPS428 # FIXME: pointless statement
WPS430 # FIXME: nested func
WPS431 # FIXME: nested class
WPS432 # FIXME: magic number w/o assigned context/name
WPS433 # FIXME: nested import
WPS437 # FIXME: protected attr access
WPS440 # FIXME: block vars overlap
WPS441 # FIXME: control var use after block
WPS442 # FIXME: outer scope var shadowing
WPS453 # FIXME: executable file w/o shebang
WPS454 # FIXME: don't raise a broad exception, use a specific one
WPS457 # FIXME: infinite `while`
WPS458 # FIXME: import collision
WPS460 # FIXME: single element unpacking
WPS464 # FIXME: empty comment
WPS501 # FIXME: "finally" in "try" w/o "except"
WPS504 # FIXME: invert a negated condition
WPS505 # FIXME: nested "try" in "try"
WPS507 # FIXME: useless `len()`
WPS508 # FIXME: misused `not` in if-clause
WPS509 # FIXME: incorrect ternary nesting
WPS510 # FIXME: if-clause with `in` operator w/ wrong set semantics
WPS513 # FIXME: implicit `elif`
WPS515 # FIXME: implicit `open()` w/o a CM
WPS518 # FIXME: implicit `enumerate()` pattern
WPS519 # FIXME: implicit `sum()` pattern
WPS528 # FIXME: implicit `dict.items()` pattern
WPS529 # FIXME: implicit `dict.get()` pattern
WPS531 # FIXME: simplifiable returning `if` in func
WPS602 # FIXME: `@staticmethod` is usually a code smell, use module funcs
WPS604 # FIXME: incorrect class body node
WPS605 # FIXME: method w/o args
WPS609 # FIXME: direct call to magic method
WPS612 # FIXME: useless `__init__()` override
WPS613 # FIXME: unmatching super method access
WPS615 # FIXME: unpythonic setter/getter
# https://wemake-python-stylegui.de/en/latest/pages/usage/formatter.html
format = wemake
# Let's not overcomplicate the code:
#max-complexity = 10
# FIXME: this is a lot!
max-complexity = 19
# Accessibility/large fonts and PEP8 friendly:
#max-line-length = 79
# Accessibility/large fonts and PEP8 unfriendly:
#max-line-length = 100
# Even more Accessibility/large fonts and PEP8 unfriendlier:
max-line-length = 127
# Allow certain violations in certain files:
per-file-ignores =
# E800 reports a lot of false-positives for legit
# tool-related comments;
# WPS412 logic of an extension is in __init__.py file;
# FIXME: WPS201 too many imports
# FIXME: WPS402 too many `noqa`s
#proxy/__init__.py: E800, WPS201, WPS402, WPS412
# There are multiple `assert`s (S101)
# and subprocesses (import S404; call S603) in tests;
# also, using fixtures looks like shadowing the outer scope (WPS442);
# and finally it's impossible to have <= members in tests (WPS202):
tests/**.py: S101, S404, S603, WPS202, WPS442
# wemake-python-styleguide
show-source = true
# flake8-pytest-style
# PT001:
pytest-fixture-no-parentheses = true
# PT006:
pytest-parametrize-names-type = tuple
# PT007:
pytest-parametrize-values-type = tuple
pytest-parametrize-values-row-type = tuple
# flake8-rst-docstrings
rst-roles =
# Built-in Sphinx roles:
py:class,
py:meth,
# Sphinx's internal role:
event,