Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure pep8.py command line options in pycharm

Can I configure the command line arguments that PyCharm sends to pep8.py when it does its automatic PEP8 style checking? I would like to do something like

$ pep8 --ignore=E231 foo.py

However, in PyCharm under Project Settings -> Inspections I only see options to enable/disable PEP8 style checks in aggregate, but no option to enable/disable specific PEP8 violations.

like image 610
Alex Flint Avatar asked Mar 17 '14 15:03

Alex Flint


People also ask

Does PyCharm check for PEP8?

So, as you can see, PyCharm supports PEP8 as the official Python style guide.

How do you give command-line arguments in PyCharm?

Passing Command-line arguments in PyCharm If you want to pass command-line arguments to a python program, go to “Run > Edit Configurations” and set the Parameters value and save it.


3 Answers

Found the solution here: http://iambigblind.blogspot.de/2013/02/configuring-pep8py-support-in-pycharm-27.html

Just add E501 to the list of ignore errors and the warning will go away in PyCharm 3 (and 4).

Edit:

According to a comment on the JetBrains site, someone said "The error code as of Pycharm 2017.3.4 is E111", see https://intellij-support.jetbrains.com/hc/en-us/community/posts/205816889-Disable-individual-PEP8-style-checking-line-length-?page=1#community_comment_360000113310

like image 123
Kawu Avatar answered Oct 16 '22 21:10

Kawu


You can use a pep8 rc-file for this:

# in ~/.config/pep8
[pep8]
ignore = E231

If you need to set them up with different options per-project, this is possible too:

Configuration: The project options are read from the [pep8] section of the tox.ini file or the setup.cfg file located in any parent folder of the path(s) being processed. Allowed options are: exclude, filename, select, ignore, max-line-length, count, format, quiet, show-pep8, show-source, statistics, verbose.

like image 22
wim Avatar answered Oct 16 '22 22:10

wim


If you want to force pep8 to ignore long line detection type:

  • # noqa at the end of each python code long line.
  • -- # noqa at the end of each sql code long line.

Example:

c.execute("""SELECT title,COUNT(path)FROM log inner join articles   -- # noqa
like image 2
tamer kamal Avatar answered Oct 16 '22 21:10

tamer kamal