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 should a docstring at the beginning of it. Can i disable this somehow? I would like to be notified of a docstring is missing inside a class, function or method but it shouldn't be mandatory for a file to have a docstring.
(Is there a term of the legal jargon often found at the beginning of a proprietary source file? Any examples? I don't know whether it is a okay to post such a trivial question separately.)
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:
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:
With pylint 2.4 and above you can differentiate between the various
missing-docstring
by using the three following sub-messages:C0114
(missing-module-docstring
)C0115
(missing-class-docstring
)C0116
(missing-function-docstring
)So the following
.pylintrc
file should work: