weexteam/weex_devtools_android

View on GitHub

Showing 472 of 2,519 total issues

Function 14 has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

/***/ function(module, exports) {

    ;__weex_define__("@weex-component/slider-item", [], function(__weex_require__, __weex_exports__, __weex_module__){

    ;
Severity: Minor
Found in playground/app/src/main/assets/component/slider/slider-page.js - About 1 hr to fix

    Method saveToSD has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public static void saveToSD(Bitmap bmp, String dirName,String fileName) throws IOException {
            if (Environment.getExternalStorageState().equals(
                    Environment.MEDIA_MOUNTED)) {
                File dir = new File(dirName);
                if(!dir.exists()){

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

        public static ArrayList<View> findViewWithText(ViewGroup vg, String text){
            ArrayList<View> out = new ArrayList<View>();
            if(null != vg){
                vg.findViewsWithText(out, text, View.FIND_VIEWS_WITH_TEXT);
            }

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

      public <T> T convertValue(Object fromValue, Class<T> toValueType)
          throws IllegalArgumentException {
        if (fromValue == 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 onGetStyles has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        @Override
        protected void onGetStyles(WXVContainer element, StyleAccumulator accumulator) {
            ViewGroup view = element.getRealView();
            if (view != null) {
                ViewGroup.LayoutParams layoutParams = view.getLayoutParams();

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

      @Override
      protected void onGetStyles(WXComponent element, StyleAccumulator accumulator) {
        HashMap<String, String> map = getStyles(element);
        if (map != null && map.size() > 0) {
          for (HashMap.Entry<String, String> entry : map.entrySet()) {

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

          @Override
          public boolean onTouchEvent(MotionEvent event) {
            if (getParent() instanceof View) {
              final View parent = (View)getParent();
              View view = ViewUtil.hitTest(parent, event.getX(), event.getY(), mViewSelector);

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

      public void writeToConsole() {
        Log.d(TAG, "health report(" + bundleUrl + ")");
        Log.d(TAG, "[health report] maxLayer:" + maxLayer);
        Log.d(TAG, "[health report] maxLayerOfRealDom:" + maxLayerOfRealDom);
        Log.d(TAG, "[health report] hasList:" + hasList);

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

        private GetPropertiesResponse getPropertiesForObject(Object object) {
          GetPropertiesResponse response = new GetPropertiesResponse();
          List<PropertyDescriptor> properties = new ArrayList<>();
          for (
              Class<?> declaringClass = object.getClass();

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

      @Nullable
      public static Object valueFromString(String newValue, Object existingValue)
          throws IllegalArgumentException {
        if (existingValue instanceof Integer) {
          return Integer.parseInt(newValue);

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

        public static
        @Nullable
        NetworkEventReporter get() {
            if (allowReport()) {
                if (sReporter == 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 takeBitmapUnchecked has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private static Bitmap takeBitmapUnchecked(Activity activity) throws InterruptedException {
            final List<ViewRootData> viewRoots = getRootViews(activity);
            int statusBarHeight = ScreenShot.getStatusBarHeight1(activity);
            int actionBarHeight = ScreenShot.getActionBarHeight(activity);
    
    

      Method updateListenerChildren has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private static void updateListenerChildren(
            ChildEventingList listenerChildren,
            List<Object> newChildren,
            Accumulator<Object> insertedElements) {
          int index = 0;

        Method hitTestImpl has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private static View hitTestImpl(
              View view,
              float x,
              float y,
              @Nullable Predicate<View> viewSelector,

          Function 20 has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          /***/ function(module, exports) {
          
              ;__weex_define__("@weex-component/link", [], function(__weex_require__, __weex_exports__, __weex_module__){
          
              ;
          Severity: Minor
          Found in playground/app/src/main/assets/showcase/new-fashion/headlines.js - About 1 hr to fix

            Method connect has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @Override
                protected void connect(String url) {
                    if (webSocketClient != null) {
                        webSocketClient.connect(url, new IWebSocketClient.WSListener() {
                            @Override

              Method handleRemoteRequest has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private void handleRemoteRequest(JsonRpcPeer peer, JSONObject requestNode)
                          throws MessageHandlingException {
                      JsonRpcRequest request;
                      request = mObjectMapper.convertValue(
                              requestNode,

                Method getRootViews has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    @SuppressWarnings("unchecked") // no way to check
                    private static List<ViewRootData> getRootViews(Activity activity) {
                        List<ViewRootData> rootViews = new ArrayList<>();
                
                        Object globalWindowManager;

                  Method convertValueToInt has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static final int
                      convertValueToInt(CharSequence charSeq, int defaultValue)
                      {
                          if (null == charSeq)
                              return defaultValue;

                    Method invoke has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        @Override
                        public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                    
                          if ("onOpen".equals(method.getName())) {
                            mWebSocket = mWebSocketClazz.cast(args[0]);
                      Severity
                      Category
                      Status
                      Source
                      Language