weexteam/weex_devtools_android

View on GitHub

Showing 2,519 of 2,519 total issues

File ViewDescriptor.java has 374 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (c) 2014-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the

    Function 0 has 120 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    /***/ function(module, exports, __webpack_require__) {
    
        ;__weex_define__("@weex-component/691df56614eb1af85a2e46bfeebd4e3a", [], function(__weex_require__, __weex_exports__, __weex_module__){
        __webpack_require__(18);
    
    
    Severity: Major
    Found in playground/app/src/main/assets/showcase/new-fashion/match.js - About 4 hrs to fix

      Method readThisValueXml has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

          private static final Object readThisValueXml(XmlPullParser parser, String[] name,
                                                       ReadMapCallback callback)  throws XmlPullParserException, java.io.IOException {
              final String valueName = parser.getAttributeValue(null, "name");
              final String tagName = parser.getName();
      
      

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method traverse has 114 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        @Nullable
        public HealthReport traverse() {
          long start = System.currentTimeMillis();
          if (Looper.getMainLooper() == Looper.myLooper()) {
            WXLogUtils.e(TAG, "illegal thread...");

        Function ready has 114 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                ready: function() {
                  var stream = __weex_require__('@weex-module/stream');
                  var me = this;
                  var GET_URL_JSONP = 'http://jsfiddle.net/echo/jsonp/?callback=anything&result=content_in_response';
                  var GET_URL = 'http://httpbin.org/get';
        Severity: Major
        Found in playground/app/src/main/assets/module/stream-demo.js - About 4 hrs to fix

          File WeexUiTestCaseTcImageUpdate.java has 355 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          package com.alibaba.weex.uitest.TC_Image;
          
          import android.app.Activity;
          import android.app.Application;
          import android.app.Instrumentation;

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                public void testPerfMonitorListAppendTree(){
            
                    for(final View caseView : mCaseListIndexView){
                       if (((WXTextView)caseView).getText().toString().equals("TC_Monitor")){
                           Log.e(TAG, "TC_Monitor find");
            playground/app/src/androidTest/java/com/alibaba/weex/uitest/TC_Color/WeexUiTestCaseTcColorType.java on lines 73..126

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 279.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                public void testColorType(){
            
                    for(final View caseView : mCaseListIndexView){
                       if (((WXTextView)caseView).getText().toString().equals("TC_Color")){
                           Log.e(TAG, "TC_Color find");
            playground/app/src/androidTest/java/com/alibaba/weex/pertest/WeexPerTestCaseListPerfWithAppendTree.java on lines 73..126

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 279.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

                public static final int[] readThisIntArrayXml(XmlPullParser parser,
                                                              String endTag, String[] name)
                    throws XmlPullParserException, java.io.IOException {
            
                    int num;
            appframework/src/main/java/com/alibaba/weex/commons/util/XmlUtils.java on lines 1047..1092
            appframework/src/main/java/com/alibaba/weex/commons/util/XmlUtils.java on lines 1108..1152
            appframework/src/main/java/com/alibaba/weex/commons/util/XmlUtils.java on lines 1228..1272

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 278.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

                public static final double[] readThisDoubleArrayXml(XmlPullParser parser, String endTag,
                                                                    String[] name) throws XmlPullParserException, java.io.IOException {
            
                    int num;
                    try {
            appframework/src/main/java/com/alibaba/weex/commons/util/XmlUtils.java on lines 978..1031
            appframework/src/main/java/com/alibaba/weex/commons/util/XmlUtils.java on lines 1047..1092
            appframework/src/main/java/com/alibaba/weex/commons/util/XmlUtils.java on lines 1228..1272

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 278.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

                public static final long[] readThisLongArrayXml(XmlPullParser parser,
                                                                String endTag, String[] name)
                    throws XmlPullParserException, java.io.IOException {
            
                    int num;
            appframework/src/main/java/com/alibaba/weex/commons/util/XmlUtils.java on lines 978..1031
            appframework/src/main/java/com/alibaba/weex/commons/util/XmlUtils.java on lines 1108..1152
            appframework/src/main/java/com/alibaba/weex/commons/util/XmlUtils.java on lines 1228..1272

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 278.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

                public static final boolean[] readThisBooleanArrayXml(XmlPullParser parser, String endTag,
                                                                      String[] name) throws XmlPullParserException, java.io.IOException {
            
                    int num;
                    try {
            appframework/src/main/java/com/alibaba/weex/commons/util/XmlUtils.java on lines 978..1031
            appframework/src/main/java/com/alibaba/weex/commons/util/XmlUtils.java on lines 1047..1092
            appframework/src/main/java/com/alibaba/weex/commons/util/XmlUtils.java on lines 1108..1152

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 278.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Method getValueForField has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
            Open

              private Object getValueForField(Field field, Object value)
                  throws JSONException {
                try {
                  if (value != null) {
                    if (value == JSONObject.NULL) {

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Method loadAppSettings has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
            Open

              private static void loadAppSettings(Context context) {
                int id = context.getResources().getIdentifier("app_config", "xml", context.getClass().getPackage().getName());
                if (id == 0) {
                  // If we couldn't find config.xml there, we'll look in the namespace from AndroidManifest.xml
                  id = context.getResources().getIdentifier("app_config", "xml", context.getPackageName());

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                public  void Slider(){
            
                    for(final View caseView : mCaseListIndexView){
                        if (((WXTextView)caseView).getText().toString().equals("TC_Slider")){
                            Log.e(TAG, "TC_Slider find");
            playground/app/src/androidTest/java/com/alibaba/weex/uitest/TC_Text/WeexUiTestCaseTcTextType.java on lines 74..129

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 263.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                public void testTextType(){
            
                    for(final View caseView : mCaseListIndexView){
                       if (((WXTextView)caseView).getText().toString().equals("TC_Text")){
                           Log.e(TAG, "TC_Text find");
            playground/app/src/androidTest/java/com/alibaba/weex/uitest/TC_Slider/WeexUiTestCaseTcSlider.java on lines 81..135

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 263.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            FastXmlSerializer has 33 methods (exceeds 20 allowed). Consider refactoring.
            Open

            public class FastXmlSerializer implements XmlSerializer {
              private static final String ESCAPE_TABLE[] = new String[] {
                  null,     null,     null,     null,     null,     null,     null,     null,  // 0-7
                  null,     null,     null,     null,     null,     null,     null,     null,  // 8-15
                  null,     null,     null,     null,     null,     null,     null,     null,  // 16-23

              Method setElementChildren has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
              Open

                  public void setElementChildren(Object element, List<Object> children) {
                    // If we receive redundant information, then nothing needs to be done.
                    ElementInfo changesElementInfo = mElementToInfoChangesMap.get(element);
                    if (changesElementInfo != null &&
                        ListUtil.identityEquals(children, changesElementInfo.children)) {

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              NetworkEventReporterImpl has 32 methods (exceeds 20 allowed). Consider refactoring.
              Open

              public class NetworkEventReporterImpl implements NetworkEventReporter {
                private final AtomicInteger mNextRequestId = new AtomicInteger(0);
                @Nullable
                private ResourceTypeHelper mResourceTypeHelper;
              
              

                WxDebug has 32 methods (exceeds 20 allowed). Consider refactoring.
                Open

                public class WxDebug implements ChromeDevtoolsDomain {
                
                    private static final String TAG = "WxDebug";
                    private static final HashMap<String, LogLevel> sLevelMap = new HashMap<String, LogLevel>(6);
                
                
                  Severity
                  Category
                  Status
                  Source
                  Language