weexteam/weex_devtools_android

View on GitHub

Showing 472 of 2,519 total issues

Avoid deeply nested control flow statements.
Open

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

                            Log.e(TAG, "点击我,removeEvent 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(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 takeScreenShotIncludeDialog has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public static void takeScreenShotIncludeDialog(Activity activity, String file){
            if (Environment.getExternalStorageState().equals(
                    Environment.MEDIA_MOUNTED)) {
    
                File dir = new File(SdCardHelper.SDCardRoot +"WeexTest/ScreenShot/");

    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("文本2,点击我自动消失")){
                                Log.e(TAG, "childValue.equals(\"文本2,点击我自动消失\")");
    
                                final WXTextView wenbenClickAndThenAddText1 = (WXTextView)child;
                                mInstrumentation.runOnMainSync(new Runnable() {

      Avoid deeply nested control flow statements.
      Open

                              if(childValue.equals("点击我,改变背景颜色")){
      
                                  Log.e(TAG, "点击我,改变背景颜色 find");
                                  final View wenbenClickAndThenAddText1 = child;
                                  mInstrumentation.runOnMainSync(new Runnable() {

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

            public static boolean nextElementWithin(XmlPullParser parser, int outerDepth)
                throws IOException, XmlPullParserException {
                for (;;) {
                    int type = parser.next();
                    if (type == XmlPullParser.END_DOCUMENT
        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

        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

        Avoid deeply nested control flow statements.
        Open

                                if(childValue.equals("文本2,点击我自动消失")){
                                    Log.e(TAG, "childValue.equals(\"文本2,点击我自动消失\")");
        
                                    final WXTextView wenbenClickAndThenAddText1 = (WXTextView)child;
                                    mInstrumentation.runOnMainSync(new Runnable() {

          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 (childValue1.equals("文本1,点击我增加控件")) {
                                      Log.e(TAG, "childValue.equals(\"文本1,点击我增加控件\")");
          
                                      final WXTextView wenbenClickAndThenAddText1 = (WXTextView) child1;
                                      mInstrumentation.runOnMainSync(new Runnable() {

            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("点击我,addEvent")){
              
                                          Log.e(TAG, "点击我,addEvent find");
                                          final View wenbenClickAndThenAddText1 = child;
                                          mInstrumentation.runOnMainSync(new Runnable() {

                Avoid deeply nested control flow statements.
                Open

                                       if (view instanceof WXTextView){
                                           Log.e(TAG, "WXTextView get = " + ((WXTextView) view).getText().toString());
                                       }

                  Method teeInputWithDecompression has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                        NetworkPeerManager peerManager,
                        String requestId,
                        InputStream availableInputStream,
                        OutputStream decompressedOutput,
                        @Nullable String contentEncoding,

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

                      private ShadowDocument.Update createShadowDocumentUpdate() {
                        verifyThreadAccess();
                    
                        if (mDocumentProvider.getRootElement() != mShadowDocument.getRootElement()) {
                          throw new IllegalStateException();

                    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 onCreate has a Cognitive Complexity of 8 (exceeds 5 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 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

                                for (int s = info.children.size(), j = s - 1; j >= 0; j--) {
                                  final ElementInfo childInfo = mShadowDocument.getElementInfo(childElement);
                                  if (childInfo != null) {
                                    final Object child = childInfo.children.get(j);
                                    if (child instanceof Activity) {

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

                        private Enum getEnumByMethod(String value, Class<? extends Enum> clazz, Method method) {
                          Enum[] enumValues = clazz.getEnumConstants();
                          // Start at the front to ensure first always wins
                          for (int i = 0; i < enumValues.length; ++i) {
                            Enum enumValue = enumValues[i];
                      Severity: Minor
                      Found in inspector/src/main/java/com/taobao/weex/devtools/json/ObjectMapper.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 (view instanceof EditText){
                                                 hintText = ((EditText) view).getHint().toString();
                                                 Log.e(TAG, "EditText hint text = " + hintText);
                                                 if(hintText.equals("onclick")){
                      
                      

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

                          @Override
                          public View getHighlightingView(Object element) {
                            if (element == null) {
                              return 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

                        Severity
                        Category
                        Status
                        Source
                        Language