Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support options from pydocstyle 6.2.0 and 6.3.0 #48

Merged
merged 3 commits into from Jan 21, 2023

Conversation

NMertsch
Copy link

@NMertsch NMertsch commented Jan 19, 2023

What's new

Implementation details

  • Help messages were copied from pydocstyle.
  • The pydocstyle version is checked, the options are only added to the CLI and passed to pydocstyle if the version supports it (previously: try-catch construct to check if --ignore-noqa from pydocstyle 6.0.0 is available).

How to test

Example file code.py:

"""This is my module."""
from functools import cached_property


class MyClass:
    """This is my class."""

    def __init__(self):
        # missing docstring, raises D107 unless '--ignore-self-only-init' is set
        pass

    @property
    def my_property(self) -> str:
        """This is my property."""
        # non-imperative docstring, raises D401 if 'property' is not in '--property-decorators'
        return "property"

    @cached_property
    def my_cached_property(self) -> str:
        """This is my cached property."""
        # non-imperative docstring, raises D401 if 'cached_property' is not in '--property-decorators'
        return "cached_property"

Addendum

Suggested HISTORY.rst entries for the next release:

- Add ``--ignore-self-only-init`` option to suppress D107 ("missing method
  docstring") if ``__init__`` has no parameters other than ``self``.
  (Requires pydocstyle >= 6.3.0)

- Add ``--property-decorators`` option to suppress D401 ("not in imperative
  mood") for docstrings of properties, defaulting to ``property``,
  ``cached_property``, and ``functools.cached_property``.
  (Requires pydocstyle >= 6.2.0)

self.source,
self.filename,
ignore_decorators=self.ignore_decorators,
**check_source_kwargs,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for using kwargs here. pydocstyle has had a bunch of issues with other integrations using positional args

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants