1

With coverage it's possible to disable coverage in lines that match a pattern by adding the "exclude_lines" flag to the configuration file:

[report]
exclude_lines =
    pragma: no cover
    if TYPE_CHECKING:

I was wondering if the same thing is possible with pylint. I'm doing a project in django and many classes have a very small, inner "Meta" class that is not worth documenting, yet I keep getting the missing-docstring error on each of them:

class MyForm(forms.ModelForm):
    """ Docstring """

    class Meta:  # pylint: disable = missing-docstring
        model = MyModel

So far I've been adding a # pylint: disable: missing-docstring directive in each of them, but this is a bit tiring and prone to error, so I was hoping a better solution, similar to coverage's, exists. Does it?

drakenation
  • 382
  • 3
  • 15
  • It's an interesting question, but I doubt it's possible. It could be an interesting feature though. -- But considering your exact use case: I would recommend renaming those inner classes to something like `_Meta`. _Pylint_ would consider the class as _private_ and would not bother checking if there is a docstring. – sinoroc Jul 23 '20 at 14:23

0 Answers0