Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I'm using the pygame module on VSCode 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?

Thanks!

like image 330
Kyle Angelo Gonzales Avatar asked Dec 14 '22 07:12

Kyle Angelo Gonzales


2 Answers

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

like image 109
Benny Powers Avatar answered Dec 27 '22 11:12

Benny Powers


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.

like image 26
Kyle Angelo Gonzales Avatar answered Dec 27 '22 11:12

Kyle Angelo Gonzales