@@ -222,15 +222,6 @@ async def run_mypy(
222
222
if not line .startswith (str (typeshed_dir / "stubs" ))
223
223
)
224
224
225
- # Redact "note" lines which contain base_dir
226
- # Avoids noisy diffs when e.g., mypy points to a stub definition
227
- base_dir_re = (
228
- f"({ re .escape (str (ctx .get ().base_dir ))} "
229
- f"|{ re .escape (str (ctx .get ().base_dir .resolve ()))} )"
230
- ".*: note:"
231
- )
232
- output = re .sub (base_dir_re , "note:" , output )
233
-
234
225
# Avoids some noise in tracebacks
235
226
if "error: INTERNAL ERROR" in output :
236
227
output = re .sub ('File ".*/mypy' , 'File "' , output )
@@ -524,6 +515,21 @@ def _get_diff(self) -> str:
524
515
old_output = self .old_result .output
525
516
new_output = self .new_result .output
526
517
518
+ # Redact lines which contain essentially "{base_dir}.*" before a colon
519
+ # Avoids noisy diffs when e.g. a type checker points to a stub definition
520
+ base_dir_re = (
521
+ r"^(?P<header>[^:]*?)"
522
+ f"(?:{ re .escape (str (ctx .get ().base_dir .resolve ()))} "
523
+ f"|{ re .escape (str (ctx .get ().base_dir ))} )"
524
+ "[^:]*(?P<trailer>(:|$))"
525
+ )
526
+ old_output = re .sub (
527
+ base_dir_re , r"\g<header>...\g<trailer>" , old_output , flags = re .MULTILINE
528
+ )
529
+ new_output = re .sub (
530
+ base_dir_re , r"\g<header>...\g<trailer>" , new_output , flags = re .MULTILINE
531
+ )
532
+
527
533
old_lines = old_output .splitlines ()
528
534
new_lines = new_output .splitlines ()
529
535
0 commit comments