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

Pycodestyle is not detecting W605 and W503 #949

Closed
garawalid opened this issue Jul 2, 2020 · 4 comments
Closed

Pycodestyle is not detecting W605 and W503 #949

garawalid opened this issue Jul 2, 2020 · 4 comments

Comments

@garawalid
Copy link

Hi community,

I introduced two wrong rules (W605 & W503) in the example below:

def method_one(self):
    """
    * if :math:`p_i + s_i \geq p_{min} + 2 * s_{min}` -> Warning zone
    * if :math:`p_i + s_i \geq p_{min} + 3 * s_{min}` -> Change detected

    """
    gross_wages = 0
    taxable_interest = 0
    income = (gross_wages
              + taxable_interest)
    return income

When I run flake8 against this code, pycodestyle reports only W605

tox.ini:

[flake8]
$ flake8 example.py 
example.py:3:27: W605 invalid escape sequence '\g'
example.py:4:27: W605 invalid escape sequence '\g'

And when I add an exception for W605 in the tox.ini file. pycodestyle reports W503.

tox.ini:

[flake8]
ignore=W605
$ flake8 example.py 
example.py:10:15: W503 line break before binary operator

Was it supposed to have both W503 and W605 in the first example?

My configuration:

  • Python 3.8.2
  • flake8 3.8.3
@asottile
Copy link
Member

asottile commented Jul 2, 2020

W503 is among the disabled by default rules

@asottile asottile closed this as completed Jul 2, 2020
@asottile
Copy link
Member

asottile commented Jul 2, 2020

you want extend-ignore

@asottile
Copy link
Member

asottile commented Jul 2, 2020

(also, you should really not ignore W605, it will become a syntax error in a future version of python -- you probably want to r prefix your string -- or use pyupgrade which'll fix it automatically for you)

@garawalid
Copy link
Author

garawalid commented Jul 4, 2020

Thanks @asottile for the clarification. I'll give pyupgrade a try!

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

2 participants