Skip to content

bug: Don't conflate passed argument with class member (instance attribute) #357

@pawamoy

Description

@pawamoy

Description of the bug

In __init__ methods, when we do for example:

def __init__(self, arg: str) -> None:
    self.arg: str = arg
    """Description."""

Then Griffe thinks the arg value is the arg member, which it is not. It is an argument value, not a member of the current class.

This is annoying once docs are rendered, as the value will cross-reference to the member itself. The upcoming backlinks feature also suffers from it and will render a "used by" link pointing to itself.

Expected behavior

Griffe / mkdocstrings should not link such instance attribute values this way. I suppose it needs special casing somewhere 🤔

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtop-priorityAbsolute priority

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions