leinardi / pylint-pycharm

A plugin providing both real-time and on-demand scanning of Python files with PyLint from within PyCharm/IDEA.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support setting a working directory for pylint

lrittel opened this issue · comments

Firstly: thank you for creating the plugin!

Is your feature request related to a problem? Please describe.

I have run into a few problems with configuring pylint:

  • pylint started by the plugin did not respect the .pylintrc file or the pyproject.toml configuration
  • ignore patterns not matching the intended targets

Running pylint from the root directory like pylint src/, I didn't encounter those issues.

Also, support for discovering a pyproject.toml in a parent directory is a feature that won't be available until pylint 3.0.0.

Always running pylint from a specific directory would also help with reproducing configuration issues on the command line and keeping the setup similar across different tools.

Describe the solution you'd like

One of two things (or a combination of both) in the settings:

  • a checkbox "Run pylint from the project root" (defaulting to unchecked)
    • a hint that setting recurse = true in the configuration may be required could be helpful
  • a directory selection "pylint working directory"
    • a hint that setting recurse = true in the configuration may be required could be helpful
    • when the selection is empty, the plugin behaves like it does at the moment

Describe alternatives you've considered

I've tried to configure pylint 3.0.0a6 in a way that it uses my pyproject.toml from the project root, but I run into a problem with ignore paths not matching anymore.

I also considered creating a wrapper script, this would complicate my setup a lot.

If I read

cmd.setWorkDirectory(project.getBasePath());
correctly, pylint should already be executed from the project directory?

That doesn't match the observed behavior for me. I'm confused now.