Skip to content

Commit a4ec49e

Browse files
author
MomIsBestFriend
committed
Added more logic to 'strings_with_wrong_placed_space'
1 parent b60f5ee commit a4ec49e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

scripts/validate_string_concatenation.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,16 @@ def strings_with_wrong_placed_space(
122122
first_string = first_token[1][1:-1]
123123
second_string = third_token[1][1:-1]
124124

125-
if ((not first_string.endswith(" ")) and second_string.startswith(" ")) and (
126-
not second_string.startswith(" ")
127-
):
125+
is_first_ends_single: bool = first_string.endswith(" ")
126+
is_first_ends_newline: bool = first_string.endswith("\n")
127+
is_second_starts_single: bool = second_string.startswith(" ")
128+
is_second_starts_double: bool = second_string.startswith(" ")
129+
130+
if (
131+
(not is_first_ends_single)
132+
and is_second_starts_single
133+
and (not is_second_starts_double)
134+
) and (not is_first_ends_newline):
128135
yield (
129136
source_path,
130137
third_token[2][0],

0 commit comments

Comments
 (0)