Showing 7,775 of 7,775 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    private class Iter implements Iterator<Component> {
        private final ListIterator<? extends Component> _it = getChildren().listIterator();

        public boolean hasNext() {
            while (_it.hasNext()) {
Severity: Major
Found in zul/src/main/java/org/zkoss/zul/Tree.java and 1 other location - About 1 hr to fix
zul/src/main/java/org/zkoss/zul/Grid.java on lines 1903..1928

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 99.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public void set(Object parent, int indexFrom, int indexTo, Object[] values) throws IndexOutOfBoundsException{
        ArrayList al = (ArrayList)parent;
        for(int i=indexFrom; i<=indexTo;i++){
            try{
                al.set(i, values[i-indexFrom]);
zktest/src/main/java/org/zkoss/zktest/test2/tree/TreeModelA.java on lines 139..150

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 99.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public void insert(Object parent, int indexFrom, int indexTo, Object[] newNodes) throws IndexOutOfBoundsException{
        ArrayList al = (ArrayList)parent;
        for(int i=indexFrom; i<=indexTo; i++){
            try{
                al.add(i, newNodes[i-indexFrom]);
zktest/src/main/java/org/zkoss/zktest/test2/tree/TreeModelA.java on lines 84..94

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 99.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method Concatenation has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  final public void Concatenation() throws ParseException {
    Math();
    label_11:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
Severity: Minor
Found in zel/src/main/java/org/zkoss/zel/impl/parser/ELParser.java - About 1 hr to fix

    Method getValue has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public Object getValue(EvaluationContext ctx) throws ELException {
    
            // Correct evaluation requires knowledge of the whole set of nested
            // expressions, not just the current expression
            NestedState state = getNestedState();

      Method Semicolon has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        final public void Semicolon() throws ParseException {
          Assignment();
          label_2:
          while (true) {
            switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      Severity: Minor
      Found in zel/src/main/java/org/zkoss/zel/impl/parser/ELParser.java - About 1 hr to fix

        Method Value has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          final public void Value() throws ParseException {
              AstValue jjtn001 = new AstValue(JJTVALUE);
              boolean jjtc001 = true;
              jjtree.openNodeScope(jjtn001);
            try {
        Severity: Minor
        Found in zel/src/main/java/org/zkoss/zel/impl/parser/ELParser.java - About 1 hr to fix

          Method getExpressionFactory has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              static ExpressionFactory getExpressionFactory() {
          
                  ClassLoader tccl = ClassUtil.getContextClassLoader(Util.class);
                  CacheValue cacheValue = null;
                  ExpressionFactory factory = null;
          Severity: Minor
          Found in zel/src/main/java/org/zkoss/zel/Util.java - About 1 hr to fix

            Method init has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @Init
                public void init() {
                    listModelList.add(new Data("c", "cat"));
                    listModelList.add(new Data("a", "ace"));
                    listModelList.add(new Data("a", "ape"));
            Severity: Minor
            Found in zktest/src/main/java/org/zkoss/zktest/test2/F96_ZK_4595VM.java - About 1 hr to fix

              Method applyForward0 has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static final void applyForward0(Component comp, String orgEvent, String cond) {
                      int len;
                      if (cond == null || (len = cond.length()) == 0)
                          len = (cond = orgEvent).length();
                      //if condition not specified, assume same as orgEvent (to space owenr)
              Severity: Minor
              Found in zk/src/main/java/org/zkoss/zk/ui/sys/ComponentsCtrl.java - About 1 hr to fix

                Method getComposer has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    @SuppressWarnings("unchecked")
                    public static Composer getComposer(Page page, Object[] ary) throws Exception {
                        if (ary == null || ary.length == 0)
                            return null;
                
                
                Severity: Minor
                Found in zk/src/main/java/org/zkoss/zk/ui/impl/MultiComposer.java - About 1 hr to fix

                  Method desktopDestroyed has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private static void desktopDestroyed(Desktop desktop) {
                          final Session sess = desktop.getSession();
                          final Execution exec = new ExecutionImpl(desktop.getWebApp().getServletContext(), null, null, desktop, null);
                          final DesktopCtrl desktopCtrl = (DesktopCtrl) desktop;
                          final Execution oldExec = desktop.getExecution();
                  Severity: Minor
                  Found in zk/src/main/java/org/zkoss/zk/ui/impl/SimpleDesktopCache.java - About 1 hr to fix

                    Method createFormProxy has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        @SuppressWarnings({ "unchecked", "rawtypes" })
                        public static <T> T createFormProxy(T origin, Class<?> type, Class[] interfaces) {
                    
                            if (origin instanceof Form)
                                return origin;
                    Severity: Minor
                    Found in zkbind/src/main/java/org/zkoss/bind/proxy/ProxyHelper.java - About 1 hr to fix

                      Method keySet has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public Set<K> keySet() {
                              if (this.keySet == null) {
                                  this.keySet = new AbstractSet<K>() {
                                      public Iterator iterator() {
                                          return createHashIterator(KEYS);
                      Severity: Minor
                      Found in zkbind/src/main/java/org/zkoss/bind/impl/WeakIdentityMap.java - About 1 hr to fix

                        Method compare has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            static int compare(Object a, Object b) {
                                if (a == b) {
                                    return 0;
                                }
                                if (a == null) {
                        Severity: Minor
                        Found in zkbind/src/main/java/org/zkoss/bind/impl/KeyFactory.java - About 1 hr to fix

                          Method doCommand has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private int doCommand(Component comp, CommandBinding commandBinding, String command, Event evt,
                                      Map<String, Object> commandArgs, Set<Property> notifys) {
                                  final String evtnm = evt == null ? null : evt.getName();
                                  String debugInfo = MessageFormat.format("doCommand "
                                          + "comp=[{0}],command=[{1}],evtnm=[{2}]", comp, command, evtnm);
                          Severity: Minor
                          Found in zkbind/src/main/java/org/zkoss/bind/impl/BinderImpl.java - About 1 hr to fix

                            Method storeForm has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public void storeForm(Component comp, String id, Form form) {
                                    final String oldid = (String) comp.getAttribute(FORM_ID, Component.COMPONENT_SCOPE);
                                    //check if a form exist already, allow to store a form with same id again for replacing the form
                                    if (oldid != null && !oldid.equals(id)) {
                                        throw new IllegalArgumentException(
                            Severity: Minor
                            Found in zkbind/src/main/java/org/zkoss/bind/impl/BinderImpl.java - About 1 hr to fix

                              Method fixGroupsInfoAfterInsert has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private void fixGroupsInfoAfterInsert(Listitem newItem) {
                                      if (_isReplacingItem) //@see Renderer#render
                                          return; //called by #insertBefore(), skip handling GroupInfo
                              
                                      if (newItem instanceof Listgroup) {
                              Severity: Minor
                              Found in zul/src/main/java/org/zkoss/zul/Listbox.java - About 1 hr to fix

                                Method generateURI has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public static final String generateURI(String uri, Map params, int mode) {
                                        if (uri.startsWith("~"))
                                            throw new IllegalArgumentException("~ctx not supported here: " + uri);
                                
                                        final int j = uri.indexOf('?');
                                Severity: Minor
                                Found in zweb/src/main/java/org/zkoss/web/servlet/Servlets.java - About 1 hr to fix

                                  Function deprecate has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      function deprecate(msg, fn) {
                                          var firstTime = true;
                                  
                                          return extend(function () {
                                              if (hooks.deprecationHandler != null) {
                                  Severity: Minor
                                  Found in zk/src/main/resources/web/js/zk/ext/moment.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language