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

How to make sure vscode-python properly display linter entries from `flake8-rst-docstrings` and/or `flake8-black` flake8 extensions?

与其他一些 flake8 扩展(例如:flake8-rst-docstrings)相反,flake8-rst-docstringsflake8-black 输出代码具有 3 个字母字符而不是 1 个(RST299BLK100 vs D204) 这似乎阻止了 vscode-pythonvscodePROBLEMS 选项卡中显示这些条目。

对于以下片段:

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

我在 vscode-python 上礼貌地报告了 vscode-python/issues/4074,但是这个 d3r3kk 家伙立即并突然关闭了这个问题,参考了 vscode[=45= 的 flake8 linting 文档] 对我的问题没有任何具体的解决方案。

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

您对 https://github.com/Microsoft/vscode-python/issues/4074 的看法完全正确 - 这是 vscode 中的错误,您的修复看起来很合理。我也在那里评论过。

较长的代码反映了 flake8 v3 的变化,http://flake8.pycqa.org/en/latest/plugin-development/registering-plugins.html

Please Note: Your entry point does not need to be exactly 4 characters as of Flake8 3.0. Consider using an entry point with 3 letters followed by 3 numbers (i.e. ABC123 ).

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

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