Skip to content

Ruff runs all pydocstyle rules when the convention is specified in the config toml files #3684

@felix-cw

Description

@felix-cw

This behaviour is new in 0.0.258

When running ruff with the --select option in a folder with a pyproject.toml or ruff.toml which specifies the pydocstyle convention,
ruff always runs all the pydocstyle rules.

Example:

# I want to check for unsorted imports
ruff check ruff_doc.py --select=I

ruff_doc.py

"""Useful mathematical functions."""


def add_numbers(number1, number2):
    """Add 2 numbers.

    Args:
        number1 (Number): first number
        number2 (Number): second number

    Returns:
        Number: result of addition
    """
    return number1 + number2

pyproject.toml

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

The result is

ruff_doc.py:5:5: D213 [*] Multi-line docstring summary should start at the second line
ruff_doc.py:5:5: D407 [*] Missing dashed underline after section ("Args")
ruff_doc.py:5:5: D407 [*] Missing dashed underline after section ("Returns")

I do not expect any output, as I didn't select D in my command, and these error codes should be turned off in the google convention.

This behaviour is particularly bad in e.g. VSCode with the organize imports functionality, as it also tries to fix all docstring issues in all the conventions, which results in more errors.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions