From 688188917858a36840c3ca369fc364607b8710df Mon Sep 17 00:00:00 2001 From: David Yang Date: Tue, 16 Jul 2019 16:04:46 +0200 Subject: [PATCH 1/2] Fix: skip oclint analysis on source directories without objc --- .../src/main/shell/run-sonar-swift.sh | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/sonar-swift-plugin/src/main/shell/run-sonar-swift.sh b/sonar-swift-plugin/src/main/shell/run-sonar-swift.sh index 44640803..7fe1ec8b 100755 --- a/sonar-swift-plugin/src/main/shell/run-sonar-swift.sh +++ b/sonar-swift-plugin/src/main/shell/run-sonar-swift.sh @@ -418,15 +418,18 @@ if [ "$oclint" = "on" ] && [ "$hasObjC" = "yes" ]; then currentDirectory=${PWD##*/} echo "$srcDirs" | sed -n 1'p' | tr ',' '\n' > tmpFileRunSonarSh while read word; do - - includedCommandLineFlags=" --include .*/${currentDirectory}/${word}" - if [ "$vflag" = "on" ]; then - echo - echo -n "Path included in oclint analysis is:$includedCommandLineFlags" - fi - # Run OCLint with the right set of compiler options - runCommand no oclint-json-compilation-database -v $includedCommandLineFlags -- -rc LONG_LINE=$longLineThreshold -max-priority-1 $maxPriority -max-priority-2 $maxPriority -max-priority-3 $maxPriority -report-type pmd -o sonar-reports/$(echo $word | sed 's/\//_/g')-oclint.xml - + numberOfObjcFiles=$(find "${word}/" -name '*.m' | wc -l | tr -d ' ') + if [ $numberOfObjcFiles -gt 0 ]; then + includedCommandLineFlags=" --include .*/${currentDirectory}/${word}" + if [ "$vflag" = "on" ]; then + echo + echo -n "Path included in oclint analysis is:$includedCommandLineFlags" + fi + # Run OCLint with the right set of compiler options + runCommand no oclint-json-compilation-database -v $includedCommandLineFlags -- -rc LONG_LINE=$longLineThreshold -max-priority-1 $maxPriority -max-priority-2 $maxPriority -max-priority-3 $maxPriority -report-type pmd -o sonar-reports/$(echo $word | sed 's/\//_/g')-oclint.xml + else + echo "$word has no Objective-C, skipping..." + fi done < tmpFileRunSonarSh rm -rf tmpFileRunSonarSh From ce055c80fc758dc040ff37bb68522768644cf374 Mon Sep 17 00:00:00 2001 From: David Yang Date: Fri, 26 Jul 2019 20:16:21 +0200 Subject: [PATCH 2/2] use openjdk11 for travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9bcf9994..94d2a223 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,3 @@ language: java jdk: - - oraclejdk8 + - openjdk11