跳到内容

first-word-uncapitalized (D403)

源自 pydocstyle 代码检查器。

修复总是可用的。

作用

检查文档字符串是否以大写字母开头。

为什么这不好?

文档字符串中的第一个非空白字符应大写,以保证语法正确性和一致性。

示例

def average(values: list[float]) -> float:
    """return the mean of the given values."""

建议改为

def average(values: list[float]) -> float:
    """Return the mean of the given values."""

参考