-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show error codes by default #13542
Show error codes by default #13542
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't break show_error_codes = ...
in existing configs. It looks like command line already supports that, but config doesn't. Try taking a look at
Line 434 in 80c09d5
elif key.startswith("disallow") and hasattr(template, key[3:]): |
Edit: Looks like you're faster than I am :-)
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of thoughts:
- I don't really like
--hide-error-codes
new config value. I would prefer to keep just--show-error-code
with new default, that can be used as--show-error-code=False
to fallback to the old way. Current configuration leaves too much space for potential errors: what if I have both? What if I have--show-error-code=False
or--hide-error-code=True
? - This will require to pay extra attention to error codes from mypy team (which is a good thing). Since this change we would need to consider error code changes as breaking changes (probably) 🤔
@@ -7,7 +7,7 @@ class Errors: | |||
def __init__(self) -> None: | |||
self.num_errors = 0 | |||
self.num_warnings = 0 | |||
self._errors = mypy.errors.Errors() | |||
self._errors = mypy.errors.Errors(hide_error_codes=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this change? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR would have enabled error codes for mypyc
as well which resulted in a lot of failing tests. I'm not sure if we should do that too. The main focus was to enable it for mypy
runs which is why I added hide_error_codes=True
here.
|
||
[file mypy.ini] | ||
\[mypy] | ||
show_error_codes = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a test for hide_error_code = False / True
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've already added one in check-flags.test
right at the end.
This comment has been minimized.
This comment has been minimized.
Diff from mypy_primer, showing the effect of this PR on open source code: aiortc (https://github.com/aiortc/aiortc)
- src/aiortc/rtp.py:326: error: Incompatible types in assignment (expression has type "float", variable has type "int")
+ src/aiortc/rtp.py:326: error: Incompatible types in assignment (expression has type "float", variable has type "int") [assignment]
- src/aiortc/rtp.py:326: error: "AudioFrame" has no attribute "samples"
+ src/aiortc/rtp.py:326: error: "AudioFrame" has no attribute "samples" [attr-defined]
- src/aiortc/contrib/media.py:236: error: Call to untyped function "stop" in typed context
+ src/aiortc/contrib/media.py:236: error: Call to untyped function "stop" in typed context [no-untyped-call]
- src/aiortc/contrib/media.py:239: error: "Frame" has no attribute "time"
+ src/aiortc/contrib/media.py:239: error: "Frame" has no attribute "time" [attr-defined]
- src/aiortc/codecs/h264.py:282: error: "VideoFrame" has no attribute "pict_type"
+ src/aiortc/codecs/h264.py:282: error: "VideoFrame" has no attribute "pict_type" [attr-defined]
- src/aiortc/codecs/h264.py:282: error: Module has no attribute "video"
+ src/aiortc/codecs/h264.py:282: error: Module has no attribute "video" [attr-defined]
- src/aiortc/rtcrtpreceiver.py:498: error: Invalid index type "Union[int, str, None]" for "Dict[int, RTCRtpCodecParameters]"; expected type "int"
+ src/aiortc/rtcrtpreceiver.py:498: error: Invalid index type "Union[int, str, None]" for "Dict[int, RTCRtpCodecParameters]"; expected type "int" [index]
- src/aiortc/rtcpeerconnection.py:92: error: Invalid index type "Union[int, str, None]" for "Dict[int, RTCRtpCodecParameters]"; expected type "int"
+ src/aiortc/rtcpeerconnection.py:92: error: Invalid index type "Union[int, str, None]" for "Dict[int, RTCRtpCodecParameters]"; expected type "int" [index]
- src/aiortc/rtcpeerconnection.py:138: error: Argument 1 to "parse_h264_profile_level_id" has incompatible type "Union[int, str]"; expected "str"
+ src/aiortc/rtcpeerconnection.py:138: error: Argument 1 to "parse_h264_profile_level_id" has incompatible type "Union[int, str]"; expected "str" [arg-type]
- src/aiortc/rtcpeerconnection.py:1135: error: Invalid index type "Union[int, str]" for "Dict[int, RTCRtpDecodingParameters]"; expected type "int"
+ src/aiortc/rtcpeerconnection.py:1135: error: Invalid index type "Union[int, str]" for "Dict[int, RTCRtpDecodingParameters]"; expected type "int" [index]
pyinstrument (https://github.com/joerick/pyinstrument)
- pyinstrument/frame.py:126: error: Incompatible types in assignment (expression has type "float", variable has type "int")
+ pyinstrument/frame.py:126: error: Incompatible types in assignment (expression has type "float", variable has type "int") [assignment]
- pyinstrument/frame.py:135: error: Missing return statement
+ pyinstrument/frame.py:135: error: Missing return statement [return]
- pyinstrument/frame.py:140: error: Missing return statement
+ pyinstrument/frame.py:140: error: Missing return statement [return]
- pyinstrument/frame.py:201: error: Missing return statement
+ pyinstrument/frame.py:201: error: Missing return statement [return]
- pyinstrument/frame.py:206: error: Name "attributes" already defined on line 57
+ pyinstrument/frame.py:206: error: Name "attributes" already defined on line 57 [no-redef]
- pyinstrument/frame.py:259: error: Incompatible types in assignment (expression has type "float", variable has type "int")
+ pyinstrument/frame.py:259: error: Incompatible types in assignment (expression has type "float", variable has type "int") [assignment]
- pyinstrument/frame.py:262: error: Incompatible types in assignment (expression has type "float", variable has type "int")
+ pyinstrument/frame.py:262: error: Incompatible types in assignment (expression has type "float", variable has type "int") [assignment]
- pyinstrument/vendor/appdirs.py:533: error: Cannot find implementation or library stub for module named "com.sun"
+ pyinstrument/vendor/appdirs.py:533: error: Cannot find implementation or library stub for module named "com.sun" [import]
- pyinstrument/vendor/appdirs.py:534: error: Cannot find implementation or library stub for module named "com.sun.jna.platform"
+ pyinstrument/vendor/appdirs.py:534: error: Cannot find implementation or library stub for module named "com.sun.jna.platform" [import]
- pyinstrument/vendor/appdirs.py:559: error: Module "ctypes" has no attribute "windll"
+ pyinstrument/vendor/appdirs.py:559: error: Module "ctypes" has no attribute "windll" [attr-defined]
- pyinstrument/vendor/appdirs.py:562: error: Cannot find implementation or library stub for module named "com.sun.jna"
+ pyinstrument/vendor/appdirs.py:562: error: Cannot find implementation or library stub for module named "com.sun.jna" [import]
- pyinstrument/vendor/appdirs.py:562: error: Cannot find implementation or library stub for module named "com"
+ pyinstrument/vendor/appdirs.py:562: error: Cannot find implementation or library stub for module named "com" [import]
- pyinstrument/stack_sampler.py:185: error: Incompatible types in string interpolation (expression has type "Optional[int]", placeholder has type "Union[int, float, SupportsInt]")
+ pyinstrument/stack_sampler.py:185: error: Incompatible types in string interpolation (expression has type "Optional[int]", placeholder has type "Union[int, float, SupportsInt]") [str-format]
- pyinstrument/stack_sampler.py:196: error: Variable "pyinstrument.typing.LiteralStr" is not valid as a type
+ pyinstrument/stack_sampler.py:196: error: Variable "pyinstrument.typing.LiteralStr" is not valid as a type [valid-type]
- pyinstrument/stack_sampler.py:196: error: Name "in_context" is not defined
+ pyinstrument/stack_sampler.py:196: error: Name "in_context" is not defined [name-defined]
- pyinstrument/stack_sampler.py:196: error: Name "out_of_context_awaited" is not defined
+ pyinstrument/stack_sampler.py:196: error: Name "out_of_context_awaited" is not defined [name-defined]
- pyinstrument/stack_sampler.py:196: error: Name "out_of_context_unknown" is not defined
+ pyinstrument/stack_sampler.py:196: error: Name "out_of_context_unknown" is not defined [name-defined]
- pyinstrument/frame_ops.py:70: error: Variable "pyinstrument.typing.LiteralStr" is not valid as a type
+ pyinstrument/frame_ops.py:70: error: Variable "pyinstrument.typing.LiteralStr" is not valid as a type [valid-type]
- pyinstrument/frame_ops.py:70: error: Name "children" is not defined
+ pyinstrument/frame_ops.py:70: error: Name "children" is not defined [name-defined]
- pyinstrument/frame_ops.py:70: error: Name "self_time" is not defined
+ pyinstrument/frame_ops.py:70: error: Name "self_time" is not defined [name-defined]
- pyinstrument/frame_ops.py:70: error: Name "nothing" is not defined
+ pyinstrument/frame_ops.py:70: error: Name "nothing" is not defined [name-defined]
- pyinstrument/vendor/decorator.py:55: error: All conditional function variants must have identical signatures
+ pyinstrument/vendor/decorator.py:55: error: All conditional function variants must have identical signatures [misc]
- pyinstrument/vendor/decorator.py:66: error: Incompatible redefinition (redefinition with type "Callable[[Any], Any]", original type overloaded function)
+ pyinstrument/vendor/decorator.py:66: error: Incompatible redefinition (redefinition with type "Callable[[Any], Any]", original type overloaded function) [misc]
- pyinstrument/vendor/decorator.py:279: error: Module "contextlib" has no attribute "GeneratorContextManager"; maybe "_GeneratorContextManager", "_AsyncGeneratorContextManager", or "AbstractContextManager"?
+ pyinstrument/vendor/decorator.py:279: error: Module "contextlib" has no attribute "GeneratorContextManager"; maybe "_GeneratorContextManager", "_AsyncGeneratorContextManager", or "AbstractContextManager"? [attr-defined]
- pyinstrument/vendor/decorator.py:279: error: Name "_GeneratorContextManager" already defined (possibly by an import)
+ pyinstrument/vendor/decorator.py:279: error: Name "_GeneratorContextManager" already defined (possibly by an import) [no-redef]
- pyinstrument/vendor/decorator.py:295: error: Cannot assign to a method
+ pyinstrument/vendor/decorator.py:295: error: Cannot assign to a method [assignment]
- pyinstrument/vendor/decorator.py:295: error: Incompatible types in assignment (expression has type "Callable[[Any, Any, VarArg(Any), KwArg(Any)], Any]", variable has type "Callable[[_GeneratorContextManager[_T_co], Callable[..., Iterator[_T_co]], Tuple[Any, ...], Dict[str, Any]], None]")
+ pyinstrument/vendor/decorator.py:295: error: Incompatible types in assignment (expression has type "Callable[[Any, Any, VarArg(Any), KwArg(Any)], Any]", variable has type "Callable[[_GeneratorContextManager[_T_co], Callable[..., Iterator[_T_co]], Tuple[Any, ...], Dict[str, Any]], None]") [assignment]
- pyinstrument/vendor/decorator.py:301: error: Cannot assign to a method
+ pyinstrument/vendor/decorator.py:301: error: Cannot assign to a method [assignment]
- pyinstrument/vendor/decorator.py:301: error: Incompatible types in assignment (expression has type "Callable[[Any, Any, VarArg(Any), KwArg(Any)], Any]", variable has type "Callable[[_GeneratorContextManager[_T_co], Callable[..., Iterator[_T_co]], Tuple[Any, ...], Dict[str, Any]], None]")
+ pyinstrument/vendor/decorator.py:301: error: Incompatible types in assignment (expression has type "Callable[[Any, Any, VarArg(Any), KwArg(Any)], Any]", variable has type "Callable[[_GeneratorContextManager[_T_co], Callable[..., Iterator[_T_co]], Tuple[Any, ...], Dict[str, Any]], None]") [assignment]
- pyinstrument/profiler.py:46: error: Variable "pyinstrument.profiler.AsyncMode" is not valid as a type
+ pyinstrument/profiler.py:46: error: Variable "pyinstrument.profiler.AsyncMode" is not valid as a type [valid-type]
- pyinstrument/profiler.py:48: error: Variable "pyinstrument.profiler.AsyncMode" is not valid as a type
+ pyinstrument/profiler.py:48: error: Variable "pyinstrument.profiler.AsyncMode" is not valid as a type [valid-type]
- pyinstrument/profiler.py:69: error: Variable "pyinstrument.profiler.AsyncMode" is not valid as a type
+ pyinstrument/profiler.py:69: error: Variable "pyinstrument.profiler.AsyncMode" is not valid as a type [valid-type]
- pyinstrument/renderers/console.py:25: error: Variable "pyinstrument.typing.LiteralStr" is not valid as a type
+ pyinstrument/renderers/console.py:25: error: Variable "pyinstrument.typing.LiteralStr" is not valid as a type [valid-type]
- pyinstrument/renderers/console.py:25: error: Name "seconds" is not defined
+ pyinstrument/renderers/console.py:25: error: Name "seconds" is not defined [name-defined]
- pyinstrument/renderers/console.py:25: error: Name "percent_of_total" is not defined
+ pyinstrument/renderers/console.py:25: error: Name "percent_of_total" is not defined [name-defined]
- pyinstrument/renderers/console.py:88: error: "Type[object]" has no attribute "end"
+ pyinstrument/renderers/console.py:88: error: "Type[object]" has no attribute "end" [attr-defined]
- pyinstrument/renderers/console.py:90: error: "Type[object]" has no attribute "end"
+ pyinstrument/renderers/console.py:90: error: "Type[object]" has no attribute "end" [attr-defined]
- pyinstrument/renderers/console.py:100: error: "Type[object]" has no attribute "end"
+ pyinstrument/renderers/console.py:100: error: "Type[object]" has no attribute "end" [attr-defined]
- pyinstrument/renderers/console.py:100: error: "Type[object]" has no attribute "faint"
+ pyinstrument/renderers/console.py:100: error: "Type[object]" has no attribute "faint" [attr-defined]
- pyinstrument/renderers/console.py:115: error: "Type[object]" has no attribute "faint"
+ pyinstrument/renderers/console.py:115: error: "Type[object]" has no attribute "faint" [attr-defined]
- pyinstrument/renderers/console.py:115: error: "Type[object]" has no attribute "end"
+ pyinstrument/renderers/console.py:115: error: "Type[object]" has no attribute "end" [attr-defined]
- pyinstrument/renderers/console.py:148: error: "Type[object]" has no attribute "red"
+ pyinstrument/renderers/console.py:148: error: "Type[object]" has no attribute "red" [attr-defined]
- pyinstrument/renderers/console.py:150: error: "Type[object]" has no attribute "yellow"
+ pyinstrument/renderers/console.py:150: error: "Type[object]" has no attribute "yellow" [attr-defined]
- pyinstrument/renderers/console.py:152: error: "Type[object]" has no attribute "green"
+ pyinstrument/renderers/console.py:152: error: "Type[object]" has no attribute "green" [attr-defined]
- pyinstrument/renderers/console.py:154: error: "Type[object]" has no attribute "bright_green"
+ pyinstrument/renderers/console.py:154: error: "Type[object]" has no attribute "bright_green" [attr-defined]
- pyinstrument/renderers/console.py:154: error: "Type[object]" has no attribute "faint"
+ pyinstrument/renderers/console.py:154: error: "Type[object]" has no attribute "faint" [attr-defined]
- pyinstrument/renderers/console.py:158: error: "Type[object]" has no attribute "bg_dark_blue_255"
+ pyinstrument/renderers/console.py:158: error: "Type[object]" has no attribute "bg_dark_blue_255" [attr-defined]
- pyinstrument/renderers/console.py:158: error: "Type[object]" has no attribute "white_255"
+ pyinstrument/renderers/console.py:158: error: "Type[object]" has no attribute "white_255" [attr-defined]
- pyinstrument/magic/magic.py:5: error: Cannot find implementation or library stub for module named "IPython.core.magic"
+ pyinstrument/magic/magic.py:5: error: Cannot find implementation or library stub for module named "IPython.core.magic" [import]
- pyinstrument/magic/magic.py:6: error: Cannot find implementation or library stub for module named "IPython.core.magic_arguments"
+ pyinstrument/magic/magic.py:6: error: Cannot find implementation or library stub for module named "IPython.core.magic_arguments" [import]
- pyinstrument/magic/magic.py:7: error: Cannot find implementation or library stub for module named "IPython.display"
+ pyinstrument/magic/magic.py:7: error: Cannot find implementation or library stub for module named "IPython.display" [import]
- pyinstrument/middleware.py:6: error: Cannot find implementation or library stub for module named "django.conf"
+ pyinstrument/middleware.py:6: error: Cannot find implementation or library stub for module named "django.conf" [import]
- pyinstrument/middleware.py:7: error: Cannot find implementation or library stub for module named "django.http"
+ pyinstrument/middleware.py:7: error: Cannot find implementation or library stub for module named "django.http" [import]
- pyinstrument/middleware.py:8: error: Cannot find implementation or library stub for module named "django.utils.module_loading"
+ pyinstrument/middleware.py:8: error: Cannot find implementation or library stub for module named "django.utils.module_loading" [import]
- pyinstrument/middleware.py:15: error: Cannot find implementation or library stub for module named "django.utils.deprecation"
+ pyinstrument/middleware.py:15: error: Cannot find implementation or library stub for module named "django.utils.deprecation" [import]
apprise (https://github.com/caronc/apprise)
- setup.py:31: error: Skipping analyzing "setuptools": module is installed, but missing library stubs or py.typed marker
+ setup.py:31: error: Skipping analyzing "setuptools": module is installed, but missing library stubs or py.typed marker [import]
- setup.py:40: error: Library stubs not installed for "babel.messages"
+ setup.py:40: error: Library stubs not installed for "babel.messages" [import]
- apprise/logger.py:34: error: Module has no attribute "TRACE"
+ apprise/logger.py:34: error: Module has no attribute "TRACE" [attr-defined]
- apprise/logger.py:38: error: Module has no attribute "DEPRECATE"
+ apprise/logger.py:38: error: Module has no attribute "DEPRECATE" [attr-defined]
- apprise/logger.py:41: error: Module has no attribute "DEPRECATE"
+ apprise/logger.py:41: error: Module has no attribute "DEPRECATE" [attr-defined]
- apprise/logger.py:42: error: Module has no attribute "TRACE"
+ apprise/logger.py:42: error: Module has no attribute "TRACE" [attr-defined]
- apprise/logger.py:62: error: "Type[Logger]" has no attribute "trace"
+ apprise/logger.py:62: error: "Type[Logger]" has no attribute "trace" [attr-defined]
- apprise/logger.py:63: error: "Type[Logger]" has no attribute "deprecate"
+ apprise/logger.py:63: error: "Type[Logger]" has no attribute "deprecate" [attr-defined]
- apprise/URLBase.pyi:1: error: Module "logging" has no attribute "logger"; maybe "Logger"?
+ apprise/URLBase.pyi:1: error: Module "logging" has no attribute "logger"; maybe "Logger"? [attr-defined]
- apprise/conversion.py:109: error: Need type annotation for "BLOCK_END" (hint: "BLOCK_END: Dict[<type>, <type>] = ...")
+ apprise/conversion.py:109: error: Need type annotation for "BLOCK_END" (hint: "BLOCK_END: Dict[<type>, <type>] = ...") [var-annotated]
- apprise/AppriseLocale.py:57: error: Cannot find implementation or library stub for module named "__builtin__"
+ apprise/AppriseLocale.py:57: error: Cannot find implementation or library stub for module named "__builtin__" [import]
- apprise/config/__init__.py:32: error: Module "apprise.common" has no attribute "CONFIG_SCHEMA_MAP"
+ apprise/config/__init__.py:32: error: Module "apprise.common" has no attribute "CONFIG_SCHEMA_MAP" [attr-defined]
- apprise/attachment/__init__.py:32: error: Module "apprise.common" has no attribute "ATTACHMENT_SCHEMA_MAP"
+ apprise/attachment/__init__.py:32: error: Module "apprise.common" has no attribute "ATTACHMENT_SCHEMA_MAP" [attr-defined]
- apprise/plugins/NotifyXML.py:32: error: Module "apprise.URLBase" has no attribute "PrivacyMode"
+ apprise/plugins/NotifyXML.py:32: error: Module "apprise.URLBase" has no attribute "PrivacyMode" [attr-defined]
- apprise/plugins/NotifyXML.py:33: error: Module "apprise.common" has no attribute "NotifyImageSize"
+ apprise/plugins/NotifyXML.py:33: error: Module "apprise.common" has no attribute "NotifyImageSize" [attr-defined]
- apprise/plugins/NotifyXML.py:90: error: "Type[NotifyBase]" has no attribute "template_tokens"
+ apprise/plugins/NotifyXML.py:90: error: "Type[NotifyBase]" has no attribute "template_tokens" [attr-defined]
- apprise/plugins/NotifyXML.py:115: error: "Type[NotifyBase]" has no attribute "template_args"
+ apprise/plugins/NotifyXML.py:115: error: "Type[NotifyBase]" has no attribute "template_args" [attr-defined]
- apprise/plugins/NotifyJSON.py:32: error: Module "apprise.URLBase" has no attribute "PrivacyMode"
+ apprise/plugins/NotifyJSON.py:32: error: Module "apprise.URLBase" has no attribute "PrivacyMode" [attr-defined]
- apprise/plugins/NotifyJSON.py:33: error: Module "apprise.common" has no attribute "NotifyImageSize"
+ apprise/plugins/NotifyJSON.py:33: error: Module "apprise.common" has no attribute "NotifyImageSize" [attr-defined]
- apprise/plugins/NotifyJSON.py:85: error: "Type[NotifyBase]" has no attribute "template_tokens"
+ apprise/plugins/NotifyJSON.py:85: error: "Type[NotifyBase]" has no attribute "template_tokens" [attr-defined]
- apprise/plugins/NotifyJSON.py:110: error: "Type[NotifyBase]" has no attribute "template_args"
+ apprise/plugins/NotifyJSON.py:110: error: "Type[NotifyBase]" has no attribute "template_args" [attr-defined]
- apprise/plugins/NotifyForm.py:30: error: Module "apprise.URLBase" has no attribute "PrivacyMode"
+ apprise/plugins/NotifyForm.py:30: error: Module "apprise.URLBase" has no attribute "PrivacyMode" [attr-defined]
- apprise/plugins/NotifyForm.py:31: error: Module "apprise.common" has no attribute "NotifyImageSize"
+ apprise/plugins/NotifyForm.py:31: error: Module "apprise.common" has no attribute "NotifyImageSize" [attr-defined]
- apprise/plugins/NotifyForm.py:83: error: "Type[NotifyBase]" has no attribute "template_tokens"
+ apprise/plugins/NotifyForm.py:83: error: "Type[NotifyBase]" has no attribute "template_tokens" [attr-defined]
- apprise/plugins/NotifyForm.py:108: error: "Type[NotifyBase]" has no attribute "template_args"
+ apprise/plugins/NotifyForm.py:108: error: "Type[NotifyBase]" has no attribute "template_args" [attr-defined]
- apprise/plugins/NotifyEnigma2.py:39: error: Module "apprise.URLBase" has no attribute "PrivacyMode"
+ apprise/plugins/NotifyEnigma2.py:39: error: Module "apprise.URLBase" has no attribute "PrivacyMode" [attr-defined]
- apprise/plugins/NotifyEnigma2.py:106: error: "Type[NotifyBase]" has no attribute "template_tokens"
+ apprise/plugins/NotifyEnigma2.py:106: error: "Type[NotifyBase]" has no attribute "template_tokens" [attr-defined]
- apprise/plugins/NotifyEnigma2.py:133: error: "Type[NotifyBase]" has no attribute "template_args"
+ apprise/plugins/NotifyEnigma2.py:133: error: "Type[NotifyBase]" has no attribute "template_args" [attr-defined]
- apprise/plugins/NotifyFCM/oauth.py:48: error: Module "urllib" has no attribute "urlencode"
+ apprise/plugins/NotifyFCM/oauth.py:48: error: Module "urllib" has no attribute "urlencode" [attr-defined]
- apprise/plugins/NotifyFCM/oauth.py:60: error: Cannot assign to a type
+ apprise/plugins/NotifyFCM/oauth.py:60: error: Cannot assign to a type [misc]
- apprise/plugins/NotifyFCM/oauth.py:60: error: Incompatible types in assignment (expression has type "Type[ValueError]", variable has type "Type[JSONDecodeError]")
+ apprise/plugins/NotifyFCM/oauth.py:60: error: Incompatible types in assignment (expression has type "Type[ValueError]", variable has type "Type[JSONDecodeError]") [assignment]
- apprise/utils.py:41: error: Module "urllib" has no attribute "unquote"
+ apprise/utils.py:41: error: Module "urllib" has no attribute "unquote" [attr-defined]
- apprise/utils.py:42: error: Module "urllib" has no attribute "quote"
+ apprise/utils.py:42: error: Module "urllib" has no attribute "quote" [attr-defined]
- apprise/utils.py:43: error: Cannot find implementation or library stub for module named "urlparse"
+ apprise/utils.py:43: error: Cannot find implementation or library stub for module named "urlparse" [import]
- apprise/utils.py:44: error: Module "urllib" has no attribute "urlencode"
+ apprise/utils.py:44: error: Module "urllib" has no attribute "urlencode" [attr-defined]
- apprise/config/ConfigBase.pyi:3: error: Module "apprise.URLBase" is not valid as a type
+ apprise/config/ConfigBase.pyi:3: error: Module "apprise.URLBase" is not valid as a type [valid-type]
- apprise/config/ConfigBase.pyi:3: error: Invalid base class "URLBase"
+ apprise/config/ConfigBase.pyi:3: error: Invalid base class "URLBase" [misc]
- apprise/decorators/CustomNotifyPlugin.py:57: error: Need type annotation for "_default_args" (hint: "_default_args: Dict[<type>, <type>] = ...")
+ apprise/decorators/CustomNotifyPlugin.py:57: error: Need type annotation for "_default_args" (hint: "_default_args: Dict[<type>, <type>] = ...") [var-annotated]
- apprise/AppriseConfig.pyi:3: error: Name "AppriseAsset" already defined (by an import)
+ apprise/AppriseConfig.pyi:3: error: Name "AppriseAsset" already defined (by an import) [no-redef]
- apprise/AppriseConfig.pyi:6: error: Module "apprise.config.ConfigBase" is not valid as a type
+ apprise/AppriseConfig.pyi:6: error: Module "apprise.config.ConfigBase" is not valid as a type [valid-type]
- apprise/AppriseConfig.pyi:12: error: Module "apprise.AppriseAsset" is not valid as a type
+ apprise/AppriseConfig.pyi:12: error: Module "apprise.AppriseAsset" is not valid as a type [valid-type]
- apprise/AppriseConfig.pyi:21: error: Module "apprise.AppriseAsset" is not valid as a type
+ apprise/AppriseConfig.pyi:21: error: Module "apprise.AppriseAsset" is not valid as a type [valid-type]
- apprise/AppriseConfig.pyi:29: error: Module "apprise.AppriseAsset" is not valid as a type
+ apprise/AppriseConfig.pyi:29: error: Module "apprise.AppriseAsset" is not valid as a type [valid-type]
- apprise/AppriseConfig.pyi:35: error: Module "apprise.config.ConfigBase" is not valid as a type
+ apprise/AppriseConfig.pyi:35: error: Module "apprise.config.ConfigBase" is not valid as a type [valid-type]
- apprise/AppriseConfig.pyi:36: error: Self argument missing for a non-static method (or an invalid type for self)
+ apprise/AppriseConfig.pyi:36: error: Self argument missing for a non-static method (or an invalid type for self) [misc]
- apprise/AppriseConfig.pyi:38: error: Module "apprise.AppriseAsset" is not valid as a type
+ apprise/AppriseConfig.pyi:38: error: Module "apprise.AppriseAsset" is not valid as a type [valid-type]
- apprise/AppriseConfig.pyi:43: error: Module "apprise.config.ConfigBase" is not valid as a type
+ apprise/AppriseConfig.pyi:43: error: Module "apprise.config.ConfigBase" is not valid as a type [valid-type]
- apprise/AppriseConfig.pyi:44: error: Module "apprise.config.ConfigBase" is not valid as a type
+ apprise/AppriseConfig.pyi:44: error: Module "apprise.config.ConfigBase" is not valid as a type [valid-type]
- apprise/AppriseConfig.pyi:45: error: Module "apprise.config.ConfigBase" is not valid as a type
+ apprise/AppriseConfig.pyi:45: error: Module "apprise.config.ConfigBase" is not valid as a type [valid-type]
- apprise/AppriseConfig.pyi:48: error: Module "apprise.config.ConfigBase" is not valid as a type
+ apprise/AppriseConfig.pyi:48: error: Module "apprise.config.ConfigBase" is not valid as a type [valid-type]
- apprise/AppriseAttachment.pyi:3: error: Name "AppriseAsset" already defined (by an import)
+ apprise/AppriseAttachment.pyi:3: error: Name "AppriseAsset" already defined (by an import) [no-redef]
- apprise/AppriseAttachment.pyi:6: error: Module "apprise.attachment.AttachBase" is not valid as a type
+ apprise/AppriseAttachment.pyi:6: error: Module "apprise.attachment.AttachBase" is not valid as a type [valid-type]
- apprise/AppriseAttachment.pyi:27: error: Module "apprise.AppriseAsset" is not valid as a type
+ apprise/AppriseAttachment.pyi:27: error: Module "apprise.AppriseAsset" is not valid as a type [valid-type]
- apprise/AppriseAttachment.pyi:30: error: Name "NotifyBase" is not defined
+ apprise/AppriseAttachment.pyi:30: error: Name "NotifyBase" is not defined [name-defined]
- apprise/AppriseAttachment.pyi:33: error: Module "apprise.attachment.AttachBase" is not valid as a type
+ apprise/AppriseAttachment.pyi:33: error: Module "apprise.attachment.AttachBase" is not valid as a type [valid-type]
- apprise/AppriseAttachment.pyi:34: error: Module "apprise.attachment.AttachBase" is not valid as a type
+ apprise/AppriseAttachment.pyi:34: error: Module "apprise.attachment.AttachBase" is not valid as a type [valid-type]
- apprise/AppriseAttachment.pyi:37: error: Name "Iterator" is not defined
+ apprise/AppriseAttachment.pyi:37: error: Name "Iterator" is not defined [name-defined]
- apprise/Apprise.pyi:3: error: Name "AppriseAsset" already defined (by an import)
+ apprise/Apprise.pyi:3: error: Name "AppriseAsset" already defined (by an import) [no-redef]
- apprise/Apprise.pyi:3: error: Name "AppriseAttachment" already defined (by an import)
+ apprise/Apprise.pyi:3: error: Name "AppriseAttachment" already defined (by an import) [no-redef]
- apprise/Apprise.pyi:3: error: Name "AppriseConfig" already defined (by an import)
+ apprise/Apprise.pyi:3: error: Name "AppriseConfig" already defined (by an import) [no-redef]
- apprise/Apprise.pyi:7: error: Name "Union" is not defined
+ apprise/Apprise.pyi:7: error: Name "Union" is not defined [name-defined]
- apprise/Apprise.pyi:8: error: Name "Union" is not defined
+ apprise/Apprise.pyi:8: error: Name "Union" is not defined [name-defined]
- apprise/Apprise.pyi:8: error: Variable "apprise.Apprise._Server" is not valid as a type
+ apprise/Apprise.pyi:8: error: Variable "apprise.Apprise._Server" is not valid as a type [valid-type]
- apprise/Apprise.pyi:11: error: Name "Union" is not defined
+ apprise/Apprise.pyi:11: error: Name "Union" is not defined [name-defined]
- apprise/Apprise.pyi:16: error: Variable "apprise.Apprise._Servers" is not valid as a type
+ apprise/Apprise.pyi:16: error: Variable "apprise.Apprise._Servers" is not valid as a type [valid-type]
- apprise/Apprise.pyi:17: error: Module "apprise.AppriseAsset" is not valid as a type
+ apprise/Apprise.pyi:17: error: Module "apprise.AppriseAsset" is not valid as a type [valid-type]
- apprise/Apprise.pyi:23: error: Name "Union" is not defined
+ apprise/Apprise.pyi:23: error: Name "Union" is not defined [name-defined]
- apprise/Apprise.pyi:24: error: Module "apprise.AppriseAsset" is not valid as a type
+ apprise/Apprise.pyi:24: error: Module "apprise.AppriseAsset" is not valid as a type [valid-type]
- apprise/Apprise.pyi:25: error: Variable "apprise.Apprise._Tag" is not valid as a type
+ apprise/Apprise.pyi:25: error: Variable "apprise.Apprise._Tag" is not valid as a type [valid-type]
- apprise/Apprise.pyi:30: error: Variable "apprise.Apprise._Servers" is not valid as a type
+ apprise/Apprise.pyi:30: error: Variable "apprise.Apprise._Servers" is not valid as a type [valid-type]
- apprise/Apprise.pyi:31: error: Module "apprise.AppriseAsset" is not valid as a type
+ apprise/Apprise.pyi:31: error: Module "apprise.AppriseAsset" is not valid as a type [valid-type]
- apprise/Apprise.pyi:32: error: Variable "apprise.Apprise._Tag" is not valid as a type
+ apprise/Apprise.pyi:32: error: Variable "apprise.Apprise._Tag" is not valid as a type [valid-type]
- apprise/Apprise.pyi:42: error: Variable "apprise.Apprise._Tag" is not valid as a type
+ apprise/Apprise.pyi:42: error: Variable "apprise.Apprise._Tag" is not valid as a type [valid-type]
- apprise/Apprise.pyi:43: error: Module "apprise.AppriseAttachment" is not valid as a type
+ apprise/Apprise.pyi:43: error: Module "apprise.AppriseAttachment" is not valid as a type [valid-type]
- apprise/Apprise.pyi:52: error: Variable "apprise.Apprise._Tag" is not valid as a type
+ apprise/Apprise.pyi:52: error: Variable "apprise.Apprise._Tag" is not valid as a type [valid-type]
- apprise/Apprise.pyi:53: error: Module "apprise.AppriseAttachment"
... (truncated 10751 lines) ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I don't really like
--hide-error-codes
new config value. I would prefer to keep just--show-error-code
with new default, that can be used as--show-error-code=False
to fallback to the old way. Current configuration leaves too much space for potential errors: what if I have both? What if I have--show-error-code=False
or--hide-error-code=True
?
That's what I've done here 😄
--hide-error-code
is an invertible_flag
, the inverse being --show-error-code
. To adjust the default, I needed the change from show
to hide
. You can still use --show-error-code=False
.
- This will require to pay extra attention to error codes from mypy team (which is a good thing). Since this change we would need to consider error code changes as breaking changes (probably) 🤔
I agree, better error codes are a good thing. Not sure though I would consider changing the error code a breaking change. E.g. we (did) have a lot of misc
errors. We should be able to choose new / better once if suitable.
Updating the code for a new mypy release would still be easy enough. At worst, the type: ignore[...]
error codes would need to be updated. I suspect that most still use bare type: ignores
though, since we haven't enabled ignore-without-code
by default.
@@ -7,7 +7,7 @@ class Errors: | |||
def __init__(self) -> None: | |||
self.num_errors = 0 | |||
self.num_warnings = 0 | |||
self._errors = mypy.errors.Errors() | |||
self._errors = mypy.errors.Errors(hide_error_codes=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR would have enabled error codes for mypyc
as well which resulted in a lot of failing tests. I'm not sure if we should do that too. The main focus was to enable it for mypy
runs which is why I added hide_error_codes=True
here.
|
||
[file mypy.ini] | ||
\[mypy] | ||
show_error_codes = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've already added one in check-flags.test
right at the end.
Description
Part of the effort to nudge users into using specific type ignores. See #13541
This PR enables
show-error-codes
by default. Without knowing the code, users will always choose to use a baretype: ignore
instead.