Skip to content

Python - Commented function/class definition causes incorrect docstring placement #221

@zenoix

Description

@zenoix

Running Neogen on a function or class definition with a comment at the end of the line causes the docstring to be placed incorrectly. It seems to place the docstring above the definition and horizontally aligned with the comment.

Function example:

                    """[TODO:description]

                    Args:
                        x ([TODO:parameter]): [TODO:description]

                    Returns:
                        [TODO:return]
                    """
def foo(x) -> int:  # noqa: ANN001
    return x

Class example:

            """[TODO:description]"""
class Foo:  # noqa: D101
    ...

This is pretty annoying especially when adding linting ignore rules as shown in the examples.

  • Neogen version: 2.20.0
  • Neovim version: v0.11.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions