How to get PyCharm to check PEP8 code style?

57,454

Solution 1

Which version of Python are you using? If it is Python 3 (maybe specifically Windows 64 bit), there are a couple of bugs logged against that on JetBrains' site:

http://youtrack.jetbrains.com/issue/PY-8923

http://youtrack.jetbrains.com/issue/PY-8077

Solution 2

Mine wasn't showing up due to the color scheme. By default it's marked as "weak warning", so you might have to edit the appearance to make it visible. Editor > Colors & Fonts > General > Errors and Warnings.

Solution 3

OP asks for a way to highlight PEP8 errors on PyCharm, but there's another way (much clearer in my opinion) to see the violations (extracted from PyCharm's docs). Open Code | Inspect Code and friends:

Inspection Tool Window

View | Tool Windows | Inspection:

  • You can access the tool window this way only when it is already opened through Code | Inspect Code.
  • After you deactivate the tool window manually by clicking the Close button, the tool window is again available only through Code | Inspect Code. The Inspection tool window displays inspection results on separate tabs

Just tested it on a PyCharm Community Edition and it worked like a charm (no pun intended).

Solution 4

For me I found that the best way for me was to include pep8 checking as an external script, something along the lines of this:

https://web.archive.org/web/20121206054036/http://blog.saturnlaboratories.co.za/archive/2012/09/10/running-pylint-pycharm

The advantage of doing this is that the errors appear as sort of a todo list the bottom of the frame. This way I don't have to look around the code for errors.

Solution 5

Well, I wish I had a better answer, but what helped me was simply the following:

  1. switch the interpreter from a remote one to a system one
  2. wait until the Pycharm indexing is done
  3. switch the interpreter back to the initial/desired one
Share:
57,454
Alvaro
Author by

Alvaro

Updated on October 07, 2020

Comments

  • Alvaro
    Alvaro over 3 years

    I'm using PyCharm (v 2.7.2) to develop a Django app, but I can't get it to check PEP8 style violations. I have enabled "PEP8 coding style violation" in the "Inspctions" section of the settings, but PyCharm doesn't highlight the style violations. Is there a way to fix this?

  • Alvaro
    Alvaro almost 11 years
    That's exactly what happened. I moved to Ubuntu 13.04 a while ago and Pycharm works perfectly fine. Thanks!
  • Brandon Bradley
    Brandon Bradley over 8 years
    Broken link. Can you find a cached version?
  • Shawkat Alam
    Shawkat Alam over 8 years
    Archive.org does have a copy web.archive.org/web/20121206054036/http://…
  • HosseyNJF
    HosseyNJF about 2 years
    I didn't expect this to work honestly, but it did... Thank you! Can anyone explain what is the correlation here?