Linux command
pydocstyle 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Check docstrings
pydocstyle [module.py]
Check directory
pydocstyle [src/]
Select conventions
pydocstyle --convention [google] [module.py]
Ignore specific errors
pydocstyle --ignore [D100,D101] [module.py]
Select specific errors
pydocstyle --select [D200,D201] [module.py]
Show source
pydocstyle --source [module.py]
Count errors only
pydocstyle --count [module.py]
说明
pydocstyle checks Python docstring conventions. It enforces consistent documentation style. Conventions define expected format. PEP 257, NumPy, and Google styles are supported. Error codes identify specific issues. D100 series for modules, D200 for formatting, etc. Source display shows problematic code. Helps identify and fix issues quickly. Configuration files set project defaults. pyproject.toml and setup.cfg supported.
参数
- --convention _NAME_
- Convention (pep257, numpy, google).
- --ignore _CODES_
- Errors to ignore.
- --select _CODES_
- Errors to check.
- --source
- Show source code.
- --explain
- Explain errors.
- --count
- Count only.
- --match _PATTERN_
- Only check files whose names match the regular expression _PATTERN_ (default: `(?!test_).*\.py`).
- --match-dir _PATTERN_
- Only recurse into directories whose names match the regular expression _PATTERN_ (default: `^\..*`).
- --add-ignore _CODES_
- Add codes to the existing ignore list (does not replace).
- --add-select _CODES_
- Add codes to the existing select list (does not replace).
- --config _FILE_
- Use the specified configuration file instead of auto-discovery.
- -d, --debug
- Print debug information.
- -v, --verbose
- Print status information during run.
FAQ
What is the pydocstyle command used for?
pydocstyle checks Python docstring conventions. It enforces consistent documentation style. Conventions define expected format. PEP 257, NumPy, and Google styles are supported. Error codes identify specific issues. D100 series for modules, D200 for formatting, etc. Source display shows problematic code. Helps identify and fix issues quickly. Configuration files set project defaults. pyproject.toml and setup.cfg supported.
How do I run a basic pydocstyle example?
Run `pydocstyle [module.py]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --convention _NAME_ do in pydocstyle?
Convention (pep257, numpy, google).