YorkShen commented on a change in pull request #2731: Add Lint in TravisCI and 
Update iOS TravisCI
URL: https://github.com/apache/incubator-weex/pull/2731#discussion_r310035192
 
 

 ##########
 File path: .travis.yml
 ##########
 @@ -87,29 +137,70 @@ script:
             GRADLE_ABI=""
             ;;
         esac
-
-        hasAndroidFile=$(npm run danger -- run --dangerfile 
./dangerfile-android.js)
-        echo "The value of hasAndroidFile is ${hasAndroidFile}"
-        if [[ "$hasAndroidFile" =~ "hasAndroidFile" ]]; then
+        if npm run danger -- ci --dangerfile ./dangerfile-android.js | grep -q 
"hasAndroidFile" ; then
           cd android
           ./gradlew clean install -PbuildRuntimeApi=true ${GRADLE_ABI} --info
           ./gradlew install -PbuildRuntimeApi=false ${GRADLE_ABI} --info
         fi
         ;;
       "jsfm" )
-        npm run danger -- run --dangerfile ./dangerfile-jsfm.js
+        npm run danger -- ci -i jsfm --dangerfile ./dangerfile-jsfm.js
         ;;
       "danger" )
-        npm run danger -- run --dangerfile ./dangerfile.js
+        npm run danger -- ci -i danger --dangerfile ./dangerfile.js
         ;;
       "ios" )
-        hasIosFile=$(npm run danger -- run --dangerfile ./dangerfile-ios.js)
-        echo "The value of hasIosFile is ${hasIosFile}"
-        if [[ "$hasIosFile" =~ "hasIosFile" ]]; then
-          xcodebuild -project ios/sdk/WeexSDK.xcodeproj test -scheme 
WeexSDKTests CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -destination 
"platform=iOS Simulator,name=iPhone 6"
+        if npm run danger -- ci --dangerfile ./dangerfile-ios.js | grep -q 
"hasIosFile" ; then
+          # build WeexSDK and run WeexSDKTests
+          xcodebuild -quiet -project ios/sdk/WeexSDK.xcodeproj test -scheme 
WeexSDKTests CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -destination 
"platform=iOS Simulator,name=iPhone 6" || exit 1
+          # build WeexDemo and run WeexDemo test
+          cd weex-playground/ios && mkdir tmp && mv * tmp;cd tmp
+          xcodebuild -quiet -workspace WeexDemo.xcworkspace test -scheme 
WeexDemo CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -destination 
"platform=iOS Simulator,name=iPhone 6" || exit 1
         fi
         ;;
     esac
+    
+    if [[ ("$TEST_SUITE" = "static_code_analysis") && ("${OCLINT}" = "true") 
]]; then
+      if npm run danger -- ci --dangerfile ./dangerfile-static-check.js | grep 
-q "hasCFile" ; then
+        echo "hasCFile"
+        cd ios/sdk && xcodebuild | xcpretty -r json-compilation-database -o 
compile_commands.json
+        oclint-json-compilation-database oclint_args -- \
+          -disable-rule=ShortVariableName \
+          -disable-rule=LongLine \
+          -disable-rule=LongMethod \
+          -disable-rule=HighNcssMethod \
+          -disable-rule=LongVariableName \
+          -disable-rule=HighCyclomaticComplexity \
+          -disable-rule=HighNPathComplexity \
+          -disable-rule=UnusedLocalVariable \
+          -disable-rule=DoubleNegative \
+          -disable-rule=MultipleUnaryOperator \
+          -disable-rule=DeepNestedBlock \
+          -disable-rule=AssignIvarOutsideAccessors \
+          -disable-rule=BitwiseOperatorInConditional \
+          -max-priority-1=15000 \
+          -max-priority-2=15000 \
+          -max-priority-3=15000 > oclint.log
+        export TITLE="OCLint Result"
+        cd ../../ && npm run danger -- ci -i oclint --dangerfile 
./dangerfile-output.js
+      fi
+    fi 
+
+    if [[ ("$TEST_SUITE" = "static_code_analysis") && ("${ANDROID_LINT}" = 
"true") ]]; then
+      if npm run danger -- ci --dangerfile ./dangerfile-static-check.js | grep 
-q "hasAndroidFile" ; then
+        echo "hasAndroidFile"
+        cd android
+        ./gradlew lint --quiet
 
 Review comment:
   Change to
   `./gradlew :weex_sdk:lint --quiet`, which will only execute lint for 
weex_sdk, not playground.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to