File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 1
1
"""
2
-
3
2
Enforce that all usages of tm.assert_produces_warning use
4
3
the "match" argument. This will help ensure that users always see
5
4
the correct warning message.
8
7
and tm.assert_produces_warning(False) are excluded as no warning is
9
8
produced.
10
9
10
+ This is meant to be run as a pre-commit hook - to run it manually, you can do:
11
+
12
+ pre-commit run enforce-match-arg-in-assert-produces-warning --all-files
11
13
"""
12
14
13
15
@@ -68,14 +70,14 @@ def main(argv: Sequence[str] | None = None) -> None:
68
70
parser .add_argument ("paths" , nargs = "*" )
69
71
70
72
args = parser .parse_args (argv )
71
- isMatchMissing = False
73
+ is_match_missing = False
72
74
73
75
for filename in args .paths :
74
76
with open (filename , encoding = "utf-8" ) as fd :
75
77
content = fd .read ()
76
- isMatchMissing = check_for_match_arg (content , filename ) | isMatchMissing
78
+ is_match_missing = check_for_match_arg (content , filename ) | is_match_missing
77
79
78
- if isMatchMissing :
80
+ if is_match_missing :
79
81
sys .exit (1 )
80
82
81
83
You can’t perform that action at this time.
0 commit comments