Commit de7af21
committed
Clear where non-American English appears
Previously, the hook could notify us when non-American English words
were used in a commit, but it did not output the exact words that needed
correction. Additionally, the warning line number was always set to a
constant value of 1.
This commit enhances the functionality by providing the exact line
number and the corresponding word that triggered the warning. This
allows users to quickly and clearly identify which word is causing the
issue.
Implementation Details:
The function 'get_match_position' is designed to find the first
occurrence of a target string in a multi-line text. It takes the text,
target string, starting line, and starting column as input, and returns
the line and column where the target is found.
The 'get_all_match_positions' function iterates through multiple target
words, using 'get_match_position' to locate each word’s first
occurrence. The function maintains a cursor ('start_line' and
'start_col'), ensuring that searches for subsequent words continue from
the last found position. The output format is 'target: line,column"',
making it easier to pinpoint problematic words.
Change-Id: If6cbb943ac5ee5b450486686f32ad55ed1d4f2341 parent bb50402 commit de7af21
1 file changed
+64
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
127 | 175 | | |
128 | 176 | | |
129 | 177 | | |
| |||
350 | 398 | | |
351 | 399 | | |
352 | 400 | | |
| 401 | + | |
| 402 | + | |
353 | 403 | | |
354 | 404 | | |
355 | 405 | | |
| |||
372 | 422 | | |
373 | 423 | | |
374 | 424 | | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
375 | 428 | | |
376 | 429 | | |
377 | 430 | | |
378 | 431 | | |
379 | | - | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
380 | 443 | | |
381 | 444 | | |
382 | 445 | | |
| |||
0 commit comments