weexteam/weex_devtools_android

View on GitHub

Showing 472 of 2,519 total issues

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

              Method handleDecodeInternally has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                private void handleDecodeInternally(String code) {
              
                  if (!TextUtils.isEmpty(code)) {
                    Uri uri = Uri.parse(code);
                    if (uri.getQueryParameterNames().contains("bundle")) {
              Severity: Minor
              Found in playground/app/src/main/java/com/alibaba/weex/IndexActivity.java - About 55 mins to fix

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

                public static void close(Closeable closeable, boolean hideException) throws IOException {
                  if (closeable != null) {
                    if (hideException) {
                      try {
                        closeable.close();
              Severity: Minor
              Found in inspector/src/main/java/com/taobao/weex/devtools/common/Util.java - About 55 mins to fix

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

                  @Override
                  public boolean equals(Object o) {
                    if (o == null || !(o instanceof JsonPropertyStringList)) {
                      return false;
                    }

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

                @Nullable
                private static Object findFragmentForViewInActivity(Activity activity, View view) {
                  FragmentCompat supportLib = FragmentCompat.getSupportLibInstance();
              
                  // Try the support library version if it is present and the activity is FragmentActivity.

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

                public static InputStream teeInputWithDecompression(
                    NetworkPeerManager peerManager,
                    String requestId,
                    InputStream availableInputStream,
                    OutputStream decompressedOutput,

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

                private void getStylesFromObject(
                    View view,
                    String name,
                    Object value,
                    @Nullable ViewDebug.ExportedProperty 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 printTo has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                      public void printTo(PrintWriter output, InputStream payload)
                          throws IOException {
                        try {
                          String schema;
                          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 parseUnsignedIntAttribute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static int parseUnsignedIntAttribute(CharSequence charSeq) {
                      String  value = charSeq.toString();
              
                      long    bits;
                      int     index = 0;
              Severity: Minor
              Found in appframework/src/main/java/com/alibaba/weex/commons/util/XmlUtils.java - About 45 mins to fix

              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

              Avoid deeply nested control flow statements.
              Open

                                      if(childValue.equals("点击测试Move方法")){
              
                                          Log.e(TAG, "点击测试Move方法 find");
                                              final View wenbenClickAndThenAddText1 = child;
                                              mInstrumentation.runOnMainSync(new Runnable() {

                Avoid deeply nested control flow statements.
                Open

                                        if(childValue.equals("点击我,removeEvent")){
                
                                            Log.e(TAG, "点击我,removeEvent find");
                                            final View wenbenClickAndThenAddText1 = child;
                                            mInstrumentation.runOnMainSync(new Runnable() {

                  Avoid deeply nested control flow statements.
                  Open

                                          if(childValue.equals("点击我,addEvent")){
                  
                                              Log.e(TAG, "点击我,addEvent find");
                                              final View wenbenClickAndThenAddText1 = child;
                                              mInstrumentation.runOnMainSync(new Runnable() {

                    Method escapeAndAppendString has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      private void escapeAndAppendString(char[] buf, int start, int len) throws IOException {
                        final char NE = (char)ESCAPE_TABLE.length;
                        final String[] escapes = ESCAPE_TABLE;
                        int end = start+len;
                        int lastPos = start;

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

                      private void escapeAndAppendString(final String string) throws IOException {
                        final int N = string.length();
                        final char NE = (char)ESCAPE_TABLE.length;
                        final String[] escapes = ESCAPE_TABLE;
                        int lastPos = 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 takeScreenShot has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private static Bitmap takeScreenShot(Activity activity) {
                    
                            View view = activity.getWindow().getDecorView();
                    
                            rootView = view;

                    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