sphinx icon indicating copy to clipboard operation
sphinx copied to clipboard

remove 'follow-imports = skip" from mypy config

Open danieleades opened this issue 3 years ago • 0 comments

using follow_imports = skip is throwing away type information from imports, and therefore hiding errors. This should be changed to follow_imports = silent so as to use the type information when available, and silence any errors that result from missing annotations.

as of right now, this results in the following (currently hidden) errors-

$ mypy sphinx
sphinx/util/tags.py: note: In member "parse_compare" of class "BooleanParser":
sphinx/util/tags.py:16:5: error: Return type "Node" of "parse_compare" incompatible with return type "Expr" in supertype "Parser"  [override]
sphinx/highlighting.py:91:4: error: Unsupported operand types for >= ("Tuple[int, int, int]" and "None")  [operator]
sphinx/highlighting.py:91:4: note: Left operand is of type "Optional[Tuple[int, ...]]"
sphinx/util/rst.py:21:5: error: Module "jinja2" has no attribute "environmentfilter"  [attr-defined]
sphinx/util/rst.py:21:5: error: Name "pass_environment" already defined (possibly by an import)  [no-redef]
sphinx/util/rst.py: note: In function "heading":
sphinx/util/rst.py:56:39: error: "Environment" has no attribute "language"  [attr-defined]
sphinx/jinja2glue.py:21:5: error: Module "jinja2" has no attribute "contextfunction"  [attr-defined]
sphinx/jinja2glue.py:21:5: error: Name "pass_context" already defined (possibly by an import)  [no-redef]
sphinx/jinja2glue.py: note: In member "init" of class "BuiltinTemplateLoader":
sphinx/jinja2glue.py:191:13: error: "SandboxedEnvironment" has no attribute "install_gettext_translations"  [attr-defined]
sphinx/util/template.py: note: In member "__init__" of class "BaseRenderer":
sphinx/util/template.py:23:9: error: "SandboxedEnvironment" has no attribute "install_gettext_translations"  [attr-defined]
sphinx/testing/fixtures.py: note: In function "app_params":
sphinx/testing/fixtures.py:81:19: error: Module has no attribute "Exception"; maybe "ExceptionInfo"?  [attr-defined]
sphinx/ext/autosummary/generate.py: note: In member "__init__" of class "AutosummaryRenderer":
sphinx/ext/autosummary/generate.py:118:13: error: "SandboxedEnvironment" has no attribute "install_gettext_translations"  [attr-defined]
Found 11 errors in 7 files (checked 174 source files)

danieleades avatar Jul 29 '22 08:07 danieleades