与其他一些flake8扩展相反(例如:flake8-rst-docstrings
),flake8-rst-docstrings
和flake8-black
输出代码带有3个字母字符而不是1(RST299
和BLK100
vs D204
),这似乎阻止了vscode-python
在vscode
的问题选项卡中显示这些条目。
对于以下代码段:
from collections import \
namedtuple, \
deque
class ControlAlgoCoreSimpleSlots:
"""My non pydocstring compliant
summary which should make `flake8-docstrings` bark.
Here's some markdown code block (non valid sphinx syntax
which should make `flake8-rst-docstrings` bark.
```
def my_blocking_closure_fn():
return long_blocking_call_on(my_argument_data)
return self.make_blocking_job(my_blocking_closure_fn)
```
"""
pass
flake8报道:
$ flake8 '--format=%(row)d,%(col)d,%(code).1s,%(code)s:%(text)s' ./mymodule.py
1,1,F,F401:'collections.namedtuple' imported but unused
1,1,F,F401:'collections.deque' imported but unused
1,1,D,D100:Missing docstring in public module
1,25,B,BLK100:Black would make changes.
5,1,E,E302:expected 2 blank lines, found 1
6,1,D,D204:1 blank line required after class docstring
6,1,D,D205:1 blank line required between summary line and description
6,1,D,D400:First line should end with a period
12,1,R,RST299:Inline literal start-string without end-string.
14,1,R,RST301:Unexpected indentation.
15,1,R,RST201:Block quote ends without a blank line; unexpected unindent.
15,1,R,RST299:Inline literal start-string without end-string.
15,1,R,RST299:Inline interpreted text or phrase reference start-string without end-string.
而vscode缺少RST
和BLK
条目。请参考vscode-python/issues/4074获取vscode输出的图像,因为我不允许在此处发布。
我礼貌地报告vscode-python/issues/4074在vscode-python
,然而这个d3r3kk家伙立即突然关闭了flake8 linting documentation for vscode的问题,没有任何具体的解决方案来解决我的问题。
任何人都可以帮我设置vscode-python,以便我可以获得所有的linter条目,包括来自flake8-rst-docstrings
和flake8-black
的条目?
你对https://github.com/Microsoft/vscode-python/issues/4074绝对正确 - 这是vscode中的一个错误,你的修复看起来很合理。我也在那里评论过。
较长的代码反映了flake8 v3,http://flake8.pycqa.org/en/latest/plugin-development/registering-plugins.html的变化
请注意:您的入口点不需要与Flake8 3.0完全相同。考虑使用带有3个字母后跟3个数字的入口点(即ABC123)。
单个字母和三个数字的原始约定导致了许多flake8插件代码冲突。
披露:flake8-rst-docstrings
和flake8-black
的作者 - 感谢您的尝试! https://github.com/peterjc/flake8-rst-docstrings https://github.com/peterjc/flake8-black