Configure pep8.py command line options in pycharm

10,648

Solution 1

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

Solution 2

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.

Solution 3

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
Share:
10,648

Related videos on Youtube

Alex Flint
Author by

Alex Flint

I work on the computer vision behind augmented reality applications for mobile phones at a startup called Ogmento in New York City.

Updated on June 07, 2022

Comments

  • Alex Flint
    Alex Flint about 2 years

    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.

  • Alex Flint
    Alex Flint over 10 years
    I actually tried creating a tox.ini file in a parent directory of the file I'm looking at, but it did not change pycharm's behavior. It might be that the results are cached by pycharm, or that pycharm copies files to a temporary location before passing them through pep8...
  • Jirik
    Jirik over 5 years
    I tried a similar thing as Alex. I tried to have .pep8, setup.cfg, tox.ini both in a folder with python folder and parent folder. But Pycharm didn't pick up config from those files. pep8.readthedocs.io/en/release-1.7.x/intro.html#configuratio‌​n