Docstring Rule in Sonarcloud

Docstrings Rule only analyzes class names and functions defined outside of the class. However, for methods defined within the class itself, it doesn’t raise an issue if the docstring is not written. Is this an expected behavior?

# no issue raised - okay
def outer_func_with_doc():
    """some docstring"""
    print("do something")

# issue raised - okay
def outer_func():
    print("do something")

# issue raised for undocumented class - okay
class SampleWorld:
    # issue not raised here?
    def __init__(self):

     # issue not raised here?
    def func1(self):
        print("do something")

Hello @weichunnn and sorry for the late answer.

Indeed, the rule implementation explicitly excludes raising issues on method, which contradicts the rule specification (issues should be raised on methods as well).

Thank you for reporting this inconsistency! I created SONARPY-1254 to address it.