Currently, a linter will execute at the workspace root. In some cases, a user may want to have the linter execute in a different directory. There should be a setting exposed to allow a user to customize the current working directory of the linter, similar to testing.
Scenario: pylint-django
Consider a Django application using pylint with pylint-django. This requires pylint to receive an argument that points to the Django settings module. However, there might be a case where the settings module is not accessible from the root and cannot be imported causing the plugin to fail. Example:
File Structure
Configuration
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.pylintArgs": [
"--load-plugins=pylint_django",
"--django-settings-module=myapp.settings"
],
Result
error,django-not-configured:Django was not configured.
Requested Behaviour
The user should be able to set their working directory for linting.
"python.linting.enabled": true,
"python.linting.cwd": "${workspaceFolder}/myapp",
"python.linting.pylintEnabled": true,
"python.linting.pylintArgs": [
"--load-plugins=pylint_django",
"--django-settings-module=greenspace.settings"
],
Scenario: mypy
The above scenario applies to mypy and django-stubs.
Currently, a linter will execute at the workspace root. In some cases, a user may want to have the linter execute in a different directory. There should be a setting exposed to allow a user to customize the current working directory of the linter, similar to testing.
Scenario: pylint-django
Consider a Django application using
pylintwithpylint-django. This requirespylintto receive an argument that points to the Django settings module. However, there might be a case where the settings module is not accessible from the root and cannot be imported causing the plugin to fail. Example:File Structure
__init__.pyConfiguration
Result
Requested Behaviour
The user should be able to set their working directory for linting.
Scenario: mypy
The above scenario applies to mypy and django-stubs.