-
Notifications
You must be signed in to change notification settings - Fork 203
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
Fixes #2828 - Changes from pep8 to pycodestyle #2829
Conversation
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.
This is the new keyword for removing the check for a specific line.
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
We will ignore W504 for most of the cases.
Basically pycostyle forces you to choose in between W504 or W503
@@ -414,7 +414,7 @@ def extract_url(issue_body): | |||
URL in webcompat.com bugs follow this pattern: | |||
**URL**: https://example.com/foobar | |||
""" | |||
url_pattern = re.compile('\*\*URL\*\*\: (.+)\n') | |||
url_pattern = re.compile(r'\*\*URL\*\*\: (.+)') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just explaining here the why. This was W605 invalid escape sequence ‘x’
The explanation is https://lintlyci.github.io/Flake8Rules/rules/W605.html
https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals
Both string and bytes literals may optionally be prefixed with a letter 'r' or 'R'; such strings are called raw strings and treat backslashes as literal characters. As a result, in string literals, '\U' and '\u' escapes in raw strings are not treated specially. Given that Python 2.x’s raw unicode literals behave differently than Python 3.x’s the 'ur' syntax is not supported.
"report-uri /csp-report" | ||
) | ||
] | ||
response.headers['Content-Security-Policy'] = (''.join(csp_params)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not forced to do that as I chose to ignore W504, but this is more performant. So this is a win-win change.
@miketaylr could we merge this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, sorry for the delay.
This PR fixes issue #2828
Proposed PR background
pep8 has changed name and is deprecated. We need to switch to pycodestyle (new name for pep8). This created a version bump with a couple of things to fix, choose.
This adjusts the
The tests are running on my local computer.
The biggest change in the code is probably
cba1193
that I have singled out. The rest is following basically the recommendation of pycodestyle.
It will also make it possible to test the code on #2825 project, where circleci requires pycodestyle #2825 (comment)
r? @miketaylr