@@ -77,9 +77,8 @@ def should_capitalize_replacement(original, start_index, replacement):
7777 should_capitalize = False
7878 if start_index == 0 or (start_index >= 2 and original [start_index - 2 :start_index ] == '. ' ):
7979 if replacement and replacement [0 ].islower ():
80- return replacement [0 ].upper () + replacement [1 :]
81- should_capitalize = True
82- return replacement , should_capitalize
80+ should_capitalize = True
81+ return should_capitalize
8382
8483def detect_passive_voice_with_spacy (text ):
8584 """
@@ -126,7 +125,7 @@ def detect_passive_voice_with_spacy(text):
126125
127126 # Create active voice suggestion
128127 # Capitalize if at start of sentence
129- active_suggestion , should_capitalize = should_capitalize_replacement (text , passive_span .start_char , active_suggestion )
128+ should_capitalize = should_capitalize_replacement (text , passive_span .start_char , active_suggestion )
130129 if should_capitalize :
131130 active_suggestion = active_suggestion [0 ].upper () + active_suggestion [1 :]
132131
@@ -255,8 +254,9 @@ def check_style(content, file_path, style_rules):
255254
256255 # Get the matched text
257256 # Determine if replacement should be capitalized
258- replacement , should_capitalize = should_capitalize_replacement (line , match .start (), rule ["replacement" ])
259- if replacement and should_capitalize :
257+ replacement = rule ["replacement" ]
258+ should_capitalize = should_capitalize_replacement (line , match .start (), replacement )
259+ if should_capitalize :
260260 replacement = replacement [0 ].upper () + replacement [1 :]
261261
262262 # Apply the replacement
@@ -423,6 +423,10 @@ def main():
423423 all_suggestions .extend (suggestions )
424424 print (f"Checked { file_path } : Found { len (suggestions )} style issues" )
425425
426+ if not all_suggestions :
427+ print ("No style issues found in the checked files." )
428+ return
429+
426430 save_suggestions_to_file (all_suggestions , args .output )
427431 interactive_review (all_suggestions )
428432
0 commit comments