@@ -846,8 +846,6 @@ def close(self) -> None:
846846 total = sum (len (lineset ) for lineset in self .linesets )
847847 duplicated = 0
848848 stats = self .linter .stats
849- original_name = self .linter .current_name
850- original_file = self .linter .current_file
851849 for num , couples in self ._compute_sims ():
852850 msg = []
853851 lineset = start_line = end_line = None
@@ -862,12 +860,13 @@ def close(self) -> None:
862860 # Attribute the message to the first involved module rather than
863861 # the last-checked module which may be unrelated (see #2368).
864862 first_module = min (c [0 ].name for c in couples )
865- self .linter .current_name = first_module
866- self .linter .current_file = self ._module_filepaths .get (first_module )
867- self .add_message ("R0801" , args = (len (couples ), "\n " .join (msg )))
863+ self .add_message (
864+ "R0801" ,
865+ args = (len (couples ), "\n " .join (msg )),
866+ module = first_module ,
867+ filepath = self ._module_filepaths .get (first_module ),
868+ )
868869 duplicated += num * (len (couples ) - 1 )
869- self .linter .current_name = original_name
870- self .linter .current_file = original_file
871870 stats .nb_duplicated_lines += int (duplicated )
872871 stats .percent_duplicated_lines += float (total and duplicated * 100.0 / total )
873872
0 commit comments