Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b6104ea

Browse files
committedNov 2, 2021
Add a config for flake8
1 parent fae694f commit b6104ea

File tree

1 file changed

+236
-0
lines changed

1 file changed

+236
-0
lines changed
 

‎.flake8

Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
[flake8]
2+
3+
# Don't even try to analyze these:
4+
extend-exclude =
5+
# No need to traverse egg info dir
6+
*.egg-info,
7+
# GitHub configs
8+
.github,
9+
# Cache files of MyPy
10+
.mypy_cache,
11+
# Cache files of pytest
12+
.pytest_cache,
13+
# Temp dir of pytest-testmon
14+
.tmontmp,
15+
# Occasional virtualenv dir
16+
.venv,
17+
# VS Code
18+
.vscode,
19+
# Temporary build dir
20+
build,
21+
# This contains sdists and wheels of proxy.py that we don't want to check
22+
dist,
23+
# Occasional virtualenv dir
24+
env,
25+
# Metadata of `pip wheel` cmd is autogenerated
26+
pip-wheel-metadata,
27+
28+
# IMPORTANT: avoid using ignore option, always use extend-ignore instead
29+
# Completely and unconditionally ignore the following errors:
30+
extend-ignore =
31+
I # flake8-isort is drunk + we have isort integrated into pre-commit
32+
B009 # FIXME: `getattr()` called with a constant arg
33+
C812 # FIXME: missing trailing comma
34+
C819 # FIXME: inline trailing comma
35+
D101
36+
D102
37+
D103
38+
D105
39+
D106
40+
D107
41+
D203
42+
D205
43+
D208
44+
D209
45+
D212
46+
D213
47+
D300
48+
D400
49+
D401
50+
D402
51+
D403
52+
D404
53+
D405
54+
D407
55+
D412
56+
D413
57+
D415
58+
DAR101 # FIXME: undocumented docstring param
59+
DAR201 # FIXME: no "returns" in docstring
60+
DAR301 # FIXME: no "yields" in docstring
61+
DAR401 # FIXME: no "raises" in docstring
62+
E800 # FIXME: commented out code
63+
N400 # FIXME: escaping with backslash at EOL
64+
N801 # FIXME: class name should use ProudCamelCase
65+
N802 # FIXME: func name should be lowercase
66+
N816 # FIXME: mixed case var name
67+
P101 # FIXME: format string with unindexed params
68+
PT009 # FIXME: pytest encourages use of `assert`
69+
PT018 # FIXME: use multiple `assert`s instead of one complex
70+
Q000 # FIXME: inconsistent double quotes use when single ones are needed
71+
Q001 # FIXME: use double quotes in multiline strings
72+
Q002 # FIXME: use double quote docstrings
73+
Q003 # FIXME: avoid escaping in-string quotes
74+
RST201 # FIXME: missing trailing blank line in docstring
75+
RST203 # FIXME: no trailing blank line in docstring
76+
RST301 # FIXME: unexpected indent in docstring
77+
S101 # FIXME: assertions are thrown away in optimized mode, needs audit
78+
S104 # FIXME: bind-all interface listen
79+
S105 # FIXME: hardcoded password?
80+
S303 # FIXME: insecure hash func
81+
S311 # FIXME: `random` needs auditing
82+
S404 # FIXME: `subprocess` use needs auditing
83+
S603 # FIXME: audit untrusted `subprocess.Popen` input
84+
S607 # FIXME: running subprocess with a non-absolute executable path
85+
WPS100 # FIXME: unhelpful module name
86+
WPS102 # FIXME: incorrect module name pattern
87+
WPS110 # FIXME: unhelpful var name
88+
WPS111 # FIXME: too short var name
89+
WPS114 # FIXME: underscored numbers in var name
90+
WPS115 # FIXME: uppercase class attr
91+
WPS118 # FIXME: long func name
92+
WPS120 # FIXME: regular name w/ trailing underscore
93+
WPS121 # FIXME: unused var used 0_O
94+
WPS122 # FIXME: unused var definition 0_O
95+
WPS201 # FIXME: too many imports
96+
WPS202 # FIXME: too many mod members
97+
WPS203 # FIXME: too many mod imported names
98+
WPS204 # FIXME: too much copy-paste
99+
WPS210 # FIXME: too many local vars
100+
WPS211 # FIXME: too many "__init__()" args
101+
WPS212 # FIXME: too many "return"s
102+
WPS213 # FIXME: too many expressions
103+
WPS214 # FIXME: too many methods
104+
WPS216 # FIXME: too many decorators
105+
WPS219 # FIXME: deep object access is unreadable
106+
WPS220 # FIXME: deep code nesting
107+
WPS221 # FIXME: too big inline complexity / tested instructions
108+
WPS222 # FIXME: too much logic in condition
109+
WPS223 # FIXME: the code is too branchy
110+
WPS225 # FIXME: too many "except"s
111+
WPS226 # FIXME: magic string constant used too much, put it in a var
112+
WPS229 # FIXME: try/except should wrap exactly one instruction
113+
WPS230 # FIXME: too many public instance attrs
114+
WPS231 # FIXME: insane complexity/code nesting in a function
115+
WPS232 # FIXME: module is too complex
116+
WPS234 # FIXME: annotation is too complex
117+
WPS235 # FIXME: too many imported names from a single module
118+
WPS237 # FIXME: too complex f-string
119+
WPS300 # local folder imports are needed
120+
WPS301 # FIXME: dotted import
121+
WPS305 # this project is Python 3 only and so f-strings are allowed
122+
WPS306 # this project is Python 3 so it doesn't need an explicit class base
123+
WPS313 # FIXME: parens after keyword
124+
WPS317 # enforces weird indents
125+
WPS318 # enforces weird indents
126+
WPS319 # FIXME: asymmetric closing bracket
127+
WPS320 # FIXME: multiline func type annotation
128+
WPS322 # FIXME: inline multiline str
129+
WPS323 # false-positive: %-formatting in logging
130+
WPS324 # FIXME: inconsistent "return" in func
131+
WPS326 # doesn't allow implicit string concat
132+
WPS328 # FIXME: useless `while` node
133+
WPS336 # FIXME: explicit string concat
134+
WPS337 # FIXME: multiline conditions
135+
WPS338 # FIXME: unordered class methods
136+
WPS339 # FIXME: meaningless leading zeros in number
137+
WPS349 # FIXME: redundant slice
138+
WPS360 # FIXME: unnecessary r-string
139+
WPS361 # FIXME: inconsistent comprehension structure
140+
WPS403 # FIXME: `# noqa` overuse
141+
WPS407 # FIXME: mutable mod const
142+
WPS408 # FIXME: duplicate logical condition
143+
WPS410 # allow `__all__`
144+
WPS412 # FIXME: logic in `__init__`
145+
WPS414 # FIXME: consusing unpacking target
146+
WPS420 # FIXME: pointless keyword like `pass`
147+
WPS421 # FIXME: call to `print()`
148+
WPS425 # FIXME: bool non-keyword arg
149+
WPS427 # FIXME: unreachable code
150+
WPS428 # FIXME: pointless statement
151+
WPS430 # FIXME: nested func
152+
WPS431 # FIXME: nested class
153+
WPS432 # FIXME: magic number w/o assigned context/name
154+
WPS433 # FIXME: nested import
155+
WPS437 # FIXME: protected attr access
156+
WPS440 # FIXME: block vars overlap
157+
WPS441 # FIXME: control var use after block
158+
WPS442 # FIXME: outer scope var shadowing
159+
WPS453 # FIXME: executable file w/o shebang
160+
WPS454 # FIXME: don't raise a broad exception, use a specific one
161+
WPS457 # FIXME: infinite `while`
162+
WPS458 # FIXME: import collision
163+
WPS460 # FIXME: single element unpacking
164+
WPS464 # FIXME: empty comment
165+
WPS501 # FIXME: "finally" in "try" w/o "except"
166+
WPS504 # FIXME: invert a negated condition
167+
WPS505 # FIXME: nested "try" in "try"
168+
WPS507 # FIXME: useless `len()`
169+
WPS508 # FIXME: misused `not` in if-clause
170+
WPS509 # FIXME: incorrect ternary nesting
171+
WPS510 # FIXME: if-clause with `in` operator w/ wrong set semantics
172+
WPS513 # FIXME: implicit `elif`
173+
WPS515 # FIXME: implicit `open()` w/o a CM
174+
WPS518 # FIXME: implicit `enumerate()` pattern
175+
WPS519 # FIXME: implicit `sum()` pattern
176+
WPS528 # FIXME: implicit `dict.items()` pattern
177+
WPS529 # FIXME: implicit `dict.get()` pattern
178+
WPS531 # FIXME: simplifiable returning `if` in func
179+
WPS602 # FIXME: `@staticmethod` is usually a code smell, use module funcs
180+
WPS604 # FIXME: incorrect class body node
181+
WPS605 # FIXME: method w/o args
182+
WPS609 # FIXME: direct call to magic method
183+
WPS612 # FIXME: useless `__init__()` override
184+
WPS613 # FIXME: unmatching super method access
185+
WPS615 # FIXME: unpythonic setter/getter
186+
187+
# https://wemake-python-stylegui.de/en/latest/pages/usage/formatter.html
188+
format = wemake
189+
190+
# Let's not overcomplicate the code:
191+
#max-complexity = 10
192+
# FIXME: this is a lot!
193+
max-complexity = 19
194+
195+
# Accessibility/large fonts and PEP8 friendly:
196+
#max-line-length = 79
197+
# Accessibility/large fonts and PEP8 unfriendly:
198+
#max-line-length = 100
199+
# Even more Accessibility/large fonts and PEP8 unfriendlier:
200+
max-line-length = 127
201+
202+
# Allow certain violations in certain files:
203+
per-file-ignores =
204+
205+
# E800 reports a lot of false-positives for legit
206+
# tool-related comments;
207+
# WPS412 logic of an extension is in __init__.py file;
208+
# FIXME: WPS201 too many imports
209+
# FIXME: WPS402 too many `noqa`s
210+
#proxy/__init__.py: E800, WPS201, WPS402, WPS412
211+
212+
# There are multiple `assert`s (S101)
213+
# and subprocesses (import – S404; call – S603) in tests;
214+
# also, using fixtures looks like shadowing the outer scope (WPS442);
215+
# and finally it's impossible to have <= members in tests (WPS202):
216+
tests/**.py: S101, S404, S603, WPS202, WPS442
217+
218+
# wemake-python-styleguide
219+
show-source = true
220+
221+
# flake8-pytest-style
222+
# PT001:
223+
pytest-fixture-no-parentheses = true
224+
# PT006:
225+
pytest-parametrize-names-type = tuple
226+
# PT007:
227+
pytest-parametrize-values-type = tuple
228+
pytest-parametrize-values-row-type = tuple
229+
230+
# flake8-rst-docstrings
231+
rst-roles =
232+
# Built-in Sphinx roles:
233+
py:class,
234+
py:meth,
235+
# Sphinx's internal role:
236+
event,

0 commit comments

Comments
 (0)
Please sign in to comment.