Skip to content

Update from pep8 to pycodestyle #2828

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

Closed
karlcow opened this issue Mar 28, 2019 · 2 comments
Closed

Update from pep8 to pycodestyle #2828

karlcow opened this issue Mar 28, 2019 · 2 comments

Comments

@karlcow
Copy link
Member

karlcow commented Mar 28, 2019

see #2825 (comment)
for the context but basically pep8 has been renamed pycodestyle to avoid confusion with the real PEP8.

@karlcow
Copy link
Member Author

karlcow commented Mar 28, 2019

pip uninstall pep8
pip install pycodestyle

In CircleCI config we had: pep8 --ignore=E402 webcompat/ tests/ config/secrets.py.example

Reminder: E402 is module level import not at top of file

Let's try a run with pycodestyle --ignore=E402 webcompat/ tests/ config/secrets.py.example

webcompat/helpers.py:417:31: W605 invalid escape sequence '\*'
webcompat/helpers.py:417:33: W605 invalid escape sequence '\*'
webcompat/helpers.py:417:38: W605 invalid escape sequence '\*'
webcompat/helpers.py:417:40: W605 invalid escape sequence '\*'
webcompat/helpers.py:417:42: W605 invalid escape sequence '\:'
webcompat/helpers.py:505:32: W504 line break after binary operator
webcompat/helpers.py:506:31: W504 line break after binary operator
webcompat/helpers.py:507:55: W504 line break after binary operator
webcompat/helpers.py:508:55: W504 line break after binary operator
webcompat/helpers.py:509:30: W504 line break after binary operator
webcompat/helpers.py:510:33: W504 line break after binary operator
webcompat/helpers.py:511:131: W504 line break after binary operator
webcompat/helpers.py:512:75: W504 line break after binary operator
webcompat/helpers.py:513:29: W504 line break after binary operator
webcompat/helpers.py:514:36: W504 line break after binary operator
webcompat/error_handlers/__init__.py:41:42: W504 line break after binary operator
webcompat/error_handlers/__init__.py:42:50: W504 line break after binary operator
webcompat/db/__init__.py:78:1: E305 expected 2 blank lines after class or function definition, found 1
webcompat/api/uploads.py:61:48: W504 line break after binary operator
webcompat/api/uploads.py:116:47: W504 line break after binary operator
tests/unit/test_config.py:56:1: E305 expected 2 blank lines after class or function definition, found 1
tests/unit/test_dashboard.py:90:1: E305 expected 2 blank lines after class or function definition, found 1
tests/unit/test_helpers.py:319:1: E305 expected 2 blank lines after class or function definition, found 1
tests/unit/test_rendering.py:130:1: E305 expected 2 blank lines after class or function definition, found 1
tests/unit/test_tools_changelog.py:63:1: E305 expected 2 blank lines after class or function definition, found 1
tests/unit/test_uploads.py:36:31: W504 line break after binary operator
tests/unit/test_uploads.py:40:37: W504 line break after binary operator
tests/unit/test_uploads.py:44:36: W504 line break after binary operator
tests/unit/test_urls.py:261:80: E501 line too long (81 > 79 characters)
tests/unit/test_webhook.py:291:1: E305 expected 2 blank lines after class or function definition, found 1

Hello modernity, a couple of things to fix :)

We need to choose in between W503 and W504.

pycodestyle --ignore=E402,W504 webcompat/ tests/ config/secrets.py.example

I'm adjusting the documentation too.

@karlcow
Copy link
Member Author

karlcow commented Mar 28, 2019

🐝 10:42:48 ~/code/webcompat.com
→ pycodestyle --ignore=E402,W504 webcompat/ tests/ config/secrets.py.example
🐝 10:42:54 ~/code/webcompat.com
→ nosetests
.............................................................................................................
----------------------------------------------------------------------
Ran 109 tests in 2.763s

OK

karlcow added a commit to karlcow/webcompat.com that referenced this issue Mar 28, 2019
The project has been renamed and pycodestyle is the new version.
It will also means a bump into the checking that will need to be fixed.

We will do that in the subsequent commits.
karlcow added a commit to karlcow/webcompat.com that referenced this issue Mar 28, 2019
karlcow added a commit to karlcow/webcompat.com that referenced this issue Mar 28, 2019
This is the new keyword for removing the check for a specific line.
karlcow added a commit to karlcow/webcompat.com that referenced this issue Mar 28, 2019
This was initially triggered by pycodestyle W504. It kinds of force you to choose your style in between W503 and W504. Breaking before binary operators or after.

To avoid it altogether, I switched to ''.join() which is more effective anyway in performance.
https://wiki.python.org/moin/PythonSpeed/PerformanceTips#String_Concatenation
karlcow added a commit to karlcow/webcompat.com that referenced this issue Mar 28, 2019
We will ignore W504 for most of the cases.
karlcow added a commit to karlcow/webcompat.com that referenced this issue Mar 28, 2019
Basically pycostyle forces you to choose in between W504 or W503
karlcow added a commit to karlcow/webcompat.com that referenced this issue Mar 28, 2019
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

No branches or pull requests

1 participant