@@ -236,9 +236,8 @@ def _build(
236236 options .show_error_end ,
237237 lambda path : read_py_file (path , cached_read ),
238238 options .show_absolute_path ,
239- options .enabled_error_codes ,
240- options .disabled_error_codes ,
241239 options .many_errors_threshold ,
240+ options ,
242241 )
243242 plugin , snapshot = load_plugins (options , errors , stdout , extra_plugins )
244243
@@ -422,7 +421,7 @@ def plugin_error(message: str) -> NoReturn:
422421 errors .raise_error (use_stdout = False )
423422
424423 custom_plugins : list [Plugin ] = []
425- errors .set_file (options .config_file , None )
424+ errors .set_file (options .config_file , None , options )
426425 for plugin_path in options .plugins :
427426 func_name = "plugin"
428427 plugin_dir : str | None = None
@@ -773,7 +772,7 @@ def correct_rel_imp(imp: ImportFrom | ImportAll) -> str:
773772 new_id = file_id + "." + imp .id if imp .id else file_id
774773
775774 if not new_id :
776- self .errors .set_file (file .path , file .name )
775+ self .errors .set_file (file .path , file .name , self . options )
777776 self .errors .report (
778777 imp .line , 0 , "No parent module -- cannot perform relative import" , blocker = True
779778 )
@@ -984,7 +983,7 @@ def write_deps_cache(
984983 error = True
985984
986985 if error :
987- manager .errors .set_file (_cache_dir_prefix (manager .options ), None )
986+ manager .errors .set_file (_cache_dir_prefix (manager .options ), None , manager . options )
988987 manager .errors .report (0 , 0 , "Error writing fine-grained dependencies cache" , blocker = True )
989988
990989
@@ -1048,7 +1047,7 @@ def generate_deps_for_cache(manager: BuildManager, graph: Graph) -> dict[str, di
10481047def write_plugins_snapshot (manager : BuildManager ) -> None :
10491048 """Write snapshot of versions and hashes of currently active plugins."""
10501049 if not manager .metastore .write (PLUGIN_SNAPSHOT_FILE , json .dumps (manager .plugins_snapshot )):
1051- manager .errors .set_file (_cache_dir_prefix (manager .options ), None )
1050+ manager .errors .set_file (_cache_dir_prefix (manager .options ), None , manager . options )
10521051 manager .errors .report (0 , 0 , "Error writing plugins snapshot" , blocker = True )
10531052
10541053
@@ -1151,7 +1150,7 @@ def _load_json_file(
11511150 result = json .loads (data )
11521151 manager .add_stats (data_json_load_time = time .time () - t1 )
11531152 except json .JSONDecodeError :
1154- manager .errors .set_file (file , None )
1153+ manager .errors .set_file (file , None , manager . options )
11551154 manager .errors .report (
11561155 - 1 ,
11571156 - 1 ,
@@ -2200,7 +2199,7 @@ def parse_inline_configuration(self, source: str) -> None:
22002199 if flags :
22012200 changes , config_errors = parse_mypy_comments (flags , self .options )
22022201 self .options = self .options .apply_changes (changes )
2203- self .manager .errors .set_file (self .xpath , self .id )
2202+ self .manager .errors .set_file (self .xpath , self .id , self . options )
22042203 for lineno , error in config_errors :
22052204 self .manager .errors .report (lineno , 0 , error )
22062205
@@ -2711,7 +2710,7 @@ def module_not_found(
27112710 errors = manager .errors
27122711 save_import_context = errors .import_context ()
27132712 errors .set_import_context (caller_state .import_context )
2714- errors .set_file (caller_state .xpath , caller_state .id )
2713+ errors .set_file (caller_state .xpath , caller_state .id , caller_state . options )
27152714 if target == "builtins" :
27162715 errors .report (
27172716 line , 0 , "Cannot find 'builtins' module. Typeshed appears broken!" , blocker = True
@@ -2741,7 +2740,7 @@ def skipping_module(
27412740 assert caller_state , (id , path )
27422741 save_import_context = manager .errors .import_context ()
27432742 manager .errors .set_import_context (caller_state .import_context )
2744- manager .errors .set_file (caller_state .xpath , caller_state .id )
2743+ manager .errors .set_file (caller_state .xpath , caller_state .id , manager . options )
27452744 manager .errors .report (line , 0 , f'Import of "{ id } " ignored' , severity = "error" )
27462745 manager .errors .report (
27472746 line ,
@@ -2760,7 +2759,7 @@ def skipping_ancestor(manager: BuildManager, id: str, path: str, ancestor_for: S
27602759 # But beware, some package may be the ancestor of many modules,
27612760 # so we'd need to cache the decision.
27622761 manager .errors .set_import_context ([])
2763- manager .errors .set_file (ancestor_for .xpath , ancestor_for .id )
2762+ manager .errors .set_file (ancestor_for .xpath , ancestor_for .id , manager . options )
27642763 manager .errors .report (
27652764 - 1 , - 1 , f'Ancestor package "{ id } " ignored' , severity = "error" , only_once = True
27662765 )
@@ -2994,7 +2993,7 @@ def load_graph(
29942993 except ModuleNotFound :
29952994 continue
29962995 if st .id in graph :
2997- manager .errors .set_file (st .xpath , st .id )
2996+ manager .errors .set_file (st .xpath , st .id , manager . options )
29982997 manager .errors .report (
29992998 - 1 ,
30002999 - 1 ,
0 commit comments