-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Show error codes by default #13542
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
Changes from 9 commits
b6e4397
853e7c2
65ab26c
f445ca8
279dc1f
bc423e9
4fb94da
f0446bb
1690b75
bd98356
c078de6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. The PR would have enabled error codes for |
||
|
||
def error(self, msg: str, path: str, line: int) -> None: | ||
self._errors.report(line, None, msg, severity="error", file=path) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -925,3 +925,12 @@ def f(d: D, s: str) -> None: | |
[case testRecommendErrorCode] | ||
# type: ignore[whatever] # E: type ignore with error code is not supported for modules; use `# mypy: disable-error-code=...` [syntax] | ||
1 + "asdf" | ||
|
||
[case testShowErrorCodesInConfig] | ||
# flags: --config-file tmp/mypy.ini | ||
# Test 'show_error_codes = True' in config doesn't raise an exception | ||
var: int = "" # E: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] | ||
|
||
[file mypy.ini] | ||
\[mypy] | ||
show_error_codes = True | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need a test for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've already added one in |
Uh oh!
There was an error while loading. Please reload this page.