weexteam/weex_devtools_android

View on GitHub

Showing 2,519 of 2,519 total issues

Consider simplifying this complex logical expression.
Open

                          if ((matchArr = v.match(new RegExp('^([a-z0-9-]+\:)?' +    //protocol
                                          '[/]{2}' +                            //slash x 2
                                          '(?:([^@/:\?]+)(?::([^@/:]+))?@)?' +  //username:password@
                                          '([^:/?#]+)' +                        //hostname
                                          '(?:[:]([0-9]+))?' +                  //port
Severity: Critical
Found in playground/app/src/main/assets/showcase/new-fashion/main.js - About 1 hr to fix

    Method setElementParent has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private void setElementParent(Object element, Object parentElement) {
          ElementInfo changesElementInfo = mElementToInfoChangesMap.get(element);
          if (changesElementInfo != null &&
              parentElement == changesElementInfo.parentElement) {
            return;

      Method computeComponentContentHeight has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        static int computeComponentContentHeight(@NonNull WXComponent component) {
          View view = component.getHostView();
          if(view == null) {
            return 0;
          }

        Method getComputedStyleForNode has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          @ChromeDevtoolsMethod
          public JsonRpcResult getComputedStyleForNode(JsonRpcPeer peer, JSONObject params) {
            final GetComputedStyleForNodeRequest request = mObjectMapper.convertValue(
                params,
                GetComputedStyleForNodeRequest.class);

          Function data has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  data: function () {return {
                    root: 'examples',
                    items: [
                      // `name` key is the example filename without '.we'
                      // Support sub directory, e.g. 'new-fashion/index'
          Severity: Minor
          Found in playground/app/src/main/assets/index.js - About 1 hr to fix

            Method doSanpForListOrScroller has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private static Bitmap doSanpForListOrScroller(View sanpView){
            
                    Bitmap b = null;
            
                    if(sanpView!=null){

              Method findMatchingElements has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                public void findMatchingElements(int x, int y, Accumulator<Integer> matchedIds) {
                  verifyThreadAccess();
              
                  final Object rootElement = mDocumentProvider.getRootElement();
                  final ElementInfo info = mShadowDocument.getElementInfo(rootElement);

                Method createShadowDocumentUpdate has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Method handleRemoteRequest has 32 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 getPropertiesForObject has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

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

                      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 updateScreenBitmap has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private void updateScreenBitmap() {
                              if (!mIsRunning) {
                                return;
                              }
                              Activity activity = mActivityTracker.tryGetTopActivity();

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

                          Severity
                          Category
                          Status
                          Source
                          Language