
- Enforce Google-style docstrings in pre-commit hooks: - Add pydocstyle, pydoclint, and interrogate to Pipenv and pre-commit - Configure pydocstyle for PEP 257 and Google-style compliance - Set pydoclint to enforce function signature correctness - Ensure 100% function and class docstring coverage with interrogate: - There are some exceptions, e.g. init, module-level. - More exceptions can be added if the tooling is found to be too strict. - Refine Black hook ordering to ensure all hooks run on formatted files: - Fail commit if formatting is needed (--check) - Auto-format files in a separate step - Prevent bypassing docstring checks by staging unformatted files - Ensure return type consistency (DOC203 best practices): - Require both return type hints (-> type) and docstring return types - Explain rationale for requiring both: - Type hints help with static analysis and runtime type checking - Docstring return types improve readability and documentation clarity - Pre-commit hooks validate consistency across both formats - Update pre-commit hooks to explicitly check for this requirement - Restructure pre-commit and linting configuration: - Move .pydocstyle.ini, .flake8, and pyproject.toml to the root - Update pre-commit hooks to reference these configs in the new structure - Modify tox.ini to prevent packaging errors and improve workflow: - Add `skipsdist = True` to disable setuptools packaging - Set `usedevelop = False` to prevent unintended package installation - Ensure `tox` only runs documentation and linting tasks - Aligns with StarlingX repository standards and prevents conflicts - Retain the pre-commit/ directory for potential future hooks - Update documentation and improve contributor guidance: - Add CONTRIBUTING.rst with detailed contribution guidelines - Create contributors.rst in doc/source for Sphinx-rendered docs - Link contributors.rst in index.rst for visibility in generated docs - Ensure contributing.rst references the latest CONTRIBUTING.rst - Document VSCode and PyCharm auto-doc settings in CONTRIBUTING.rst This commit ensures consistent docstring enforcement, improves pre-commit integration, aligns with best practices, and enhances contributor documentation. Change-Id: Iba282c20502adb81a7739ec6c3ed8b6f3bc45077 Signed-off-by: Andrew Vaillancourt <andrew.vaillancourt@windriver.com>
14 lines
541 B
INI
14 lines
541 B
INI
[flake8]
|
||
max-doc-length = 200
|
||
ignore = E203, E266, E501, W503, W605, DOC301
|
||
disable-docstring-checking = true
|
||
|
||
# Error Codes
|
||
# https://pep8.readthedocs.io/en/release-1.7.x/intro.html#error-codes
|
||
# E203 - "space before :" (needed for Black)
|
||
# E266 - too many leading ‘#’ for block comment
|
||
# E501 - line too long
|
||
# W503 - line break before binary operator
|
||
# W605 - invalid escape sequence-- needed for regular expressions
|
||
# DOC301 - Allows `__init__()` to have its own docstring instead of forcing it to be merged with the class docstring
|