weexteam/weex_devtools_android

View on GitHub

Showing 472 of 2,519 total issues

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

                public void setOutput(OutputStream os, String encoding) throws IOException,
                    IllegalArgumentException, IllegalStateException {
                  if (os == null)
                    throw new IllegalArgumentException();
                  if (true) {

              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("点击我,在我上方增加一个文本")) {
                                          final WXTextView wenbenClickAndThenAddText = (WXTextView) child;
                                          mInstrumentation.runOnMainSync(new Runnable() {
                                              @Override
                                              public void run() {

                Avoid deeply nested control flow statements.
                Open

                                        if(childValue.equals("点击我,在我下方增加一个文本")){
                                            Log.e(TAG, "childValue.equals(\"点击我,在我下方增加一个文本\")");
                
                                            final WXTextView wenbenClickAndThenAddText1 = (WXTextView)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

                  Avoid deeply nested control flow statements.
                  Open

                                         if(aherfText.contains("Change href")){
                                             final FrameLayout aView = (FrameLayout)view.getParent();
                                             mInstrumentation.runOnMainSync(new Runnable() {
                                                 @Override
                                                 public void run() {

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

                        private static final Object readThisPrimitiveValueXml(XmlPullParser parser, String tagName)
                            throws XmlPullParserException, java.io.IOException
                        {
                            try {
                                if (tagName.equals("int")) {
                    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(((WXTextView) view).getText().toString().contains("Hello Weex")){
                                               final FrameLayout aView = (FrameLayout)view.getParent();
                                               mInstrumentation.runOnMainSync(new Runnable() {
                                                   @Override
                                                   public void run() {
                      Severity
                      Category
                      Status
                      Source
                      Language