Home > Software engineering >  vscode doesnt set pylint in a workspace with monorepo
vscode doesnt set pylint in a workspace with monorepo

Time:07-30

I have a vscode workspace and in each project, in the workspace, I have a .vscode with its settings.json and I have back.code-workspace file in the root of the workspace.

In the root of the workspace, I have the .pylintrc too.

and in the back.code-workspace I have the following config:

"python.linting.pylintArgs": [
  "--rcfile=${workspaceFolder}/.pylintrc"
],
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,

But with this configuration the pylint doesn't work, I tried to copy in each .vscode/settings.json but doesn't work too, so how can I set pylint in the workspace?

Thanks

CodePudding user response:

If you have a multiproject workspace then ${workspaceFolder} points contextually for each file to its project folder. There is no such thing as a folder of the workspace. The location of the .workspace file doesn't matter.

For example

- workspace/
  - project 1/  # this folder IS added to the workspace
    - .pylintrc  # this file is being used for files in `project 1` folder
  - project 2/  # this folder IS NOT added to the workspace
    - .pylintrc  # this file is unused as `project 2` is not in the workspace
  - .pylintrc  # this file is not in the workspace
  - my.workspace  # the location of this file doesn't matter after the workspace has been opened

I suggest to have .pylintrc in each folder or create a symlink to an original one.

Another option would be to have this in your workspace config:

"python.linting.pylintArgs": [
  "--rcfile=/full/path/to/the/original/.pylintrc"
],
  • Related