Pycodestyle: Add support for class attribute checking [google]

Created on 31 Jul 2020  路  3Comments  路  Source: PyCQA/pycodestyle

This is a feature request to add a check for class level attribute documentation.

As described in the google style guide:

If your class has public attributes, they should be documented here in an Attributes section and follow the same formatting as a function鈥檚 Args section.

class SampleClass:
    """Summary of class here.

    Longer class information....
    Longer class information....

    Attributes:
        likes_spam: A boolean indicating if we like SPAM or not.
        eggs: An integer count of the eggs we have laid.
    """

    def __init__(self, likes_spam=False):
        """Inits SampleClass with blah."""
        self.likes_spam = likes_spam
        self.eggs = 0

    def public_method(self):
        """Performs operation blah."""

Most helpful comment

Wow, I totally meant to post this there. Sorry! It's been a long day...

All 3 comments

this doesn't really fit with pycodestyle (which is mostly about whitespace issues) -- perhaps pydocstyle is a better place?

Wow, I totally meant to post this there. Sorry! It's been a long day...

I swear, Guido threatening his lawsuit over using pep* names has confused me endlessly with the new package names

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rharish101 picture rharish101  路  3Comments

Nyrio picture Nyrio  路  4Comments

ZeeD26 picture ZeeD26  路  5Comments

asergi picture asergi  路  9Comments

glyph picture glyph  路  3Comments