Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update coding style in Python files (#724) #918

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MathPlayer
Copy link
Contributor

@MathPlayer MathPlayer commented Mar 8, 2018

This pull request is fixing most of the lint errors and warnings.
The files are checked with pycodestyle - formerly called pep8.

I recommend to reviewers to get this commit locally and check it in a more strict way (at least without the space differences), it will be a lot faster.
If needed, I can split this commit into smaller ones, like one for each of the main folders.

As a reference, when I'm running the command pycodestyle <git-root-folder>/wouso --exclude=migrations --statistics --ignore= -qq | sort -nr, the upstream master branch is generating the following output:

249     E128 continuation line under-indented for visual indent
176     E302 expected 2 blank lines, found 1
149     E501 line too long (299 > 120 characters)
139     E231 missing whitespace after ','
84      E225 missing whitespace around operator
61      E265 block comment should start with '# '
48      E305 expected 2 blank lines after class or function definition, found 0
48      E251 unexpected spaces around keyword / parameter equals
37      W292 no newline at end of file
37      E127 continuation line over-indented for visual indent
35      E722 do not use bare except'
29      E124 closing bracket does not match visual indentation
26      E261 at least two spaces before inline comment
22      W293 blank line contains whitespace
17      E402 module level import not at top of file
17      E303 too many blank lines (2)
16      E502 the backslash is redundant between brackets
16      E221 multiple spaces before operator
14      E711 comparison to None should be 'if cond is None:'
12      W391 blank line at end of file
10      E262 inline comment should start with '# '
8       E702 multiple statements on one line (semicolon)
6       W291 trailing whitespace
6       E701 multiple statements on one line (colon)
6       E111 indentation is not a multiple of four
5       W601 .has_key() is deprecated, use 'in'
5       W191 indentation contains tabs
5       E713 test for membership should be 'not in'
5       E203 whitespace before ':'
5       E122 continuation line missing indentation or outdented
5       E101 indentation contains mixed spaces and tabs
4       E741 ambiguous variable name 'l'
4       E227 missing whitespace around bitwise or shift operator
3       E731 do not assign a lambda expression, use a def
3       E401 multiple imports on one line
3       E202 whitespace before '}'
2       E306 expected 1 blank line before a nested definition, found 0
2       E301 expected 1 blank line, found 0
2       E222 multiple spaces after operator
2       E201 whitespace after '{'
2       E129 visually indented line with same indent as next logical line
2       E125 continuation line with same indent as next logical line
1       E714 test for object identity should be 'is not'
1       E712 comparison to False should be 'if cond is False:' or 'if not cond:'
1       E271 multiple spaces after keyword
1       E228 missing whitespace around modulo operator
1       E211 whitespace before '('
1       E116 unexpected indentation (comment)
1       E115 expected an indented block (comment)
1       E114 indentation is not a multiple of four (comment)

After the changes in this pull request, the output of the mentioned command is reduced to:

136     E501 line too long (299 > 120 characters)
35      E722 do not use bare except'
17      E402 module level import not at top of file

Change
Make the minimal changes needed to fix most of the errors and warnings
reported by pycodestyle (successor of pep8). The following three are
ignored in this commit:

  • E402 module level import not at top of file
  • E501 line too long
  • E722 do not use bare except'

Most of the changes are actually only spacing fixes.
There is an actual code refactor done in order to fix:

  • W601 .has_key() is deprecated, use 'in'
  • E711 comparison to None should be 'if cond is None:'
  • E712 comparison to False should be 'if cond is False:' or 'if not cond:'
  • E713 test for membership should be 'not in'
  • E714 test for object identity should be 'is not'
  • E731 do not assign a lambda expression, use a def
  • E741 ambiguous variable name 'l'

Make the minimal changes needed to fix most of the errors and warnings
reported by pycodestyle (successor of pep8). The following three are
ignored in this commit:
- E402 module level import not at top of file
- E501 line too long
- E722 do not use bare except'

Most of the changes are actually only spacing fixes.
There is an actual code refactor done in order to fix:
- W601 .has_key() is deprecated, use 'in'
- E711 comparison to None should be 'if cond is None:'
- E712 comparison to False should be 'if cond is False:' or 'if not cond:'
- E713 test for membership should be 'not in'
- E714 test for object identity should be 'is not'
- E731 do not assign a lambda expression, use a def
- E741 ambiguous variable name 'l'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant