Skip to content

Commit 972f96a

Browse files
flake8: Add configuration file
This allows running flake8 on the code to check the formatting and some common problems. The code is not currently compliant with flake8, so flake8 is configured to ignore a lot of problems, but these could be (gradually or selectively) fixed in the future. This also tells flake8 to ignore the waf files, and tell it that `_` is an additional builtin function (which is inserted into the builtin scope by `hamster.lib.i18n.setup_i18n()` and `gettext.install()`).
1 parent 041ce9e commit 972f96a

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.flake8

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[flake8]
2+
exclude=wscript,waf,waflib
3+
builtins=_
4+
5+
# This just ignores everything that currently fails. Over time, most of these
6+
# should probably be fixed in the code and removed here.
7+
extend-ignore =
8+
E117, # over-indented
9+
E122, # continuation line missing indentation or outdented
10+
E124, # closing bracket does not match visual indentation
11+
E125, # continuation line with same indent as next logical line
12+
E127, # continuation line over-indented for visual indent
13+
E128, # continuation line under-indented for visual indent
14+
E129, # visually indented line with same indent as next logical line
15+
E131, # continuation line unaligned for hanging indent
16+
E202, # whitespace before ')'
17+
E203, # whitespace before ':'
18+
E211, # whitespace before '('
19+
E221, # multiple spaces before operator
20+
E222, # multiple spaces after operator
21+
E225, # missing whitespace around operator
22+
E227, # missing whitespace around bitwise or shift operator
23+
E231, # missing whitespace after ':'
24+
E251, # unexpected spaces around keyword / parameter equals
25+
E261, # at least two spaces before inline comment
26+
E262, # inline comment should start with '# '
27+
E265, # block comment should start with '# '
28+
E271, # multiple spaces after keyword
29+
E272, # multiple spaces before keyword
30+
E301, # expected 1 blank line, found 0
31+
E302, # expected 2 blank lines, found 1
32+
E303, # too many blank lines (2)
33+
E305, # expected 2 blank lines after class or function definition, found 1
34+
E306, # expected 1 blank line before a nested definition, found 0
35+
E401, # multiple imports on one line
36+
E402, # module level import not at top of file
37+
E501, # line too long
38+
E502, # the backslash is redundant between brackets
39+
E701, # multiple statements on one line (colon)
40+
E703, # statement ends with a semicolon
41+
E711, # comparison to None should be 'if cond is not None:'
42+
E712, # comparison to False should be 'if cond is False:' or 'if not cond:'
43+
E722, # do not use bare 'except'
44+
E731, # do not assign a lambda expression, use a def
45+
F401, # 'xxx' imported but unused
46+
F811, # redefinition of unused 'xxx' from line 32
47+
F841, # local variable 'xxx' is assigned to but never used
48+
W605, # invalid escape sequence
49+

0 commit comments

Comments
 (0)