weexteam/weex_devtools_android

View on GitHub

Showing 2,519 of 2,519 total issues

Method valueFromString has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  @Nullable
  public static Object valueFromString(String newValue, Object existingValue)
      throws IllegalArgumentException {
    if (existingValue instanceof Integer) {
      return Integer.parseInt(newValue);

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

    private GetPropertiesResponse getPropertiesForObject(Object object) {
      GetPropertiesResponse response = new GetPropertiesResponse();
      List<PropertyDescriptor> properties = new ArrayList<>();
      for (
          Class<?> declaringClass = object.getClass();

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

    private static Bitmap takeBitmapUnchecked(Activity activity) throws InterruptedException {
        final List<ViewRootData> viewRoots = getRootViews(activity);
        int statusBarHeight = ScreenShot.getStatusBarHeight1(activity);
        int actionBarHeight = ScreenShot.getActionBarHeight(activity);

    Method updateListenerChildren has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private static void updateListenerChildren(
          ChildEventingList listenerChildren,
          List<Object> newChildren,
          Accumulator<Object> insertedElements) {
        int index = 0;

      Method hitTestImpl has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

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

            @Override
            protected void connect(String url) {
                if (webSocketClient != null) {
                    webSocketClient.connect(url, new IWebSocketClient.WSListener() {
                        @Override

          Function 20 has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          /***/ function(module, exports) {
          
              ;__weex_define__("@weex-component/link", [], function(__weex_require__, __weex_exports__, __weex_module__){
          
              ;
          Severity: Minor
          Found in playground/app/src/main/assets/showcase/new-fashion/headlines.js - About 1 hr to fix

            Method handleRemoteRequest has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private void handleRemoteRequest(JsonRpcPeer peer, JSONObject requestNode)
                        throws MessageHandlingException {
                    JsonRpcRequest request;
                    request = mObjectMapper.convertValue(
                            requestNode,

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

                      for (int i = 0; i < argsCount; i++) {
                          if (args[i] != null) {
                              if (args[i].type != WXJSObject.String) {
                                  array.add(WXWsonJSONSwitch.convertWXJSObjectDataToJSON(args[i]));
                              } else {
              inspector/src/main/java/com/taobao/weex/devtools/debug/WXDebugBridge.java on lines 97..105

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

              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

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

                      for (int i = 0; i < argsCount; i++) {
                          if (args[i] != null) {
                              if (args[i].type != WXJSObject.String) {
                                  array.add(WXWsonJSONSwitch.convertWXJSObjectDataToJSON(args[i]));
                              } else {
              inspector/src/main/java/com/taobao/weex/devtools/debug/WXDebugBridge.java on lines 130..138

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

              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

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

                      @Nullable
                      @Override
                      public byte[] body() throws IOException {
                          RequestBody body = mRequest.body();
                          if (body == null) {
              okhttp_interceptor/src/main/java/com/taobao/weex/okhttp/WeexOkhttpInterceptor.java on lines 148..163

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

              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

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

              class CountingOutputStream extends FilterOutputStream {
                private long mCount;
              
                public CountingOutputStream(OutputStream out) {
                  super(out);
              protocol/src/main/java/com/taobao/weex/devtools/inspector/network/RequestBodyHelper.java on lines 97..124

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

              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

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

                      @Nullable
                      @Override
                      public byte[] body() throws IOException {
                          RequestBody body = mRequest.body();
                          if (body == null) {
              okhttp3_interceptor/src/main/java/com/taobao/weex/okhttp3/WeexOkhttp3Interceptor.java on lines 158..173

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

              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

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

                private class CountingOutputStream extends FilterOutputStream {
                  private long mCount;
              
                  public CountingOutputStream(OutputStream out) {
                    super(out);
              inspector/src/main/java/com/taobao/weex/devtools/inspector/network/CountingOutputStream.java on lines 16..43

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

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

                  public static final int
                  convertValueToInt(CharSequence charSeq, int defaultValue)
                  {
                      if (null == charSeq)
                          return defaultValue;

                Method getRootViews has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    @SuppressWarnings("unchecked") // no way to check
                    private static List<ViewRootData> getRootViews(Activity activity) {
                        List<ViewRootData> rootViews = new ArrayList<>();
                
                        Object globalWindowManager;

                  Method invoke has 30 lines of code (exceeds 25 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]);

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

                          ready: function() {
                            var storage = __weex_require__('@weex-module/storage');
                            var me = this;
                    
                    
                    
                    Severity: Minor
                    Found in playground/app/src/main/assets/module/storage-demo.js - About 1 hr to fix

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

                          if (length > BUFFER_LEN) {
                            final int end = i + length;
                            while (i < end) {
                              int next = i + BUFFER_LEN;
                              append(str, i, next<end ? BUFFER_LEN : (end-i));
                      appframework/src/main/java/com/alibaba/weex/commons/util/FastXmlSerializer.java on lines 100..108

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

                      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

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

                          if (length > BUFFER_LEN) {
                            final int end = i + length;
                            while (i < end) {
                              int next = i + BUFFER_LEN;
                              append(buf, i, next<end ? BUFFER_LEN : (end-i));
                      appframework/src/main/java/com/alibaba/weex/commons/util/FastXmlSerializer.java on lines 81..89

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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language