smoke_test.sh: attribute the definition complexity to proper line

text_sliders
Ondra Pelech 2023-05-25 01:33:51 +07:00
parent 2a5b9ba617
commit 426910ed55
1 changed files with 3 additions and 2 deletions

@ -61,13 +61,14 @@ check_complexity () {
top=$(echo "$out" | head -n 1 | sed 's/ \+/ /g')
top_definition=$(echo "$top" | cut -d' ' -f1)
top_definition_line=$(grep -n "$top_definition:" grammar.js | head -n 1 | cut -d : -f 1)
actual=$(echo "$top" | cut -d' ' -f2)
echo "$top_definition $actual"
if (( $(echo "$actual < $expected" |bc -l) )); then
# See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#example-creating-an-annotation-for-an-error
echo -e "::notice file=grammar.js,line=1::ok, complexity of definition ${top_definition}: ${actual}, lower than $expected"
echo -e "::notice file=grammar.js,line=$top_definition_line::ok, complexity of definition ${top_definition}: ${actual}, lower than $expected"
else
echo -e "::error file=grammar.js,line=1::complexity for definition ${top_definition}: expected at most ${expected}, but got ${actual} instead"
echo -e "::error file=grammar.js,line=$top_definition_line::complexity for definition ${top_definition}: expected at most ${expected}, but got ${actual} instead"
failed=$((failed + 1))
fi
}