如何解决 flake8 错误"D205: 1 blank line required between summary line and description"?



我正试图使用flake8(pydocstyle(来检查我的文档字符串的质量,但我收到了以下错误:

D205:汇总行和描述之间需要1个空行这就是我的代码的样子示例:

def func(
self,
source: str,
) -> str:
"""
Generates an sql query for a temporary table by searching 
the source code in the rules and restrictions table for these sources.
Args:
source: data source code
Returns:
sql query for creating a table
"""
sql = None

很难分开的长信息。且最大线路长度=100如何正确地将句子转移到另一行?还是在这种情况下更容易忽略错误?

我试着划分,但有点失去了意义。到目前为止只有

# noqa D205 1 blank line required between summary line and description

实际上,许多众所周知的包并没有通过flake8numpy中的所有规则。不要对自己那么苛刻。如果你真的想解决这个烦人的问题,这里有一些解决方案。

第一种解决方案:在"""之后添加摘要注释,并在摘要和描述之间添加一条空行。

def func(
self,
source: str,
) -> str:
"""Generate a sql query
Generates an sql query for a temporary table by searching
the source code in the rules and restrictions table for these sources.
summary
Args:
source: data source code
Returns:
sql query for creating a table
"""
sql = None

第二种解决方案:通过编辑.flake8来强制忽略D205

最新更新