Skip to content

verifytypes: Missing docstring not reported for classes and methods from publicly exported classes in private modules #6758

@jakkdl

Description

@jakkdl

Describe the bug
pyright --verifytypes does not give warnings for missing docstrings in classes or class methods in private modules, even if they are publicly exported in an __init__.py file. Classes in public modules, and functions in private modules, both get warnings reported.

Noticed it when authoring python-trio/trio#2898

Code or Screenshots
test_pkg/__init__.py

from .foo import Foo as Foo
from ._bar import Bar as Bar, barfun as barfun

test_pkg/foo.py

class Foo:
    ...

test_pkg/bar.py

class Bar:
    def bar(self) -> None:
        ...

def barfun(param: str) -> None:
    ...

output:

$ pyright --verifytypes test_pkg --verbose
Module name: "test_pkg"
[...]

Public modules: 2
   test_pkg
   test_pkg.foo

Exported symbols: 5
   test_pkg.foo
   test_pkg.foo.Foo (3 references)
   test_pkg.Foo
   test_pkg.Bar
   test_pkg.barfun

Other referenced symbols: 3
   foo
   test_pkg._bar.Bar
   test_pkg._bar.Bar.bar

Symbols used in public interface:
test_pkg.foo.Foo
   warning: No docstring found for class "test_pkg.foo.Foo"
test_pkg.barfun
  [...]/test_pkg/_bar.py:2:41 - warning: No docstring found for function "test_pkg.barfun"

Symbols exported by "test_pkg": 5
  With known type: 5
  With ambiguous type: 0
  With unknown type: 0
  Functions without docstring: 1
  Functions without default param: 0
  Classes without docstring: 1

Other symbols referenced but not exported by "test_pkg": 3
  With known type: 3
  With ambiguous type: 0
  With unknown type: 0

Type completeness score: 100%

Completed in 0.191sec

The two warnings are correct, but I expected an additional two warnings - one for test_pkg.Bar and one for test_pkg.Bar.bar

VS Code extension or command-line
Command line, version 1.1.341

Metadata

Metadata

Assignees

No one assigned

    Labels

    addressed in next versionIssue is fixed and will appear in next published versionbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions