weexteam/weex_devtools_android

View on GitHub

Showing 472 of 2,519 total issues

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

        public void getGarbageElements(Accumulator<Object> accumulator) {
          // This queue stores pairs of elements, [element, expectedParent]
          // When we dequeue, we look at element's parentElement in the new view to see if it matches
          // expectedParent. If it does, then it's garbage. For enqueueing roots, whose parents are
          // null, since we can't enqueue null we instead enqueue the element twice.

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

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

      private List<Object> convertArrayToList(Field field, JSONArray array)
          throws IllegalAccessException, JSONException {
        if (List.class.isAssignableFrom(field.getType())) {
          ParameterizedType parameterizedType = (ParameterizedType) field.getGenericType();
          Type[] types = parameterizedType.getActualTypeArguments();

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

      static int computeComponentContentHeight(@NonNull WXComponent component) {
        View view = component.getHostView();
        if(view == null) {
          return 0;
        }

    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 52 lines of code (exceeds 25 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());

      File DebugServerProxy.java has 253 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      package com.taobao.weex.devtools.debug;
      
      import android.content.Context;
      import android.content.Intent;
      import android.os.Build;

        Method getInstance has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          @Override
          public AsyncPrettyPrinter getInstance(final String headerName, final String headerValue) {
        
            final MatchResult result = matchAndParseHeader(headerName, headerValue);
            if (result == null) {

          File DomTracker.java has 251 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          package com.taobao.weex.devtools.trace;
          
          import android.content.Context;
          import android.os.Looper;
          import android.support.annotation.NonNull;

            Method onCreateView has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

              Method getMatchedStylesForNode has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                @ChromeDevtoolsMethod
                public JsonRpcResult getMatchedStylesForNode(JsonRpcPeer peer, JSONObject params) {
                  final GetMatchedStylesForNodeRequest request = mObjectMapper.convertValue(
                      params,
                      GetMatchedStylesForNodeRequest.class);

                Method intercept has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    @Override
                    public Response intercept(Chain chain) throws IOException {
                        String requestId = String.valueOf(mNextRequestId.getAndIncrement());
                
                        Request request = chain.request();

                  Method intercept has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      @Override
                      public Response intercept(Chain chain) throws IOException {
                          String requestId = String.valueOf(mNextRequestId.getAndIncrement());
                  
                          Request request = chain.request();

                    Method getStylesFromObject has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      private void getStylesFromObject(
                          View view,
                          String name,
                          Object value,
                          @Nullable ViewDebug.ExportedProperty annotation,

                      Function created has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              created: function() {
                                  this.$getConfig(function (config) {
                                      var env = config.env;
                                      if(env.platform == 'iOS'){
                                        var scale = env.scale;
                      Severity: Minor
                      Found in playground/app/src/main/assets/component/navigator-demo.js - About 1 hr to fix

                        Method interpretResponseStream has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public InputStream interpretResponseStream(String requestId, String contentType, String contentEncoding, InputStream stream, boolean continueRead) {
                                if (mReporter != null && mReporter.isEnabled()) {
                                    ResponseHandler defaultHandler = new DefaultResponseHandler(mReporter, requestId);
                                    InputStream wrappedStream =  mReporter.interpretResponseStream(requestId, contentType, contentEncoding, stream, defaultHandler);
                                    if (!continueRead) {

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

                            @Override
                            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                        
                              if ("onOpen".equals(method.getName())) {
                                mWebSocket = mWebSocketClazz.cast(args[0]);

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

                            @Override
                            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                        
                              if ("onOpen".equals(method.getName())) {
                                mWebSocket = mWebSocketClazz.cast(args[0]);

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

                            public static final int[] readThisIntArrayXml(XmlPullParser parser,
                                                                          String endTag, String[] name)
                                throws XmlPullParserException, java.io.IOException {
                        
                                int num;

                          Method submitTracingEvent has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            @Override
                            public void submitTracingEvent(WXTracing.TraceEvent event) {
                          
                              int instanceId = Integer.parseInt(event.iid);
                              if (instanceId == -1) {
                            Severity
                            Category
                            Status
                            Source
                            Language