如何确保vscode-python正确显示来自`flake8-rst-docstrings`和/或`flake8-black` flake8扩展名的linter条目?

时间:2019-01-23 00:16:49

标签: python visual-studio-code flake8

与其他flake8扩展名(例如:flake8-rst-docstringsflake8-rst-docstringsflake8-black相反,它们的输出代码是3个字母字符,而不是1个字符(RST299和{{1 }}与BLK100)似乎阻止了D204vscode-python问题标签中显示这些条目。

对于以下代码段:

vscode

flake8报告:

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

vscode缺少$ 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. RST条目。请参见vscode-python/issues/4074,以获取vscode输出的图像,因为我不允许在此处发布它。

我在BLK上有礼貌地报告了vscode-python/issues/4074,但是这个d3r3kk家伙立即并突然关闭了涉及flake8 linting documentation for vscode的问题,而没有对我的问题的任何具体解决方案。

任何人都可以帮助我设置vscode-python以便我可以获取所有的linter条目,包括来自vscode-pythonflake8-rst-docstrings的linter条目吗?

1 个答案:

答案 0 :(得分:0)

您对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开始,您的输入点不必完全是4个字符。考虑使用一个包含3个字母和3个数字(即ABC123)的入口点。

一个字母和三个数字的原始约定导致了许多flake8插件代码冲突。

披露:flake8-rst-docstringsflake8-black的作者-感谢您的尝试! https://github.com/peterjc/flake8-rst-docstrings https://github.com/peterjc/flake8-black