仅执行模块文档字符串?

时间:2019-06-27 19:12:57

标签: python pylint

我想逐步将文档添加到我的项目中。我的第一个想法是运行pylint projectname --disable=all --enable=missing-docstring,但事实证明,它强制执行所有类型的文档字符串,而不仅仅是模块文档字符串。有办法调整吗?

1 个答案:

答案 0 :(得分:0)

pip install flake8_docstrings

在撰写此问题时,似乎pylint doesn't yet have that。可以通过安装flake8_docstrings flake8模块来添加这种强制措施,该模块引入了许多细粒度的警告,例如:

D100 Missing docstring in public module
D101 Missing docstring in public class
D102 Missing docstring in public method
D103 Missing docstring in public function
D104 Missing docstring in public package
D105 Missing docstring in magic method
D107 Missing docstring in __init__
D205 1 blank line required between summary line and description
D209 Multi-line docstring closing quotes should be on a separate line
D400 First line should end with a period
D401 First line should be in imperative mood