weexteam/weex_devtools_android

View on GitHub

Showing 2,519 of 2,519 total issues

Method updateListenerChildren has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  private static void updateListenerChildren(
      ChildEventingList listenerChildren,
      List<Object> newChildren,
      Accumulator<Object> insertedElements) {
    int index = 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 parseSetAttributesAsTextArg has a Cognitive Complexity of 12 (exceeds 5 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<>();

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

  private static String mapFlagsToStringUsingAnnotation(
      int value,
      @Nullable ViewDebug.ExportedProperty annotation) {
    if (!canFlagsBeMappedToString(annotation)) {
      throw new IllegalStateException("Cannot map using this annotation");

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

    @Override
    public int execJS(String instanceId, String namespace, String function, WXJSObject[] args) {
        ArrayList<Object> array = new ArrayList<>();
        int argsCount = args == null ? 0 : args.length;
        for (int i = 0; i < argsCount; i++) {

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

    public RemoteObject objectForRemote(Object value) {
      RemoteObject result = new RemoteObject();
      if (value == null) {
        result.type = ObjectType.OBJECT;
        result.subtype = ObjectSubType.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 emulateTouchFromMouseEvent has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

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

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

    @Before
    public void setUp() throws InterruptedException {
        super.setUp();
        HashMap testMap = new <String, Object> HashMap();
        testMap.put("testComponet", "AG_Input");

    Method setUp has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Before
        public void setUp() throws InterruptedException {
            super.setUp();
            HashMap testMap = new <String, Object> HashMap();
            testMap.put("testComponet", "AG_Text");

      Method addTab has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private void addTab(String title, final boolean selected, final View.OnClickListener listener) {
          final TextView textView = new TextView(this);
          textView.setText(title);
          LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
          lp.weight = 1;

        Method interpretResponseStream has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          @Override
          public InputStream interpretResponseStream(
              String requestId,
              @Nullable String contentType,
              @Nullable String contentEncoding,

          Function data has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  data: function () {return {
                    dir: 'examples',
                    tabItems: [
                      {
                        index: 0,
          Severity: Minor
          Found in playground/app/src/main/assets/component/tabbar/tabbar-demo.js - About 1 hr to fix

            Function data has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    data: function () {return {
                      dir: 'examples',
                      tabItems: [
                        {
                          index: 0,
            Severity: Minor
            Found in playground/app/src/main/assets/showcase/new-fashion/index.js - About 1 hr to fix

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

                  @ChromeDevtoolsMethod
                  public void callUpdateAttrs(JsonRpcPeer peer, JSONObject params) {
                      if (null == params) {
                          Log.e(TAG, "callUpdateAttrs: params==null !");
                          return;
              inspector/src/main/java/com/taobao/weex/devtools/inspector/protocol/module/WxDebug.java on lines 263..280
              inspector/src/main/java/com/taobao/weex/devtools/inspector/protocol/module/WxDebug.java on lines 319..335
              inspector/src/main/java/com/taobao/weex/devtools/inspector/protocol/module/WxDebug.java on lines 337..355

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

              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

                  @ChromeDevtoolsMethod
                  public void callAddEvent(JsonRpcPeer peer, JSONObject params) {
                      if (null == params) {
                          Log.e(TAG, "callAddEvent: params==null !");
                          return;
              inspector/src/main/java/com/taobao/weex/devtools/inspector/protocol/module/WxDebug.java on lines 244..261
              inspector/src/main/java/com/taobao/weex/devtools/inspector/protocol/module/WxDebug.java on lines 263..280
              inspector/src/main/java/com/taobao/weex/devtools/inspector/protocol/module/WxDebug.java on lines 337..355

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

              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

                  @ChromeDevtoolsMethod
                  public void callRemoveEvent(JsonRpcPeer peer, JSONObject params) {
                      if (null == params) {
                          Log.e(TAG, "callRemoveEvent: params==null !");
                          return;
              inspector/src/main/java/com/taobao/weex/devtools/inspector/protocol/module/WxDebug.java on lines 244..261
              inspector/src/main/java/com/taobao/weex/devtools/inspector/protocol/module/WxDebug.java on lines 263..280
              inspector/src/main/java/com/taobao/weex/devtools/inspector/protocol/module/WxDebug.java on lines 319..335

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

              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

                  @ChromeDevtoolsMethod
                  public void callUpdateStyle(JsonRpcPeer peer, JSONObject params) {
                      if (null == params) {
                          Log.e(TAG, "callUpdateStyle: params==null !");
                          return;
              inspector/src/main/java/com/taobao/weex/devtools/inspector/protocol/module/WxDebug.java on lines 244..261
              inspector/src/main/java/com/taobao/weex/devtools/inspector/protocol/module/WxDebug.java on lines 319..335
              inspector/src/main/java/com/taobao/weex/devtools/inspector/protocol/module/WxDebug.java on lines 337..355

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

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

                  public RemoteObject objectForRemote(Object value) {
                    RemoteObject result = new RemoteObject();
                    if (value == null) {
                      result.type = ObjectType.OBJECT;
                      result.subtype = ObjectSubType.NULL;

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

                    list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                      @Override
                      public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                        String item = items.get(position);
                        IFComponentHolder holder = components.get(item);
                inspector/src/main/java/com/taobao/weex/devtools/toolbox/EnvironmentFragment.java on lines 104..118

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

                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

                    list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                      @Override
                      public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                        String item = items.get(position);
                        TypeModuleFactory factory = modules.get(item);
                inspector/src/main/java/com/taobao/weex/devtools/toolbox/EnvironmentFragment.java on lines 128..142

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

                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

                Consider simplifying this complex logical expression.
                Open

                    if (key != null) {
                      String exp = key.toLowerCase();
                      result = !exp.contains("padding") && !exp.contains("margin")
                          && !exp.contains("width") && !exp.contains("height")
                          && !exp.contains("left")
                  Severity
                  Category
                  Status
                  Source
                  Language