microsoft / vscode-pylint

Linting support for python using the pylint library.
https://marketplace.visualstudio.com/items?itemName=ms-python.pylint
MIT License
70 stars 34 forks source link

Linting Python files out of Folder broken? Off by design? #480

Closed ewerybody closed 8 months ago

ewerybody commented 9 months ago

Hello Pylint extension folks! We have a lot of library and tool code and dedicated folders/projects for these. So when I'm working on some tool and have my VS Code pointed to that tool folder everything works fine but: Now I use a library thing in that tool and I want to see how it's implemented I can easily jump there and have the file opened, even have breakpoints there. All cool but that library file is lit like a Christmas tree with Pylint things that should be turned off. Seems these ONLY work on the files under that opened workspace folder.

Snippet from the settings.json:

  "pylint.args": [
    "--good-names=_,i,j,p4,ui,t0,t1,ce,db,ok",
    "--disable=import-outside-toplevel,wrong-import-position..."

Did I misconfigure something? Is this designed that way? Can I change it somehow?

Thanks for reading :) ëRiC

karthiknadig commented 9 months ago

You need to put that in User settings for it to work for files outside of the workspace.

ewerybody commented 9 months ago

Seriously? Like into:

C:\Users\eric\AppData\Roaming\Code\User\settings.json

Well ok. I mean we also have projects that are not even using Python :| But alright ... Seems like a hackfix tho.

karthiknadig commented 9 months ago

Workspace settings only apply to a workspace. If you open a file that does not belong to the work space then settings for that file have to come from some where. The user settings.json is a place for globally scoped settings for those scenarios.

you have several settings in the global settings.json that may not apply to your project. Your project settings go in your workspace settings.json.

Consider this, if you have a multi-root workspace, and you open a file that does not belong to any of the workspace folders. Where should the setting for that file be? It does not make sense to add the setting for those types in any of the folders that are part of the multi root workspace. If it were added to one of the folders in the multi-root workspace how would you pick that? What would be the order of setting’s precedence? With the user settings the precedence is well defined: User settings can be overridden by machine settings, which can be overridden by workspace settings, which can be overridden by workspace folder settings.

karthiknadig commented 8 months ago

Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on then we will be happy to re-open this issue to pick up where we left off.