-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsonar-script.sh
More file actions
executable file
·35 lines (25 loc) · 857 Bytes
/
sonar-script.sh
File metadata and controls
executable file
·35 lines (25 loc) · 857 Bytes
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
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
if [ "$1" == "" ]; then
echo "Repo name missing!";
exit;
fi
if [ "$2" == "" ]; then
echo "Repo url missing!";
exit;
fi
cd ~/Desktop/commits
if [ ! -f "$1.txt" ]; then
sqlite3 ~/projects/githubgrabber/database/database.sqlite "select commits.sha from commits inner join repos on repos.id = commits.repo_id AND repos.name = '"$1"' order by committed_at ASC;" > "$1.txt"
fi
if [ ! -d "$1" ]; then
git clone "$2"
fi
cd "$1"
while IFS='' read -r line || [[ -n "$line" ]]; do
out=$(git checkout "$line" 2>&1)
find="HEAD is now"
if echo "$out" | grep -q "$find"; then
#sonar analysis
sonar-runner -Dsonar.projectKey="$1:$line" -Dsonar.projectName="$1:$line" -Dsonar.projectVersion="$line" -Dsonar.sources=. -Dsonar.language=php -Dsonar.sourceEncoding=UTF-8
fi
done < "../$1.txt"