@@ -146,12 +146,13 @@ def output_json(
146146 json .dump (results , output , indent = 2 )
147147
148148
149- def output_rich ( # noqa: PLR0912 PLR0915 C901
149+ def output_rich ( # noqa: PLR0912 PLR0913 PLR0915 C901
150150 detections : Iterable [Detection ],
151151 console : Console ,
152152 min_similarity : float = 0.5 ,
153153 output_file : TextIO | None = None ,
154154 collapse_identical_lines_threshold : int = 10 ,
155+ edit_distance_threshold : float = 0.75 ,
155156) -> None :
156157 # If an output file is specified, create a new Console for it
157158 file_console = Console (file = output_file ) if output_file else console
@@ -232,14 +233,16 @@ def read_file_content(file: File) -> str:
232233 else :
233234 if diff_line .status == DiffLineStatus .COPIED :
234235 status_col = Text ("←" , style = "red reverse bold" )
236+ # calculate the normalized edit distance
237+ elif (
238+ diff_line .left is not None
239+ and diff_line .right is not None
240+ and normalized_edit_distance (diff_line .left , diff_line .right ) < edit_distance_threshold
241+ ):
242+ # the lines are at least 25% similar!
243+ status_col = Text ("↜" , style = "yellow reverse" )
235244 else :
236- # calculate the normalized edit distance
237- if diff_line .left is not None and diff_line .right is not None and \
238- normalized_edit_distance (diff_line .left , diff_line .right ) < 0.75 :
239- # the lines are at least 25% similar!
240- status_col = Text ("↜" , style = "yellow reverse" )
241- else :
242- status_col = Text ("✓" , style = "green reverse" )
245+ status_col = Text ("✓" , style = "green reverse" )
243246 if diff_line .left is None :
244247 left : ConsoleRenderable = Text ("" )
245248 else :
0 commit comments