weex-bot commented on issue #2731: Add Lint in TravisCI and Update iOS TravisCI
URL: https://github.com/apache/incubator-weex/pull/2731#issuecomment-514051757
 
 
   <!--
     0 Errors
     1 Warning: Code style violations detected...
     0 Messages
     3 Markdowns
   -->
   <table>
     <thead>
       <tr>
         <th width="50"></th>
         <th width="100%" data-danger-table="true" data-kind="Warning">
             1 Warning
         </th>
        </tr>
     </thead>
     <tbody>
       <tr>
         <td>:warning:</td>
         <td data-sticky="false">Code style violations detected.</td>
       </tr>
     </tbody>
   </table>
   
   ### Code Style Check
   
   ---
   
   Code style violations detected in the following files:
   * `android/sdk/src/main/java/com/taobao/weex/adapter/ClassLoaderAdapter.java`
   
   * `android/sdk/src/main/java/com/taobao/weex/utils/WXSoInstallMgrSdk.java`
   
   * `android/sdk/src/main/java/com/taobao/weex/utils/WXUtils.java`
   
   * `ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m`
   
   * `ios/sdk/WeexSDK/Sources/Utility/WXVersion.m`
   
   Execute one of the following actions and commit again:
   1. Run `clang-format` on the offending files
   2. Apply the suggested patches with `git apply patch`.
   
   #### 
