1

Is there any way to use pylint or flake8 real-time inspection on PyCharm? I don't want to push the run bottom but to real-time scan my cod to find the suggestions.

GGChe
  • 193
  • 1
  • 1
  • 11
  • Does this answer your question? [How to run Pylint with PyCharm](https://stackoverflow.com/questions/38134086/how-to-run-pylint-with-pycharm) – bad_coder Feb 15 '22 at 12:15
  • No, because that is for executing pylint analysis on demand clicking the button, I want it to trigger automatically – GGChe Feb 15 '22 at 14:37
  • 2
    The analyses is already integrated into the PyCharm linter (both pylint and flake8), that's what the yellow warnings in the editor from the linter mean. If you want to run the tools automatically on every file change you need to configure [File watchers](https://www.jetbrains.com/help/pycharm/using-file-watchers.html) for your whole project tho execute at every keystroke... (Notice that *"at every keystroke"* is why running on click is considered the reasonable way to execute any tool.) – bad_coder Feb 15 '22 at 14:46
  • 1
    I agree with you completely, for me running by clicking is more than reasonable but in my team people asked if real-time linting is possible in pycharm. Thanks! – GGChe Feb 15 '22 at 14:52

2 Answers2

1

This does not exists as far as I know and for good reasons : if it did it would not be usable because it would be too demanding on the IDE. pylint is checking a lot of thing (for example code duplication which is intrinsically a hard problem to solve) so it's too slow to be run in real time for each key stroke.

Pierre.Sassoulas
  • 3,733
  • 3
  • 33
  • 48
  • I agree, that would be too demanding. But people from me team at the office asked if there is any way for executing the tool on real-time avoiding to click on the plugin all the time. Anyway, I guess there isn't a way to do that though – GGChe Feb 15 '22 at 14:53
  • 1
    There's a way bad_coder gave it in the comment but they'll see very fast that it's impossible to code if they do it. You can run it before each commit as a git pre-commit hook (that's what I suggest in my team personally). – Pierre.Sassoulas Feb 15 '22 at 19:53
0

I've had great success with the Pylint extension by Roberto Leinardi.

If you're using a virtual environment and have your .pylintrc file in the root of your project, the Pylint extension should pick everything up automatically, even across different platforms. Otherwise, you can go to File > Settings > Pylint to fix them on a per-machine basis.

The only caveat is the "real time" part of your question. I've not been able to get it to run entirely automatically while I'm typing or whatever. Instead I have to save the file I'm currently in (Ctrl + S or switch focus to another window) and then it'll run and make the suggestions in the IDE in the same way the built-in PyCharm linter does.

Pylint showing suggestions in the IDE

Hope this helps!

Kasim Ahmic
  • 312
  • 3
  • 15