Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: skip oclint analysis on source directories without objc #236

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
language: java
jdk:
- oraclejdk8
- openjdk11
21 changes: 12 additions & 9 deletions sonar-swift-plugin/src/main/shell/run-sonar-swift.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
davidy4ng marked this conversation as resolved.
Show resolved Hide resolved
else
echo "$word has no Objective-C, skipping..."
fi
done < tmpFileRunSonarSh
rm -rf tmpFileRunSonarSh

Expand Down