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

标签 python visual-studio-code flake8

与其他一些 flake8 扩展(例如:flake8-rst-docstrings)相反,flake8-rst-docstringsflake8-black 输出使用 3 个字母字符而不是 1 个字母字符的代码(RST299BLK100D204),这似乎阻止了 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 输出的图像,因为我不允许将其发布到此处。

我礼貌举报vscode-python/issues/4074vscode-python 上,然而这个 d3r3kk 家伙立即突然关闭了提到 flake8 linting documentation for vscode 的问题。没有任何具体的解决方案来解决我的问题。

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

最佳答案

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

较长的代码反射(reflect)了 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

关于python - 如何确保 vscode-python 正确显示来自 `flake8-rst-docstrings` 和/或 `flake8-black` flake8 扩展的 linter 条目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54318303/

相关文章:

python - 使用 SQL 查询填充 WTForms SelectField

visual-studio-code - Visual Studio Code 无法识别内置的 typescript 定义文件

python - 忽略文件夹的特定 flake8 规则

python - Flake8 无法在自定义格式化程序上加载插件 "N8"

python - 如何正确换行 django 语句以满足 flake8 的要求?

python - Python 中的对数不准确

python - pip install中 "Failed building wheel for X"是什么意思?

python (1040, 'Too many connections')

node.js - 从 VS Code 将 NodeJS 应用部署到 Azure

javascript - Javascript 类型的 VSCode 扩展