android/sdk/src/main/java/com/taobao/weex/adapter/ClassLoaderAdapter.java
   ```diff 
   --- android/sdk/src/main/java/com/taobao/weex/adapter/ClassLoaderAdapter.java
   +++ android/sdk/src/main/java/com/taobao/weex/adapter/ClassLoaderAdapter.java
   @@ -53,4 +53,3 @@
        }
    
    }
   -
   
   ``` 
   
   #### android/sdk/src/main/java/com/taobao/weex/utils/WXSoInstallMgrSdk.java
   ```diff 
   --- android/sdk/src/main/java/com/taobao/weex/utils/WXSoInstallMgrSdk.java
   +++ android/sdk/src/main/java/com/taobao/weex/utils/WXSoInstallMgrSdk.java
   @@ -73,7 +73,6 @@
      private final static String STARTUPSO = "/libweexjsb.so";
      private final static String STARTUPSOANDROID15 = "/libweexjst.so";
    
   -
      static Context mContext = null;
      private static IWXSoLoaderAdapter mSoLoader = null;
      private static IWXStatisticsListener mStatisticsListener = null;
   @@ -121,8 +120,8 @@
        copyStartUpSo();
    
        boolean InitSuc = false;
   -//    if (checkSoIsValid(libName, BuildConfig.ARMEABI_Size) 
||checkSoIsValid(libName, BuildConfig.X86_Size)) {
   -
   +    //    if (checkSoIsValid(libName, BuildConfig.ARMEABI_Size)
   +    //    ||checkSoIsValid(libName, BuildConfig.X86_Size)) {
    
        try {
          // If a library loader adapter exists, use this adapter to load 
library
   @@ -133,29 +132,28 @@
            System.loadLibrary("c++_shared");
          }
        } catch (Exception e) {
   -
        }
    
   -      /**
   -       * Load library with {@link System#loadLibrary(String)}
   -       */
   -      try {
   -        // If a library loader adapter exists, use this adapter to load 
library
   -        // instead of System.loadLibrary.
   -        if (mSoLoader != null) {
   -          mSoLoader.doLoadLibrary(libName);
   -        } else {
   -          System.loadLibrary(libName);
   -        }
   +    /**
   +     * Load library with {@link System#loadLibrary(String)}
   +     */
   +    try {
   +      // If a library loader adapter exists, use this adapter to load 
library
   +      // instead of System.loadLibrary.
   +      if (mSoLoader != null) {
   +        mSoLoader.doLoadLibrary(libName);
   +      } else {
   +        System.loadLibrary(libName);
   +      }
    
   -        InitSuc = true;
   +      InitSuc = true;
          } catch (Exception | Error e2) {
            if (cpuType.contains(ARMEABI) || cpuType.contains(X86)) {
   -          WXExceptionUtils.commitCriticalExceptionRT(null,
   -                  WXErrorCode.WX_KEY_EXCEPTION_SDK_INIT,
   -                  "initSo", "[WX_KEY_EXCEPTION_SDK_INIT_CPU_NOT_SUPPORT] 
for android cpuType is " +cpuType +
   -                          "\n Detail Error is: " +e2.getMessage(),
   -                  null);
   +          WXExceptionUtils.commitCriticalExceptionRT(
   +              null, WXErrorCode.WX_KEY_EXCEPTION_SDK_INIT, "initSo",
   +              "[WX_KEY_EXCEPTION_SDK_INIT_CPU_NOT_SUPPORT] for android 
cpuType is " +
   +                  cpuType + "\n Detail Error is: " + e2.getMessage(),
   +              null);
            }
            InitSuc = false;
          }
   @@ -164,18 +162,19 @@
    
            if (!InitSuc) {
    
   -          //File extracted from apk already exists.
   +          // File extracted from apk already exists.
              if (isExist(libName, version)) {
                boolean res = _loadUnzipSo(libName, version, utAdapter);
                if (res) {
                  return res;
                } else {
   -              //Delete the corrupt so library, and extract it again.
   +              // Delete the corrupt so library, and extract it again.
                  removeSoIfExit(libName, version);
                }
              }
    
   -          //Fail for loading file from libs, extract so library from so and 
load it.
   +          // Fail for loading file from libs, extract so library from so and
   +          // load it.
              if (cpuType.equalsIgnoreCase(MIPS)) {
                return false;
              } else {
   @@ -185,14 +184,13 @@
                  e2.printStackTrace();
                }
              }
   -
            }
          } catch (Exception | Error e) {
            InitSuc = false;
            e.printStackTrace();
          }
   -  //  }
   -    return InitSuc;
   +      //  }
   +      return InitSuc;
      }
    
      /**
   @@ -203,19 +201,24 @@
          boolean installOnSdcard = true;
          String pkgName = WXEnvironment.getApplication().getPackageName();
          // cp weexjsb any way
   -//      try {
   -//        PackageManager pm = 
WXEnvironment.getApplication().getApplicationContext().getPackageManager();
   -//        ApplicationInfo appInfo = pm.getApplicationInfo(pkgName, 0);
   -//        if ((appInfo.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0) 
{
   -//          // App on sdcard
   -//          installOnSdcard = true;
   -//        }
   -//      } catch (Throwable e) {
   -//      }
   +      //      try {
   +      //        PackageManager pm =
   +      //        
WXEnvironment.getApplication().getApplicationContext().getPackageManager();
   +      //        ApplicationInfo appInfo = pm.getApplicationInfo(pkgName, 0);
   +      //        if ((appInfo.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) 
!=
   +      //        0) {
   +      //          // App on sdcard
   +      //          installOnSdcard = true;
   +      //        }
   +      //      } catch (Throwable e) {
   +      //      }
    
          if (installOnSdcard) {
    
   -        String cacheFile = 
WXEnvironment.getApplication().getApplicationContext().getCacheDir().getPath();
   +        String cacheFile = WXEnvironment.getApplication()
   +                               .getApplicationContext()
   +                               .getCacheDir()
   +                               .getPath();
            // if android api < 16 copy libweexjst.so else copy libweexjsb.so
            boolean pieSupport = true;
            File newfile;
   @@ -230,22 +233,23 @@
    
            String jsbVersionFile = "jsb.version";
    
   -        File versionFile = new File(cacheFile,jsbVersionFile);
   +        File versionFile = new File(cacheFile, jsbVersionFile);
            Closeable r = null;
    
   -        if(newfile.exists() && versionFile.exists()) {
   +        if (newfile.exists() && versionFile.exists()) {
              try {
                FileReader fileReader = new FileReader(versionFile);
                r = fileReader;
                BufferedReader br = new BufferedReader(fileReader);
                String s = br.readLine();
   -            if(!TextUtils.isEmpty(s)) {
   -              boolean same = 
String.valueOf(WXEnvironment.CORE_JSB_SO_VERSION).equals(s.trim());
   -              if(same)
   +            if (!TextUtils.isEmpty(s)) {
   +              boolean same = 
String.valueOf(WXEnvironment.CORE_JSB_SO_VERSION)
   +                                 .equals(s.trim());
   +              if (same)
                    return;
                }
              } catch (FileNotFoundException e) {
   -            //do nothing and copy so file
   +            // do nothing and copy so file
              } finally {
                if (r != null)
                  r.close();
   @@ -266,15 +270,15 @@
    
            File oldfile = new File(soName);
    
   -
   -        if(!oldfile.exists()) {
   +        if (!oldfile.exists()) {
              try {
   -            String weexjsb = ((PathClassLoader) 
(WXSoInstallMgrSdk.class.getClassLoader())).findLibrary(startSoName);
   +            String weexjsb =
   +                
((PathClassLoader)(WXSoInstallMgrSdk.class.getClassLoader()))
   +                    .findLibrary(startSoName);
                oldfile = new File(weexjsb);
              } catch (Throwable throwable) {
                // do nothing
              }
   -
            }
    
            if (oldfile.exists()) {
   @@ -285,19 +289,18 @@
    
            Closeable w = null;
            try {
   -          if(!versionFile.exists())
   +          if (!versionFile.exists())
                versionFile.createNewFile();
              FileWriter fileWriter = new FileWriter(versionFile);
              w = fileWriter;
              
fileWriter.write(String.valueOf(WXEnvironment.CORE_JSB_SO_VERSION));
              fileWriter.flush();
   -        } catch (Exception e ) {
   +        } catch (Exception e) {
              // do nothing
            } finally {
   -          if(w != null)
   +          if (w != null)
                w.close();
            }
   -
          }
        } catch (Throwable e) {
          e.printStackTrace();
   @@ -314,14 +317,14 @@
      }
    
      private static String _cpuType() {
   -    String abi ;
   +    String abi;
        try {
          abi = Build.CPU_ABI;
   -    }catch (Exception e){
   +    } catch (Exception e) {
          e.printStackTrace();
          abi = ARMEABI;
        }
   -    if (TextUtils.isEmpty(abi)){
   +    if (TextUtils.isEmpty(abi)) {
          abi = ARMEABI;
        }
        abi = abi.toLowerCase();
   
   ``` 
   
   #### android/sdk/src/main/java/com/taobao/weex/utils/WXUtils.java
   ```diff 
   --- android/sdk/src/main/java/com/taobao/weex/utils/WXUtils.java
   +++ android/sdk/src/main/java/com/taobao/weex/utils/WXUtils.java
   @@ -430,8 +430,9 @@
        ActivityManager am = (ActivityManager) 
context.getSystemService(Context.ACTIVITY_SERVICE);
        ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
        am.getMemoryInfo(mi);
   -    //mi.availMem; 当前系统的可用内存
   -    //return Formatter.formatFileSize(context, mi.availMem);// 将获取的内存大小规格化
   +    // mi.availMem; 当前系统的可用内存
   +    // return Formatter.formatFileSize(context, mi.availMem);//
   +    // 将获取的内存大小规格化
        WXLogUtils.w("app AvailMemory ---->>>"+mi.availMem/(1024*1024));
        return mi.availMem/(1024*1024);
      }
   
   ``` 
   
   #### ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
   ```diff 
   --- ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
   +++ ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
   @@ -482,7 +482,7 @@
        [WXCoreBridge setPageArgument:_instanceId key:@"renderTimeOrigin" 
value:[NSString stringWithFormat:@"%lld", (long long)([[NSDate date] 
timeIntervalSince1970] * 1000)]];
        self.performance.renderUnixTimeOrigin = [WXUtility 
getUnixFixTimeMillis];
        [self.apmInstance onStage:KEY_PAGE_STAGES_RENDER_ORGIGIN];
   -    
   +
        if (![WXUtility isBlankString:self.pageName]) {
            WXLog(@"Start rendering page:%@", self.pageName);
        } else {
   
   ``` 
   
   #### ios/sdk/WeexSDK/Sources/Utility/WXVersion.m
   ```diff 
   --- ios/sdk/WeexSDK/Sources/Utility/WXVersion.m
   +++ ios/sdk/WeexSDK/Sources/Utility/WXVersion.m
   @@ -20,7 +20,7 @@
    #import "WXVersion.h"
    #import "WXDefine.h"
    
   -static const char* WeexSDKBuildTime = "2019-07-21 09:08:41 UTC";
   +static const char *WeexSDKBuildTime = "2019-07-21 09:08:41 UTC";
    static const unsigned long WeexSDKBuildTimestamp = 1563700121;
    
    NSString* GetWeexSDKVersion(void)
   
   ``` 
   
   
   <p align="right" data-meta="generated_by_danger">
     Generated by :no_entry_sign: <a href="https://danger.systems/";>Danger</a>
   </p>
   

----------------------------------------------------------------
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