How do I disable “missing docstring” warnings at a file-level in Pylint?

前端 未结 11 718
情书的邮戳
情书的邮戳 2020-12-12 14:18

Pylint throws errors that some of files are missing docstrings. I try and add docstrings to each class, method and function but it seems that Pylint also checks that files s

11条回答
  •  情话喂你
    2020-12-12 14:37

    I came looking for an answer because, as @cerin said, in Django projects it is cumbersome and redundant to add module docstrings to every one of the files that django automatically generates when creating a new app.

    So, as a workaround for the fact that pylint doesn't let you specify a difference in docstring types, you can do this:

    pylint */*.py --msg-template='{path}: {C}:{line:3d},{column:2d}: {msg}' | grep docstring | grep -v module
    

    You have to update the msg-template so that when you grep you will still know the file name. This returns all the other missing-docstring types excluding modules.

    Then you can fix all of those errors, and afterwards just run:

    pylint */*.py --disable=missing-docstring
    

提交回复
热议问题