forked from nixel2007/vsc-language-1c-bsl
-
Notifications
You must be signed in to change notification settings - Fork 35
/
sonar.sh
executable file
·34 lines (29 loc) · 1.3 KB
/
sonar.sh
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
#!/bin/bash
function jsonval {
temp=`cat $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop | cut -d":" -f2| sed -e 's/^ *//g' -e 's/ *$//g' `
version=${temp##*|}
}
json=package.json
prop='version'
jsonval
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]] && [[ "$TRAVIS_REPO_SLUG" == 1c-syntax* ]]; then
sonar-scanner \
-Dsonar.projectKey=vsc-language-bsl-plugin \
-Dsonar.organization=1c-syntax \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.pullrequest.provider=github \
-Dsonar.pullrequest.github.repository=$TRAVIS_REPO_SLUG \
-Dsonar.pullrequest.github.endpoint=https://api.github.com \
-Dsonar.pullRequest.branch=$TRAVIS_PULL_REQUEST_BRANCH \
-Dsonar.pullRequest.key=$TRAVIS_PULL_REQUEST \
-Dsonar.pullRequest.base=$TRAVIS_BRANCH \
-Dsonar.scanner.skip=false
elif [[ "$TRAVIS_BRANCH" == "develop" ]] && [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then
sonar-scanner \
-Dsonar.projectKey=vsc-language-bsl-plugin \
-Dsonar.organization=1c-syntax \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.projectVersion=$version \
-Dsonar.branch.name=$TRAVIS_BRANCH \
-Dsonar.scanner.skip=false
fi