about summary refs log tree commit diff stats
path: root/utils/show-codequality.sh
blob: 7cbef473806dfca0d31fbd2a8fc314f801b48180 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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')"