You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I set a setting "editor.tabSize": 2, but pythonVSCode doesn't recognize this settings. I see the error message from the pylint about wrong indentation, something like this:
[pylint] W0311:Bad indentation. Found 6 spaces, expected 12
Tried to find the proper option to pass to the "python.linting.pylintArgs": [] but found nothing. Can you please let me know how to push pylint to check syntax based on the two-space indentation instead of four? Also it will be good to use theeditor.tabSize setting in the pythonVSCode to pass through to the pylint.
Thanks.
Copied from original issue: DonJayamanne/pythonVSCode#1015
But it adds complexity. In each my project I need to add a file with config fot pylint and other libs? It's unreal if I have 10 projects.
In Sublime I change indentation size and it automatically pass this parameter to the pylint. I need nothing to configure. I know that it's extra work that you need to do to initialize the pylint with the correct parameters- but I think that it worth it.
PS. I don't know which parameter I need to pass to pylint as a custom argument to change the indentation size. Can you help with it?
Anton Danylchenko (@1st) I include a pylintrc file in the root of my workspace with these lines:
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
# tab).
indent-string=' '
# Number of spaces of indent required inside a hanging or continued line.
indent-after-paren=3
I finally decided to execute command pylint --long-help to configure this option myself.
It's what I found there:
--indent-string=<string>
String used as indentation unit. This is usually "
" (4 spaces) or "\t" (1 tab). [current: ' ']
Don Jayamanne (@DonJayamanne) can you please adopt this option to the current size of indentation that set by the configuration option editor.tabSize? It will be fine to pass this automatically to the pylint linter as a mandatory option.
Currently I solved my problem with 2 spaces in my project with this configuration option:
Dear developers. As you can see - I've proposed a solution for the problem. But it's manual solution.
I wish to see it automatically made by vscode: every time when you run the pylint please add next argument to it: --indent-string=\" \". It will be the number of spaces that user set in the "editor.tabSize" setting. If it's set to 2 - then two space will be passed. If it's set to 4 - then four spaces will be passed to the pylint tool.
As for me it looks very easy to implement. The problem that I didn't make any change in vscode before and can't propose a patch for it. If you will need my help - just let me know and we can do it together, or I can explain how to solve this issue. But I don't have extended knowledge of the project to make changes in code myself.
Propagating individual settings as arguments has side effects. For example, team may have standard set to 4 and yet we will not flag incorrect formatting since we'll be passing 2 instead and git commit hooks will then reject the code.
TS Lint does not follow editor settings. It follows its tsfmt.json configuration file so formatting would be consisted with the team settings checked in into the source control. Similarly, in big Visual Studio linting rules are typically separate from the editor settings.
In the upcoming release default (simplified) pylint rules exclude formatting and styling so it won't be complaining about tab sizes, see #554. However, we do not want to tie linter rules to edit settings since it would be inconsistent with behavior of other languages and editors.
Activity
DonJayamanne commentedon Nov 13, 2017
Pylint is a separate python package. You will need to configure pylint using the relevant configuration files.
DonJayamanne commentedon Nov 13, 2017
From Anton Danylchenko (@1st) on June 13, 2017 7:41
But it adds complexity. In each my project I need to add a file with config fot pylint and other libs? It's unreal if I have 10 projects.
In Sublime I change indentation size and it automatically pass this parameter to the pylint. I need nothing to configure. I know that it's extra work that you need to do to initialize the pylint with the correct parameters- but I think that it worth it.
PS. I don't know which parameter I need to pass to pylint as a custom argument to change the indentation size. Can you help with it?
DonJayamanne commentedon Nov 13, 2017
From egabrum on June 14, 2017 0:0
Anton Danylchenko (@1st) I include a pylintrc file in the root of my workspace with these lines:
DonJayamanne commentedon Nov 13, 2017
From Anton Danylchenko (@1st) on July 4, 2017 15:34
I finally decided to execute command
pylint --long-helpto configure this option myself.It's what I found there:
Don Jayamanne (@DonJayamanne) can you please adopt this option to the current size of indentation that set by the configuration option
editor.tabSize? It will be fine to pass this automatically to thepylintlinter as a mandatory option.Currently I solved my problem with 2 spaces in my project with this configuration option:
1st commentedon Dec 21, 2017
Dear developers. As you can see - I've proposed a solution for the problem. But it's manual solution.
As for me it looks very easy to implement. The problem that I didn't make any change in
vscodebefore and can't propose a patch for it. If you will need my help - just let me know and we can do it together, or I can explain how to solve this issue. But I don't have extended knowledge of the project to make changes in code myself.MikhailArkhipov commentedon Feb 1, 2018
Propagating individual settings as arguments has side effects. For example, team may have standard set to 4 and yet we will not flag incorrect formatting since we'll be passing 2 instead and git commit hooks will then reject the code.
TS Lint does not follow editor settings. It follows its tsfmt.json configuration file so formatting would be consisted with the team settings checked in into the source control. Similarly, in big Visual Studio linting rules are typically separate from the editor settings.
MikhailArkhipov commentedon Feb 1, 2018
In the upcoming release default (simplified) pylint rules exclude formatting and styling so it won't be complaining about tab sizes, see #554. However, we do not want to tie linter rules to edit settings since it would be inconsistent with behavior of other languages and editors.