Skip to content

Commit f3ff212

Browse files
committed
format
Signed-off-by: Gregor Zeitlinger <[email protected]>
1 parent f88917c commit f3ff212

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

scripts/lint-bom.sh

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,66 +3,66 @@
33
set -euo pipefail
44

55
function first_artifact_id() {
6-
local bom_file="$1"
7-
grep '<artifactId>' "$bom_file" | head -n 2 | tail -n 1 | sed 's/.*<artifactId>\(.*\)<\/artifactId>.*/\1/'
6+
local bom_file="$1"
7+
grep '<artifactId>' "$bom_file" | head -n 2 | tail -n 1 | sed 's/.*<artifactId>\(.*\)<\/artifactId>.*/\1/'
88
}
99

1010
function add_dir() {
11-
local dir="$1"
12-
if [[ ! -d "$dir" ]]; then
13-
echo "Directory $dir does not exist."
14-
exit 1
15-
fi
11+
local dir="$1"
12+
if [[ ! -d "$dir" ]]; then
13+
echo "Directory $dir does not exist."
14+
exit 1
15+
fi
1616

17-
if [[ $ignore_dirs =~ $dir ]]; then
18-
echo "Skipping $dir"
19-
return
20-
fi
17+
if [[ $ignore_dirs =~ $dir ]]; then
18+
echo "Skipping $dir"
19+
return
20+
fi
2121

22-
if [[ ! -f "$dir/pom.xml" ]]; then
23-
echo "File $dir/pom.xml does not exist."
24-
exit 1
25-
fi
22+
if [[ ! -f "$dir/pom.xml" ]]; then
23+
echo "File $dir/pom.xml does not exist."
24+
exit 1
25+
fi
2626

27-
artifact_id=$(first_artifact_id "$dir/pom.xml")
28-
if [[ -z "$artifact_id" ]]; then
29-
echo "No artifactId found in $dir/pom.xml"
30-
exit 1
31-
fi
27+
artifact_id=$(first_artifact_id "$dir/pom.xml")
28+
if [[ -z "$artifact_id" ]]; then
29+
echo "No artifactId found in $dir/pom.xml"
30+
exit 1
31+
fi
3232

33-
echo "Found artifactId '$artifact_id' in $dir/pom.xml"
34-
# add to want
35-
if [[ -z "${want+x}" ]]; then
36-
want="$artifact_id"
37-
else
38-
want="$want
33+
echo "Found artifactId '$artifact_id' in $dir/pom.xml"
34+
# add to want
35+
if [[ -z "${want+x}" ]]; then
36+
want="$artifact_id"
37+
else
38+
want="$want
3939
$artifact_id"
40-
fi
40+
fi
4141
}
4242

4343
declare want
4444
ignore_dirs="prometheus-metrics-parent"
4545

4646
for dir in prometheus-metrics*; do
47-
add_dir "$dir"
47+
add_dir "$dir"
4848
done
49-
for dir in prometheus-metrics-tracer/prometheus-metrics* ; do
50-
if [[ -d "$dir" ]]; then
51-
add_dir "$dir"
52-
fi
49+
for dir in prometheus-metrics-tracer/prometheus-metrics*; do
50+
if [[ -d "$dir" ]]; then
51+
add_dir "$dir"
52+
fi
5353
done
5454

5555
want=$(echo "$want" | sort | uniq)
56-
have="$(grep '<artifactId>prometheus-metrics' prometheus-metrics-bom/pom.xml | sed 's/.*<artifactId>\(.*\)<\/artifactId>.*/\1/'| sort)"
56+
have="$(grep '<artifactId>prometheus-metrics' prometheus-metrics-bom/pom.xml | sed 's/.*<artifactId>\(.*\)<\/artifactId>.*/\1/' | sort)"
5757

5858
if [[ "$want" != "$have" ]]; then
59-
echo "The BOM file prometheus-metrics-bom/bom.xml does not match the current directory contents."
60-
echo "Expected: $want"
61-
echo "Found: $have"
59+
echo "The BOM file prometheus-metrics-bom/bom.xml does not match the current directory contents."
60+
echo "Expected: $want"
61+
echo "Found: $have"
6262

63-
diff -u <(echo "$have" ) <(echo "$want")
63+
diff -u <(echo "$have") <(echo "$want")
6464

65-
exit 1
65+
exit 1
6666
else
67-
echo "BOM file is up to date."
67+
echo "BOM file is up to date."
6868
fi

0 commit comments

Comments
 (0)