-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Add error codes to many additional messages #7334
Changes from 37 commits
c48ee62
2fe6373
09c3570
836d2ae
d15923a
08b98dd
7283416
a0f96f2
512fe64
f4638e9
bec13f3
a43e048
0a0f490
6fb597b
9335b28
c33a5ef
0b11215
5b464d2
b036992
18d7730
3b55d70
6f06f23
88a5cfb
b2eb60e
73b8b74
5efb120
e3c10cd
9815a59
4ac28e0
63758e6
92e5794
f6befe4
6db278c
c364741
195e58d
8a1a399
6efdd30
7cef388
1bec9c0
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 | ||||
---|---|---|---|---|---|---|
|
@@ -29,19 +29,70 @@ def __str__(self) -> str: | |||||
'call-arg', "Check number, names and kinds of arguments in calls", 'General') # type: Final | ||||||
ARG_TYPE = ErrorCode( | ||||||
'arg-type', "Check argument types in calls", 'General') # type: Final | ||||||
CALL_OVERLOAD = ErrorCode( | ||||||
'call-overload', "Check that an overload variant matches arguments", 'General') # type: Final | ||||||
VALID_TYPE = ErrorCode( | ||||||
'valid-type', "Check that type (annotation) is valid", 'General') # type: Final | ||||||
MISSING_ANN = ErrorCode( | ||||||
VAR_ANNOTATED = ErrorCode( | ||||||
'var-annotated', "Require variable annotation if type can't be inferred", | ||||||
'General') # type: Final | ||||||
OVERRIDE = ErrorCode( | ||||||
'override', "Check that method override is compatible with base class", | ||||||
'General') # type: Final | ||||||
RETURN = ErrorCode( | ||||||
'return', "Check that function always returns a value", 'General') # type: Final | ||||||
RETURN_VALUE = ErrorCode( | ||||||
'return-value', "Check that return value is compatible with signature", | ||||||
'General') # type: Final | ||||||
ASSIGNMENT = ErrorCode( | ||||||
'assignment', "Check that assigned value is compatible with target", 'General') # type: Final | ||||||
TYPE_ARG = ErrorCode( | ||||||
'type-arg', "Check that generic type arguments are present", 'General') # type: Final | ||||||
TYPE_VAR = ErrorCode( | ||||||
'type-var', "Check that type variable values are valid", 'General') # type: Final | ||||||
UNION_ATTR = ErrorCode( | ||||||
'union-attr', "Check that attribute exists in each item of a union", 'General') # type: Final | ||||||
INDEX = ErrorCode( | ||||||
'index', "Check indexing operations", 'General') # type: Final | ||||||
OPERATOR = ErrorCode( | ||||||
'operator', "Check that operator is valid for operands", 'General') # type: Final | ||||||
LIST_ITEM = ErrorCode( | ||||||
'list-item', "Check list items in [item, ...]", 'General') # type: Final | ||||||
DICT_ITEM = ErrorCode( | ||||||
'dict-item', "Check dict items in {key: value, ...}", 'General') # type: Final | ||||||
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. Probably also here:
Suggested change
|
||||||
TYPEDDICT_ITEM = ErrorCode( | ||||||
'typeddict-item', "Check items when constructing TypedDict", 'General') # type: Final | ||||||
HAS_TYPE = ErrorCode( | ||||||
'has-type', "Check that type of reference can be determined", 'General') # type: Final | ||||||
IMPORT = ErrorCode( | ||||||
'import', "Require that imported module can be found or has stubs", 'General') # type: Final | ||||||
NO_REDEF = ErrorCode( | ||||||
'no-redef', "Check that each name is defined once", 'General') # type: Final | ||||||
FUNC_RETURNS_VALUE = ErrorCode( | ||||||
'func-returns-value', "Check that called function returns a value in value context", | ||||||
'General') # type: Final | ||||||
ABSTRACT = ErrorCode( | ||||||
'abstract', "Prevent instantiation of classes with abstract attributes", | ||||||
'General') # type: Final | ||||||
VALID_NEWTYPE = ErrorCode( | ||||||
'valid-newtype', "Check that argument 2 to NewType is valid", 'General') # type: Final | ||||||
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. Should we have the same code for all ill-defined 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. This error seems to be much more common than any other |
||||||
|
||||||
NO_UNTYPED_DEF = ErrorCode( | ||||||
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 am just curious why the below block is separated with an empty line. Maybe add a comment? 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. Ok. These errors aren't enabled by default. |
||||||
'no-untyped-def', "Check that every function has an annotation", 'General') # type: Final | ||||||
NO_UNTYPED_CALL = ErrorCode( | ||||||
'no-untyped-call', | ||||||
"Disallow calling functions without type annotations from annotated functions", | ||||||
'General') # type: Final | ||||||
REDUNDANT_CAST = ErrorCode( | ||||||
'redundant-cast', "Check that cast changes type of expression", 'General') # type: Final | ||||||
COMPARISON_OVERLAP = ErrorCode( | ||||||
'comparison-overlap', | ||||||
"Check that types in comparisons have overlap", 'General') # type: Final | ||||||
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. Also membership checks? I mean: x: int
lst: List[str]
x in lst # Error here: non-overlapping types |
||||||
NO_ANY_UNIMPORTED = ErrorCode( | ||||||
'no-any-unimported', 'Reject "Any" types from unfollowed imports', 'General') # type: Final | ||||||
NO_ANY_RETURN = ErrorCode( | ||||||
'no-any-return', 'Reject returning value with "Any" type if return type is not "Any"', | ||||||
'General') # type: Final | ||||||
|
||||||
SYNTAX = ErrorCode( | ||||||
'syntax', "Report syntax errors", 'General') # type: Final | ||||||
|
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.
This is a bit too terse, I would phrase this as: