How do you fix "Missing module docstringpylint(missing-module-docstring)"

Question:

I’m using the pygame module on VS Code and I ran into the issue where the pygame has not init member. I followed the solutions to this link. I edited the user settings and added

"python.linting.pylintArgs": [
    "--extension-pkg-whitelist=pygame",
    "--unsafe-load-any-extension=y"
]

to the end of the json file

The pygame problem was resolved. However, when I use import random. I get this warning:

Missing module docstringpylint(missing-module-docstring)

How do I make it go away? Also, is there a better way to resolve the init problem of pygame?

Answers:

I just figured out what docstrings are. They just describe the function or class. It’s enclosed in three double quotation marks or single quotation marks. This helped me.

To remove docstring warnings in VSCode, I just added "--disable=C0111" to "python.linting.pylintArgs": [], which was in the User’s JSON settings.

A python module’s docstring documents what the contents of that file are for.

You can solve this error by adding a docstring at the top of the module:

"""
Provides some arithmetic functions
"""

def add(a, b):
  """Add two numbers"""
  return a + b

def mult(a, b): 
  """Multiply two numbers"""
  return a * b

Read more at https://www.python.org/dev/peps/pep-0257/#multi-line-docstrings

Answered By: Benny Powers

This error is coming out when we are using pylint in the directory that doesn’t have .pylintrc. Go to directory which has .pylintrc and run from there.

Example:

test/
test1.py
test2/test2.py
.pylintrc

If you want to run pylint for test2.py inside test/test2 then you will get that error.

test/test2$ pylint test2.py  is wrong.

test$ pylint test2.py is correct.

I added the settings below in VsCode to disable all the docstring warnings.

"python.linting.pylintArgs": [
  "--disable=missing-module-docstring",
  "--disable=missing-class-docstring",
  "--disable=missing-function-docstring"
]
Answered By: ikhvjs