-
Notifications
You must be signed in to change notification settings - Fork 0
/
mypy.ini
123 lines (86 loc) · 5.64 KB
/
mypy.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#-----------------------------------------------------------------------------------------------------------------------
#
# Mypy Configuration File
#
#
# Description:
#
# This file contains the Mypy configuration used when linting Python code.
#
# This file defines the default configuration and behavior when performing the static type analysis on the specified
# Python programs. This determines the strictness of type checking.
#
#-----------------------------------------------------------------------------------------------------------------------
[mypy]
#-----------------------------------------------------------------------------------------------------------------------
# Import Discovery Options
#-----------------------------------------------------------------------------------------------------------------------
# When encountering an import in a file that's being checked, follow the imported module and type check its contents
# as well. This is necessary so that the types of imported functions, variables, etc. can be determined. If there
# are any type errors in the imported files, they will be reported.
follow_imports = normal
#-----------------------------------------------------------------------------------------------------------------------
# Untyped Definitions and Calls Options
#-----------------------------------------------------------------------------------------------------------------------
# Disallow calling functions without type annotations from functions that have type annotations.
disallow_untyped_calls = True
# Disallow defining functions without or with incomplete type annotations.
disallow_untyped_defs = True
# Disallow defining functions with incomplete type annotations.
disallow_incomplete_defs = True
# Type check the interior of functions even if they are missing type annotations.
check_untyped_defs = True
#-----------------------------------------------------------------------------------------------------------------------
# None and Optional Handling Options
#-----------------------------------------------------------------------------------------------------------------------
# Do not implicitly make an argument's type optional if its default value is None. Instead, the user must manually
# annotate the argument as `Optional[T]`.
no_implicit_optional = True
# Use strict optional checking, which means None is not treated as compatible with every type.
strict_optional = True
#-----------------------------------------------------------------------------------------------------------------------
# Configuring Warnings Options
#-----------------------------------------------------------------------------------------------------------------------
# Enable warnings when an expression is casted to its inferred type.
warn_redundant_casts = True
# Warn about unused Mypy suppressions (comments of the form `# type: ignore`).
warn_unused_ignores = True
# Warn when return statements are missing on some execution paths.
warn_no_return = True
# Warn when a function returns a value of type `Any` when its declared return type is not `Any`.
warn_return_any = True
# Warn when any code is inferred to be unreachable after preforming type analysis.
warn_unreachable = True
#-----------------------------------------------------------------------------------------------------------------------
# Miscellaneous Strictness Flags
#-----------------------------------------------------------------------------------------------------------------------
# Do not allow global and class variables to be untyped.
allow_untyped_globals = False
# Do not allow variables to be redefined with an arbitrary type. Assignments after the initial definition must match
# the inferred or declared type.
allow_redefinition = False
# Do not allow equality, identity, or container (i.e. `in`) checks between non-overlapping types.
strict_equality = True
#-----------------------------------------------------------------------------------------------------------------------
# Configuring Error Messages Options
#-----------------------------------------------------------------------------------------------------------------------
# Prefix each error displayed in the output with the relevant context, which is the function name and other relevant
# information to where the error occurred.
show_error_context = True
# Show the column numbers (character in the line) in the error messages.
show_column_numbers = True
# Show the error codes corresponding to the error messages (i.e. `no-any-return`). This allows users to easily
# suppress the error message if they desire with the ignore comment (i.e. `# type: ignore[no-any-return]`).
show_error_codes = True
# Use pretty output for the error messages. This uses soft word wrap, the displaying of source code snippets, and
# error location markers (^) to indicate where the error occurred in the source code.
pretty = True
# Show the error messages with terminal colors enabled.
color_output = True
# Display a short summary line after the error messages to indicate the total number of errors and warnings.
error_summary = True
#-----------------------------------------------------------------------------------------------------------------------
# Miscellaneous Options
#-----------------------------------------------------------------------------------------------------------------------
# Warn when per-module sections in this configuration file do not match any of the files processed.
warn_unused_configs = True