weexteam/weex_devtools_android

View on GitHub

Showing 472 of 2,519 total issues

Method emulateTouchFromMouseEvent has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  @ChromeDevtoolsMethod
  public JsonRpcResult emulateTouchFromMouseEvent(JsonRpcPeer peer, JSONObject params) {
    final EmulateTouchFromMouseEventRequest request = mObjectMapper.convertValue(
        params, EmulateTouchFromMouseEventRequest.class);
    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 setUp has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Before
    public void setUp() throws InterruptedException {
        super.setUp();
        HashMap testMap = new <String, Object> HashMap();
        testMap.put("testComponet", "AG_Input");

    Method setUp has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Before
        public void setUp() throws InterruptedException {
            super.setUp();
            HashMap testMap = new <String, Object> HashMap();
            testMap.put("testComponet", "AG_Text");

      Method addTab has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private void addTab(String title, final boolean selected, final View.OnClickListener listener) {
          final TextView textView = new TextView(this);
          textView.setText(title);
          LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
          lp.weight = 1;

        Method interpretResponseStream has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          @Override
          public InputStream interpretResponseStream(
              String requestId,
              @Nullable String contentType,
              @Nullable String contentEncoding,

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

                  data: function () {return {
                    dir: 'examples',
                    tabItems: [
                      {
                        index: 0,
          Severity: Minor
          Found in playground/app/src/main/assets/component/tabbar/tabbar-demo.js - About 1 hr to fix

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

                    data: function () {return {
                      dir: 'examples',
                      tabItems: [
                        {
                          index: 0,
            Severity: Minor
            Found in playground/app/src/main/assets/showcase/new-fashion/index.js - About 1 hr to fix

              Method objectForRemote has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public RemoteObject objectForRemote(Object value) {
                    RemoteObject result = new RemoteObject();
                    if (value == null) {
                      result.type = ObjectType.OBJECT;
                      result.subtype = ObjectSubType.NULL;

                Consider simplifying this complex logical expression.
                Open

                    if (key != null) {
                      String exp = key.toLowerCase();
                      result = !exp.contains("padding") && !exp.contains("margin")
                          && !exp.contains("width") && !exp.contains("height")
                          && !exp.contains("left")

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