8

I have a python project that many of the functions and classes missing docstrings. I know that PyCharm can automatically add docstrings by the Insert documentation string stub command using intention action. However, for large number of methods and functions, it is tedious. Is there a method to bulk add docstrings to all the functions at once? then I will fill what is necessary manually.

If not in PyCharm, Is there any alternative client that can do it?

Thanks in advance for helps...

1 Answer 1

14

Finally, I found an answer, or may be a workaround

In pyCharm,

  1. goto File\Settings\Code Style\Inspections then put a tick in front of 'Missing or empty docstring' Then press OK button.
  2. goto Code\Inspect Code\ then select Custom scope>>Open Files
  3. You will find a panel below with your project's name, then Python\Missing or empty docstring\
  4. Right click on the title "Missing or empty docstring", and select the command {Apply fix 'Fix docstring'}
  5. The program will automatically add docsrtings to all functions, and classes.

This works for me, If anyone have better solution or workaround, so please share it with us. enter image description here

1
  • work in IntelliJ Idea 2018.1 ,but【Inspect Code】 in 【Analyze】 Commented Jan 11, 2019 at 6:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.