weexteam/weex_devtools_android

View on GitHub

Showing 472 of 2,519 total issues

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

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

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

Avoid deeply nested control flow statements.
Open

                        if (childValue.equals("点击我,在我上方增加一个文本")) {
                            final WXTextView wenbenClickAndThenAddText = (WXTextView) child;
                            mInstrumentation.runOnMainSync(new Runnable() {
                                @Override
                                public void run() {

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

      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() {

        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() {

          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("文本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() {

                Avoid deeply nested control flow statements.
                Open

                                        if(childValue.equals("点击我,在我下方增加一个文本")){
                                            Log.e(TAG, "childValue.equals(\"点击我,在我下方增加一个文本\")");
                
                                            final WXTextView wenbenClickAndThenAddText1 = (WXTextView)child;
                                            mInstrumentation.runOnMainSync(new Runnable() {

                  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 teeInputWithDecompression has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

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

                      Avoid deeply nested control flow statements.
                      Open

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

                        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

                        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

                        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) {
                          Severity
                          Category
                          Status
                          Source
                          Language