与其他一些flake8扩展(例如:flake8-rst-docstrings
)相反,flake8-rst-docstrings
和flake8-black
输出代码有3个字母字符,而不是1 (RST299
和BLK100
与D204
),这似乎阻止vscode-python
在vscode
的PROBLEMS选项卡中显示这些条目。
对于以下代码段:
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
上报道了vscode-python
,然而,这个d3r3kk的家伙却突然解决了这个问题,没有具体解决我的问题。
有人能帮我设置vscode-python,这样我就可以获得所有的linter条目,包括来自flake8-rst-docstrings
和flake8-black
的链接条目吗?
发布于 2019-02-19 16:27:29
您对https://github.com/Microsoft/vscode-python/issues/4074完全正确--这是vscode中的一个bug,而且您的修复看起来是明智的。我也在那评论过。
较长的代码反映了flake8 v3,http://flake8.pycqa.org/en/latest/plugin-development/registering-plugins.html的变化。
请注意:在Flake8 3.0中,您的入口点不需要精确为4个字符。考虑使用一个入口点,其中有3个字母,后面跟着3个数字(即ABC123 )。
最初的一个字母和三个数字的约定导致了许多flake8插件代码的冲突。
信息披露:“flake8-rst-docstrings
和flake8-black
”的作者-感谢您的尝试!https://github.com/peterjc/flake8-rst-docstrings https://github.com/peterjc/flake8-black
https://stackoverflow.com/questions/54318303
复制相似问题