Skip to content

Commit 13b495d

Browse files
committed
Grouping
1 parent de7de35 commit 13b495d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test-spelling-unknown-words

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,14 @@ xargs_zero() {
8686
args="$*" "$spellchecker/xargs_zero"
8787
fi
8888
}
89+
echo '::group::Spell check'
8990
(git 'ls-files' -z 2> /dev/null) |\
9091
"$spellchecker/exclude.pl" |\
9192
xargs_zero "$word_splitter" |\
9293
"$word_splitter" |\
9394
perl -p -n -e 's/ \(.*//' > "$run_output"
9495
word_splitter_status="${PIPESTATUS[2]} ${PIPESTATUS[3]}"
96+
echo "::endgroup::"
9597
if [ "$word_splitter_status" != '0 0' ]; then
9698
echo "$word_splitter failed ($word_splitter_status)"
9799
exit 2
@@ -202,6 +204,8 @@ bullet_words() {
202204
fi
203205
if [ -s "$run_warnings.raw" ]; then
204206
(
207+
echo '::endgroup::'
208+
echo '::group::Misspellings'
205209
echo "::add-matcher::.git/reporter.json"
206210
cat "$run_warnings.raw"
207211
echo "::remove-matcher owner=jsoref-spelling::"
@@ -246,6 +250,7 @@ comment() {
246250
}
247251

248252
if [ ! -e "$whitelist_path" ]; then
253+
echo '::group::No whitelist'
249254
title="No preexisting $whitelist_path file"
250255
instructions=$(
251256
echo 'cat > '"$whitelist_path"' <<EOF=EOF'
@@ -254,22 +259,30 @@ if [ ! -e "$whitelist_path" ]; then
254259
to_publish_whitelist
255260
)
256261
spelling_info "$title" "$(bullet_words "$(cat "$run_output")")" "$instructions"
262+
echo '::endgroup::'
257263
quit 2
258264
fi
265+
266+
echo '::group::Compare whitelist with new output'
259267
sorted_whitelist="$temp/$(basename $whitelist_path)"
260268
(sort -u -f "$whitelist_path" | grep . || true) > "$sorted_whitelist"
261269
whitelist_path="$sorted_whitelist"
262270

263271
diff_output=$(diff -U0 "$whitelist_path" "$run_output" |grep -v "$spellchecker" || true)
272+
echo '::endgroup::'
264273

265274
if [ -z "$diff_output" ]; then
275+
echo '::group::No misspellings'
266276
title="No new words with misspellings found"
267277
spelling_info "$title" "There are currently $(wc -l $whitelist_path|sed -e 's/ .*//') whitelisted items." ""
278+
echo '::endgroup::'
268279
quit 0
269280
fi
270281

282+
echo '::group::New output'
271283
new_output=$(diff -i -U0 "$whitelist_path" "$run_output" |grep -v "$spellchecker" |\
272284
perl -n -w -e 'next unless /^\+/; next if /^\+{3} /; s/^.//; print;')
285+
echo '::endgroup::'
273286

274287
make_instructions() {
275288
patch_remove=$(echo "$diff_output" | perl -ne 'next unless s/^-([^-])/$1/; print')
@@ -293,16 +306,20 @@ make_instructions() {
293306
}
294307

295308
if [ -z "$new_output" ]; then
309+
echo '::group::Fewer misspellings'
296310
title='There are now fewer misspellings than before'
297311
instructions=$(
298312
make_instructions
299313
)
300314
spelling_info "$title" "$(bullet_words "$(new_words "$diff_output")")" "$instructions"
315+
echo '::endgroup::'
301316
quit
302317
fi
318+
echo '::group::New misspellings'
303319
title='New misspellings found, please review'
304320
instructions=$(
305321
make_instructions
306322
)
307323
spelling_warning "$title" "$(bullet_words "$new_output")" "$instructions"
324+
echo '::endgroup::'
308325
quit 1

0 commit comments

Comments
 (0)