about summary refs log tree commit diff stats
path: root/utils/show-codequality.sh
diff options
context:
space:
mode:
Diffstat (limited to 'utils/show-codequality.sh')
-rw-r--r--utils/show-codequality.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/utils/show-codequality.sh b/utils/show-codequality.sh
new file mode 100644
index 0000000..7cbef47
--- /dev/null
+++ b/utils/show-codequality.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+FILE="${1:-gl-codequality.json}"
+
+if [ ! -f "$FILE" ]; then
+  echo "Error: $FILE not found"
+  exit 1
+fi
+
+COUNT=$(jq 'length' "$FILE")
+
+if [ "$COUNT" -eq 0 ]; then
+  echo "No issues found."
+  exit 0
+fi
+
+echo "Found $COUNT issue(s):"
+echo ""
+
+jq -r '.[] |
+  [.location.path,
+   (.location.positions.begin.line | tostring),
+   (.location.positions.begin.column | tostring),
+   .severity,
+   .check_name,
+   .description | gsub("\\n"; "") ] |
+  @tsv' "$FILE" | column -t -s "$(printf '\t')"