[英]Visual Studio Code Python extension: None of the default / built-in modules working (pylint, autopep8, etc)
[英]Visual Studio code with PyLint and autoPep8: How can I avoid PyLint to complain about my line length?
我最近切換到 Visual Studio Code,我不得不說到目前為止我很喜歡它。
我正在開發一個 Python 項目,其中包括 pip 包pylint
和autopep8
,我配置了 VSCode 以根據這些包格式化代碼。
唯一的問題是:在 Python 項目中,我正在處理的行長度為 100。所以我的所有代碼如下所示:
錯誤說: E501:line too long (97 > 79 characters)
。 這是我的 VSCode 設置:
{
"python.pythonPath": "~/.envs/myProject/bin/python",
"python.linting.pep8Enabled": true,
"python.linting.pylintPath": "~/.envs/myProject/bin/pylint",
"python.linting.pylintArgs": ["--load-plugins", "pylint_django", "--max-line-length=100"],
"python.formatting.autopep8Args": ["--max-line-length=100"],
"python.linting.pylintEnabled": true,
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
".vscode": true,
"**/*.pyc": true
}
}
這些設置至少現在確保保存時的格式將行保持在最大 100 行,並且不會將我的所有文件行都包裝到 79 行。如果沒有警告,它仍然會很棒。
如何禁用這些 linter 警告?
我最近改用了Visual Studio Code,到目前為止,我不得不說我很喜歡它。
我正在研究一個Python項目,其中包括pip包pylint
和autopep8
並且我配置了VSCode以根據這些包格式化代碼。
唯一的問題是:在Python項目中,我正在處理的行長是100。所以我的所有代碼如下所示:
錯誤消息: E501:line too long (97 > 79 characters)
。 這是我的VSCode設置:
{
"python.pythonPath": "~/.envs/myProject/bin/python",
"python.linting.pep8Enabled": true,
"python.linting.pylintPath": "~/.envs/myProject/bin/pylint",
"python.linting.pylintArgs": ["--load-plugins", "pylint_django", "--max-line-length=100"],
"python.formatting.autopep8Args": ["--max-line-length=100"],
"python.linting.pylintEnabled": true,
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
".vscode": true,
"**/*.pyc": true
}
}
這些設置至少現在可以確保保存時的格式將行數保持在100個最大值,並且不會將我的所有文件行都換成79行。如果沒有警告,那還是很棒的。
如何禁用這些短毛貓警告?
我最近改用了Visual Studio Code,到目前為止,我不得不說我很喜歡它。
我正在研究一個Python項目,其中包括pip包pylint
和autopep8
並且我配置了VSCode以根據這些包格式化代碼。
唯一的問題是:在Python項目中,我正在處理的行長是100。所以我的所有代碼如下所示:
錯誤消息: E501:line too long (97 > 79 characters)
。 這是我的VSCode設置:
{
"python.pythonPath": "~/.envs/myProject/bin/python",
"python.linting.pep8Enabled": true,
"python.linting.pylintPath": "~/.envs/myProject/bin/pylint",
"python.linting.pylintArgs": ["--load-plugins", "pylint_django", "--max-line-length=100"],
"python.formatting.autopep8Args": ["--max-line-length=100"],
"python.linting.pylintEnabled": true,
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
".vscode": true,
"**/*.pyc": true
}
}
這些設置至少現在可以確保保存時的格式將行數保持在100個最大值,並且不會將我的所有文件行都換成79行。如果沒有警告,那還是很棒的。
如何禁用這些短毛貓警告?
我最近改用了Visual Studio Code,到目前為止,我不得不說我很喜歡它。
我正在研究一個Python項目,其中包括pip包pylint
和autopep8
並且我配置了VSCode以根據這些包格式化代碼。
唯一的問題是:在Python項目中,我正在處理的行長是100。所以我的所有代碼如下所示:
錯誤消息: E501:line too long (97 > 79 characters)
。 這是我的VSCode設置:
{
"python.pythonPath": "~/.envs/myProject/bin/python",
"python.linting.pep8Enabled": true,
"python.linting.pylintPath": "~/.envs/myProject/bin/pylint",
"python.linting.pylintArgs": ["--load-plugins", "pylint_django", "--max-line-length=100"],
"python.formatting.autopep8Args": ["--max-line-length=100"],
"python.linting.pylintEnabled": true,
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
".vscode": true,
"**/*.pyc": true
}
}
這些設置至少現在可以確保保存時的格式將行數保持在100個最大值,並且不會將我的所有文件行都換成79行。如果沒有警告,那還是很棒的。
如何禁用這些短毛貓警告?
對我來說,以下工作有效。 (VSCode 版本 == 1.41.1)
前往設置。
搜索“pylint”。
向下滾動到“Python > Linting:Pycodestyle Args”
點擊“添加項目”
輸入,“python.linting.pep8Args”:[“--max-line-length=200”]
將 max-line-length 調整為您想要的長度。
截至 2021 年( Pylint 參考),將其添加到您的.vscode/settings.json
文件中:
"python.linting.pylintArgs": ["--max-line-length=100"]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.