Skip to content

D406 removes colons where D416 adds them #13139

@maxschulz-COL

Description

@maxschulz-COL
  • List of keywords you searched for before creating this issue. Write them down here so that others can find this issue more easily and help provide feedback.

"section-name-ends-in-colon", "D416", "removed", "autofix"

  • A minimal code snippet that reproduces the bug.
    Ruff seems to auto-fix
def foo(a: str) -> str:
    """Foo bar.

    Args:
        a: Some argument.

    Examples
        Some explanation here.
        >>> bla bla bla

    """
    return a

to

def foo(a: str) -> str:
    """Foo bar.

    Args:
        a: Some argument.

    Examples:
        Some explanation here.
        >>> bla bla bla

    """
    return a

, but it changes (in my eyes erroneously?):

def foo(a: str) -> str:
    """Foo bar.

    Examples:
        Some explanation here.
        >>> bla bla bla

    """
    return a

to

def foo(a: str) -> str:
    """Foo bar.

    Examples
        Some explanation here.
        >>> bla bla bla

    """
    return a

Should this be the case?

  • The command you invoked (e.g., ruff /path/to/file.py --fix), ideally including the --isolated flag.
    Any ruff command with autofix

  • The current Ruff settings (any relevant sections from your pyproject.toml).

[tool.ruff]
line-length = 120
target-version = "py38"

[tool.ruff.lint]
# see: https://beta.ruff.rs/docs/rules/
ignore = [
  "D104",  # undocumented-public-package
  "D401",  # first-line should be in imperative mood
  # D407 needs to be ignored as it otherwise messes up the formatting in our API docs
  "D407"  # missing dashed underline after section
]
ignore-init-module-imports = true  # TODO: remove as deprecated soon
select = [
  "E",  # pycodestyle errors
  "W",  # pycodestyle warnings
  "F",  # pyflakes
  "I",  # isort
  "D",  # pydocstyle
  "T201",  # print
  "C4",  # flake8-comprehensions
  "RUF",  # Ruff-specific rules
  "PL"  # pylint
]
  • The current Ruff version (ruff --version).
    0.6.2

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdocstringRelated to docstring linting or formatting

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions