[MapProxy-dev] RFC: Introduce linting

Julien R julien.rebetez at picterra.ch
Tue Jan 12 23:36:10 PST 2021


Hello,

I would like to propose adding linting to the mapproxy codebase and enforce
it on the CI. The benefits of linting are mostly that they make reviews
easier because reviewers don't have to point stylistic issues.

Johannes Weskamm originally proposed to introduce linting in this github
issue:
https://github.com/mapproxy/mapproxy/issues/478

I personally have experience with using flake8 professionally for multiple
years and it works great. I started experimenting with setting up flake8 on
the CI here:
https://github.com/mapproxy/mapproxy/pull/486

If this is accepted, the plan would be to:
- Introduce flake8 on CI, but disable all errors at first
- Enable errors one by one in separate commits

This is to avoid submitting a massive PR touching everything. See the
attached 'mapproxy_flake8_stats.txt' file for statistics about the "errors"
found by flake8.

Best regards,
Julien

--
Julien Rebetez
Lead Software & Machine Learning Engineer
Picterra SA
Rue de la Mouline 8, 1022 Chavannes, Switzerland
www.picterra.ch
<https://picterra.ch/?utm_source=signature&utm_medium=email&utm_campaign=43989-en-pt-email%20signature&utm_content=link>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapproxy-dev/attachments/20210113/544b7ee6/attachment.html>
-------------- next part --------------
10    E111 indentation is not a multiple of four
7     E117 over-indented
1     E122 continuation line missing indentation or outdented
33    E124 closing bracket does not match visual indentation
22    E125 continuation line with same indent as next logical line
52    E127 continuation line over-indented for visual indent
481   E128 continuation line under-indented for visual indent
27    E129 visually indented line with same indent as next logical line
17    E131 continuation line unaligned for hanging indent
10    E201 whitespace after '['
8     E202 whitespace before ']'
15    E203 whitespace before ','
29    E221 multiple spaces before operator
6     E222 multiple spaces after operator
1     E223 tab before operator
13    E225 missing whitespace around operator
5     E228 missing whitespace around modulo operator
113   E231 missing whitespace after ','
122   E251 unexpected spaces around keyword / parameter equals
102   E261 at least two spaces before inline comment
9     E262 inline comment should start with '# '
16    E265 block comment should start with '# '
8     E266 too many leading '#' for block comment
23    E271 multiple spaces after keyword
1     E272 multiple spaces before keyword
108   E301 expected 1 blank line, found 0
576   E302 expected 2 blank lines, found 1
96    E303 too many blank lines (2)
58    E305 expected 2 blank lines after class or function definition, found 1
12    E306 expected 1 blank line before a nested definition, found 0
29    E402 module level import not at top of file
2460  E501 line too long (97 > 79 characters)
1     E502 the backslash is redundant between brackets
57    E701 multiple statements on one line (colon)
5     E702 multiple statements on one line (semicolon)
2     E703 statement ends with a semicolon
55    E711 comparison to None should be 'if cond is not None:'
44    E712 comparison to False should be 'if cond is False:' or 'if not cond:'
5     E713 test for membership should be 'not in'
1     E721 do not compare types, use 'isinstance()'
9     E722 do not use bare 'except'
10    E731 do not assign a lambda expression, use a def
30    E741 ambiguous variable name 'l'
27    F401 'warnings' imported but unused
1     F523 '...'.format(...) has unused arguments at position(s): 0
23    F821 undefined name 'buffer'
22    F841 local variable 'rescaled_tiles' is assigned to but never used
3     F901 'raise NotImplemented' should be 'raise NotImplementedError'
17    W191 indentation contains tabs
26    W291 trailing whitespace
17    W292 no newline at end of file
22    W293 blank line contains whitespace
40    W391 blank line at end of file


More information about the MapProxy-dev mailing list