weexteam/weex_devtools_android

View on GitHub

Showing 2,519 of 2,519 total issues

Method setElementChildren has 60 lines of code (exceeds 25 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)) {

    WeexUiTestCaseTcImageUpdate has 22 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class WeexUiTestCaseTcImageUpdate extends ActivityInstrumentationTestCase2<WXPageActivity> {
        public final  String TAG = "TestScript_Guide==";
        public WXPageActivity waTestPageActivity;
        public WeappJsBaseTestCase weappApplication;
    
    

      AbstractChainedDescriptor has 22 methods (exceeds 20 allowed). Consider refactoring.
      Open

      public abstract class AbstractChainedDescriptor<E> extends Descriptor implements ChainedDescriptor {
      
        private Descriptor mSuper;
      
        public void setSuper(Descriptor superDescriptor) {

        ViewDescriptor has 22 methods (exceeds 20 allowed). Consider refactoring.
        Open

        final class ViewDescriptor extends AbstractChainedDescriptor<View> implements HighlightableDescriptor {
          private static final String ID_NAME = "id";
          private static final String NONE_VALUE = "(none)";
          private static final String NONE_MAPPING = "<no mapping>";
        
        

          Page has 22 methods (exceeds 20 allowed). Consider refactoring.
          Open

          public class Page implements ChromeDevtoolsDomain {
            private final Context mContext;
            private final ObjectMapper mObjectMapper = new ObjectMapper();
          
            @Nullable

            File minesweeper.js has 262 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /******/ (function(modules) { // webpackBootstrap
            /******/     // The module cache
            /******/     var installedModules = {};
            
            /******/     // The require function
            Severity: Minor
            Found in playground/app/src/main/assets/showcase/minesweeper.js - About 2 hrs to fix

              Method connect has 57 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                protected void connect(String url) {
                  if (mSocketClient != null) {
                    throw new IllegalStateException("OkHttp3SocketClient is already initialized.");
                  }
                  try {

                Method getExistedModules has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static Map<String, TypeModuleFactory> getExistedModules(boolean global) {
                      Map<String, TypeModuleFactory> modules = new HashMap<>();
                      if (global) {
                        try {
                          Field sGlobalField = WXModuleManager.class.getDeclaredField("sGlobalModuleMap");

                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 collectNativeTracingData has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                  private void collectNativeTracingData(WXTracing.TraceEvent head, JSONArray out) {
                    if (head.subEvents != null) {
                      for (int i = 0; i < head.subEvents.size(); i++) {
                        WXTracing.TraceEvent subEvent = head.subEvents.valueAt(i);
                        if (subEvent.isSegment) {

                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 getViewProperties has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                  private List<ViewCSSProperty> getViewProperties() {
                    if (mViewProperties == null) {
                      synchronized (this) {
                        if (mViewProperties == null) {
                          List<ViewCSSProperty> props = new ArrayList<>();

                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 hitTestImpl has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                  private static View hitTestImpl(
                      View view,
                      float x,
                      float y,
                      @Nullable Predicate<View> viewSelector,

                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 'created' has a complexity of 11.
                Open

                        created: function() {

                Limit Cyclomatic Complexity (complexity)

                Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.

                function a(x) {
                    if (true) {
                        return x; // 1st path
                    } else if (false) {
                        return x+1; // 2nd path
                    } else {
                        return 4; // 3rd path
                    }
                }

                Rule Details

                This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20).

                Examples of incorrect code for a maximum of 2:

                /*eslint complexity: ["error", 2]*/
                
                function a(x) {
                    if (true) {
                        return x;
                    } else if (false) {
                        return x+1;
                    } else {
                        return 4; // 3rd path
                    }
                }

                Examples of correct code for a maximum of 2:

                /*eslint complexity: ["error", 2]*/
                
                function a(x) {
                    if (true) {
                        return x;
                    } else {
                        return 4;
                    }
                }

                Options

                Optionally, you may specify a max object property:

                "complexity": ["error", 2]

                is equivalent to

                "complexity": ["error", { "max": 2 }]

                Deprecated: the object property maximum is deprecated. Please use the property max instead.

                When Not To Use It

                If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.

                Further Reading

                Related Rules

                • [max-depth](max-depth.md)
                • [max-len](max-len.md)
                • [max-nested-callbacks](max-nested-callbacks.md)
                • [max-params](max-params.md)
                • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

                Method 'created' has a complexity of 11.
                Open

                        created: function() {

                Limit Cyclomatic Complexity (complexity)

                Cyclomatic complexity measures the number of linearly independent paths through a program's source code. This rule allows setting a cyclomatic complexity threshold.

                function a(x) {
                    if (true) {
                        return x; // 1st path
                    } else if (false) {
                        return x+1; // 2nd path
                    } else {
                        return 4; // 3rd path
                    }
                }

                Rule Details

                This rule is aimed at reducing code complexity by capping the amount of cyclomatic complexity allowed in a program. As such, it will warn when the cyclomatic complexity crosses the configured threshold (default is 20).

                Examples of incorrect code for a maximum of 2:

                /*eslint complexity: ["error", 2]*/
                
                function a(x) {
                    if (true) {
                        return x;
                    } else if (false) {
                        return x+1;
                    } else {
                        return 4; // 3rd path
                    }
                }

                Examples of correct code for a maximum of 2:

                /*eslint complexity: ["error", 2]*/
                
                function a(x) {
                    if (true) {
                        return x;
                    } else {
                        return 4;
                    }
                }

                Options

                Optionally, you may specify a max object property:

                "complexity": ["error", 2]

                is equivalent to

                "complexity": ["error", { "max": 2 }]

                Deprecated: the object property maximum is deprecated. Please use the property max instead.

                When Not To Use It

                If you can't determine an appropriate complexity limit for your code, then it's best to disable this rule.

                Further Reading

                Related Rules

                • [max-depth](max-depth.md)
                • [max-len](max-len.md)
                • [max-nested-callbacks](max-nested-callbacks.md)
                • [max-params](max-params.md)
                • [max-statements](max-statements.md) Source: http://eslint.org/docs/rules/

                Method testColorUpdateType has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public void testColorUpdateType(){
                
                        for(final View caseView : mCaseListIndexView){
                           if (((WXTextView)caseView).getText().toString().equals("TC_Color")){
                               Log.e(TAG, "TC_Color find");

                  Method onBindViewHolder has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      @Override
                      public void onBindViewHolder(final ItemHolder holder, int position) {
                        final WXTracing.TraceEvent event = rootEvent.subEvents.valueAt(position);
                        holder.itemView.setOnClickListener(new View.OnClickListener() {
                          @Override

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

                        private static final ArrayList readThisListXml(XmlPullParser parser, String endTag,
                                                                       String[] name, ReadMapCallback callback)
                            throws XmlPullParserException, java.io.IOException {
                            ArrayList list = new ArrayList();
                    
                    
                    appframework/src/main/java/com/alibaba/weex/commons/util/XmlUtils.java on lines 940..962

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

                    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

                        private static final HashSet readThisSetXml(XmlPullParser parser, String endTag, String[] name,
                                                                    ReadMapCallback callback) throws XmlPullParserException, java.io.IOException {
                            HashSet set = new HashSet();
                    
                            int eventType = parser.getEventType();
                    appframework/src/main/java/com/alibaba/weex/commons/util/XmlUtils.java on lines 875..898

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

                    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 connect has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      protected void connect(String url) {
                        if (mSocketClient != null) {
                          throw new IllegalStateException("OkHttpSocketClient is already initialized.");
                        }
                        try {

                      File WeexUiTestCaseTcInputEvent.java has 255 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

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

                        Method onCreateView has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                          @Override
                          public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                                   Bundle savedInstanceState) {
                            int iid = getArguments().getInt("instanceId");
                            int traceId = getArguments().getInt("traceId");

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language