Skip to content

Commit

Permalink
Escape Characters
Browse files Browse the repository at this point in the history
  • Loading branch information
bentonam committed Apr 4, 2024
1 parent 442d435 commit 3101332
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/lint-river.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ while read -r file; do
# Process each line here
line=$(echo "${row}" | awk -F ':' '{print $2}')
column=$(echo "${row}" | awk -F ':' '{print $3}')
error=$(echo "${row}" | cut -d':' -f4- | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | sed -e 's/"/\"/g')
error=$(echo "${row}" | cut -d':' -f4- | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | sed -e 's/"/\"/g' | xargs)
checkstyle="${checkstyle}<error line=\"${line}\" column=\"${column}\" severity=\"error\" message=\"${error}\" source=\"grafana-agent\"/>"
# output to console only if the format is console
if [[ "${format}" == "console" ]]; then
echo " - ${row}"
fi
done <<< "${message}"
checkstyle="${checkstyle}\n </file>"
checkstyle="${checkstyle}</file>"
fi
# only override the statusCode if it is 0
if [[ "${statusCode}" == 0 ]]; then
Expand All @@ -73,7 +73,7 @@ done < <(find . -type f -name "*.river" -not -path "./node_modules/*" -not -path
checkstyle="${checkstyle}</checkstyle>"

if [[ "${format}" == "checkstyle" ]]; then
echo "${checkstyle}" | sed 's/\x1B//g' || true
echo "${checkstyle}" | sed 's/&#x1A;//g' || true

Check notice on line 76 in tools/lint-river.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] tools/lint-river.sh#L76 <ShellCheck.SC2001>

See if you can use ${variable//search/replace} instead.
Raw output
./tools/lint-river.sh:76:3: info: See if you can use ${variable//search/replace} instead. (ShellCheck.SC2001)
fi

echo ""
Expand Down

0 comments on commit 3101332

Please sign in to comment.