weexteam/weex_devtools_android

View on GitHub

Showing 2,519 of 2,519 total issues

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

                        if(childValue.equals("点击我,改变背景颜色")){

                            Log.e(TAG, "点击我,改变背景颜色 find");
                            final View wenbenClickAndThenAddText1 = child;
                            mInstrumentation.runOnMainSync(new Runnable() {
playground/app/src/androidTest/java/com/alibaba/weex/uitest/WeexUiTestCaseTcElementOpt.java on lines 272..291
playground/app/src/androidTest/java/com/alibaba/weex/uitest/WeexUiTestCaseTcElementOpt.java on lines 313..333

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

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 3 locations. Consider refactoring.
Open

                        if(childValue.equals("点击我,addEvent")){

                            Log.e(TAG, "点击我,addEvent find");
                            final View wenbenClickAndThenAddText1 = child;
                            mInstrumentation.runOnMainSync(new Runnable() {
playground/app/src/androidTest/java/com/alibaba/weex/uitest/WeexUiTestCaseTcElementOpt.java on lines 272..291
playground/app/src/androidTest/java/com/alibaba/weex/uitest/WeexUiTestCaseTcElementOpt.java on lines 292..312

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

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

                       else if(aherfText.contains("Change width and height")){
                           final FrameLayout aView = (FrameLayout)view.getParent();
                           mInstrumentation.runOnMainSync(new Runnable() {
                               @Override
                               public void run() {
playground/app/src/androidTest/java/com/alibaba/weex/uitest/TC_AHref/WeexUiTestCaseTCAHrefUpdate.java on lines 134..150

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

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 3 locations. Consider refactoring.
Open

                        if(childValue.equals("点击测试Move方法")){

                            Log.e(TAG, "点击测试Move方法 find");
                                final View wenbenClickAndThenAddText1 = child;
                                mInstrumentation.runOnMainSync(new Runnable() {
playground/app/src/androidTest/java/com/alibaba/weex/uitest/WeexUiTestCaseTcElementOpt.java on lines 292..312
playground/app/src/androidTest/java/com/alibaba/weex/uitest/WeexUiTestCaseTcElementOpt.java on lines 313..333

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

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

  public <T> T convertValue(Object fromValue, Class<T> toValueType)
      throws IllegalArgumentException {
    if (fromValue == null) {
      return null;
    }

    Method getIdString has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public static String getIdString(@Nullable Resources r, int resourceId)
          throws Resources.NotFoundException {
        if (r == null) {
          return getFallbackIdString(resourceId);
        }

      Method emulateTouchFromMouseEvent has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

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

          private static class BoxModel {
            @JsonProperty(required = true)
            public List<Double> content;
            @JsonProperty(required = true)
            public List<Double> padding;
        inspector/src/main/java/com/taobao/weex/devtools/inspector/protocol/module/Network.java on lines 141..159
        inspector/src/main/java/com/taobao/weex/devtools/inspector/protocol/module/Page.java on lines 375..388

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

        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 3 locations. Consider refactoring.
        Open

          public static class ResponseReceivedParams {
            @JsonProperty(required = true)
            public String requestId;
        
            @JsonProperty(required = true)
        inspector/src/main/java/com/taobao/weex/devtools/inspector/protocol/module/DOM.java on lines 463..476
        inspector/src/main/java/com/taobao/weex/devtools/inspector/protocol/module/Page.java on lines 375..388

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

        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 3 locations. Consider refactoring.
        Open

          public static class ScreencastFrameEventMetadata {
            @JsonProperty(required = true)
            public float pageScaleFactor;
            @JsonProperty(required = true)
            public int offsetTop;
        inspector/src/main/java/com/taobao/weex/devtools/inspector/protocol/module/DOM.java on lines 463..476
        inspector/src/main/java/com/taobao/weex/devtools/inspector/protocol/module/Network.java on lines 141..159

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

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

            public static void takeScreenshot(Activity activity, File toFile) {
                if (activity == null) {
                    throw new IllegalArgumentException("Parameter activity cannot be null.");
                }
        
        

          Method registerBroadcastReceiver has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            public void registerBroadcastReceiver(BroadcastReceiver receiver, IntentFilter filter) {
              mBroadcastReceiver = receiver != null ? receiver : new DefaultBroadcastReceiver();
              if (filter == null) {
                filter = new IntentFilter();
              }

            Method getDisplayHeight has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static int getDisplayHeight(AppCompatActivity activity) {
                    int height = 0;
                    if (activity != null && activity.getWindowManager() != null && activity.getWindowManager().getDefaultDisplay() != null) {
                        Point point=new Point();
                        activity.getWindowManager().getDefaultDisplay().getSize(point);

              Method onCreate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                @Override
                protected void onCreate(Bundle savedInstanceState) {
                  super.onCreate(savedInstanceState);
                  setContentView(R.layout.activity_wxpage);
                  setCurrentWxPageActivity(this);
              Severity: Minor
              Found in playground/app/src/main/java/com/alibaba/weex/WXPageActivity.java - About 1 hr to fix

                Method parseSetAttributesAsTextArg has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  protected static Map<String, String> parseSetAttributesAsTextArg(String text) {
                    String value = "";
                    String key = "";
                    StringBuilder buffer = new StringBuilder();
                    Map<String, String> keyValuePairs = new HashMap<>();

                  Method isDevtoolsMethod has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    private static boolean isDevtoolsMethod(Method method) throws IllegalArgumentException {
                      if (!method.isAnnotationPresent(ChromeDevtoolsMethod.class)) {
                        return false;
                      } else {
                        Class<?> args[] = method.getParameterTypes();

                    Method valueFromString has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

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

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

                            if (changesElementInfo != null &&
                                changesElementInfo.children != newElementInfo.children) {
                              for (int i = 0, N = changesElementInfo.children.size(); i < N; ++i) {
                                final Object childElement = changesElementInfo.children.get(i);
                                notNewChildrenSet.add(childElement);
                      inspector/src/main/java/com/taobao/weex/devtools/inspector/elements/ShadowDocument.java on lines 159..165

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

                      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 (oldElementInfo != null &&
                                oldElementInfo.children != newElementInfo.children) {
                              for (int i = 0, N = oldElementInfo.children.size(); i < N; ++i) {
                                final Object childElement = oldElementInfo.children.get(i);
                                notNewChildrenSet.add(childElement);
                      inspector/src/main/java/com/taobao/weex/devtools/inspector/elements/ShadowDocument.java on lines 167..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 72.

                      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].type != WXJSObject.String) {
                                      array.add(WXWsonJSONSwitch.convertWXJSObjectDataToJSON(args[i]));
                                  } else {
                                      array.add(args[i].data);
                      inspector/src/main/java/com/taobao/weex/devtools/debug/WXDebugBridge.java on lines 245..251

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

                      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