Skip to content

False D417 when arguments some are keyword only. #4047

@AlexGiazitzis

Description

@AlexGiazitzis

Running the command ruff .\file.py containing the snippet below, shows a D417 warning whilst all arguments are documented. If the Args section and all members of it is removed, the warning goes away, whilst arg1 is not documented. I've attached screenshots for each occasion. With the --isolated flag, no warning is emitted in both cases.

ruff --version output: ruff 0.0.262

def func(arg1, *, arg2, arg3):
    """Do something.

    Args:
        arg1 (type): description

    Keyword Args:
        arg2 (type): description
        arg3 (type): description

    """
    ...

Screenshot 2023-04-20 171734

Screenshot 2023-04-20 172433

pyproject.toml

[tool.ruff]
line-length = 120
select = ["D", "E", "F"]
target-version = "py38"

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

[tool.ruff.per-file-ignores]
"__init__.py" = ["F401"]

[tool.black]
line-length = 120
target-version = ['py38']
include = '''
(
      \.pyi?$
    | \.py?$
    | ^/tests/
    | ^/src/
)
'''
exclude = '''
(
  /(
      \.eggs         # exclude a few common directories in the
    | \.git          # root of the project
    | \.hg
    | \.mypy_cache
    | \.tox
    | \.venv
    | _build
    | __pycache__
    | buck-out
    | build
    | dist
    | .*/migrations
    | \.github
    | ci
    | node_modules
    | static
    | staticfiles
  )/
  | \.html
  | \.js
  | \.css
  | \.scss
)
'''

Metadata

Metadata

Assignees

No one assigned

    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