forked from microsoft/onnxruntime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add python docstring linting in vscode settings (microsoft#11316)
Add python docstring linting in vscode settings Use black and isort for python code formatting in VScode. Import sorting enabled on save. Code formatting available in VSCode with manual trigger. Adopted from pytorch https://github.com/pytorch/pytorch/blob/master/.vscode/settings_recommended.json
- Loading branch information
1 parent
532e253
commit 6fb29f5
Showing
7 changed files
with
106 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
// Always remove trailing whitespaces | ||
"files.trimTrailingWhitespace": true, | ||
"files.insertFinalNewline": true, | ||
"files.trimFinalNewlines": true, | ||
"editor.rulers": [ | ||
120 | ||
], | ||
"[python]": { | ||
"editor.tabSize": 4, | ||
// Auto sort imports | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": true | ||
}, | ||
}, | ||
// Enable Python linting and Pylance type checking | ||
"python.analysis.typeCheckingMode": "basic", | ||
"python.formatting.provider": "black", | ||
"python.formatting.blackArgs": [ | ||
"--line-length", | ||
"120" | ||
], | ||
"python.sortImports.args": [ | ||
"--profile", | ||
"black", | ||
"--line-length", | ||
"120" | ||
], | ||
"python.linting.enabled": true, | ||
"python.linting.flake8Enabled": true, | ||
"python.linting.pydocstyleEnabled": true, | ||
"python.linting.pydocstyleArgs": [ | ||
"--convention=google" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,14 @@ | ||
:: Copyright (c) Microsoft Corporation. All rights reserved. | ||
:: Licensed under the MIT License. | ||
|
||
:: Before running this, please make sure python.exe is in path, and yapf is installed like the following | ||
:: pip install --upgrade yapf | ||
:: Before running this, please make sure python.exe is in path, and black is installed like the following | ||
:: pip install --upgrade black isort | ||
|
||
:: If you use Visual Studio Code, you can configure like the following: | ||
:: "python.formatting.provider": "yapf" | ||
:: "python.formatting.yapfArgs": ["--style", "{based_on_style: pep8, column_limit: 120}"] | ||
:: See https://code.visualstudio.com/docs/python/editing for more info | ||
:: For more info about black, see https://github.com/psf/black | ||
|
||
:: The style configuration file is .style.yapf in current directory. | ||
python -m isort ./python | ||
python -m isort ./test | ||
python -m black ./python | ||
python -m black ./test | ||
|
||
:: You can setup git pre-commit hook following https://github.com/google/yapf/tree/master/plugins. | ||
|
||
:: For more info about YAPF, see https://github.com/google/yapf | ||
|
||
yapf -ir ./python | ||
yapf -ir ./test | ||
|
||
if errorlevel 1 echo please install python, then pip install yapf | ||
if errorlevel 1 echo please install python, then pip install --upgrade black isort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[tool.black] | ||
line-length = 120 | ||
|
||
[tool.isort] | ||
profile = "black" | ||
line_length = 120 | ||
|
||
[tool.pydocstyle] | ||
convention = "google" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters