Skip to content

[πŸš€ Feature]: [py] add ruff formatting rules for python docstringsΒ #16432

@iampopovich

Description

@iampopovich

Description

relates to #11442

Once all existing docstrings are formatted according to Google Codestyle, a configuration should be added for regular formatting of new code.

ruff config example for pyproject.toml

[tool.ruff.lint]
extend-select = ["D", "E4", "E7", "E9", "F", "I", "E501", "RUF022", "TID252"]
fixable = ["ALL"]

extend-ignore = [
    "D103", # Missing docstring in public function
    "D102", # Missing docstring in public method
    "D100", # Missing docstring in public module
    "D205", # 1 blank line required between summary line and description
    "D107", # Missing docstring in `__init__`
    "D101", # Missing docstring in public class
    "D104", # Missing docstring in public package
    "D209", # Multi-line docstring closing quotes should be on a separate line
    "D202", # No blank lines allowed after function docstring (found 1)
    "D105", # Missing docstring in magic method
    "D415", # First line should end with a period, question mark, or exclamation point
    "D212", # Multi-line docstring summary should start at the first line
    "D200", # One-line docstring should fit on one line
    "D411", # Missing blank line before section ("Example")
    "D301", # Use `r"""` if any backslashes in a docstring
    "D412", # No blank lines allowed between a section header and its content ("Example")
    "D410", # Missing blank line after section ("Example")
    "D419", # Docstring is empty
    "D417", # Missing argument descriptions in the docstring for `__init__`: `duration`, `source`
    "D416", # Section name should end with a colon ("Returns")
]

[tool.ruff.lint.pydocstyle]
convention = "google"

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-pyPython BindingsI-enhancementSomething could be better

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions