Showing 7,775 of 7,775 total issues

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

    public static class Profile {
        String number;

        Address address;
        
zktest/src/main/java/org/zkoss/zktest/bind/issue/F00901ReferenceBinding.java on lines 35..60

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 78.

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

    private static Map<Component, ShadowInfo> getShadowInfos(boolean autoCreate) {
        Execution exec = Executions.getCurrent();
        if (exec == null)
            return null;

Severity: Major
Found in zk/src/main/java/org/zkoss/zk/ui/impl/Utils.java and 1 other location - About 1 hr to fix
zk/src/main/java/org/zkoss/zk/ui/impl/Utils.java on lines 112..123

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 78.

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

    private static Map<Component, ComponentInfo> getComponentInfos(boolean autoCreate) {
        Execution exec = Executions.getCurrent();
        if (exec == null)
            return null;

Severity: Major
Found in zk/src/main/java/org/zkoss/zk/ui/impl/Utils.java and 1 other location - About 1 hr to fix
zk/src/main/java/org/zkoss/zk/ui/impl/Utils.java on lines 137..148

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 78.

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

    public static final String toReadable(long val, String skips) {
        if (skips == null) skips = SKIPS;

        final int mod = 36 - skips.length();

Severity: Minor
Found in zcommon/src/main/java/org/zkoss/util/Checksums.java - About 1 hr to fix

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

        private void init(String name, byte[] data) throws IOException {
            if (data == null)
                throw new IllegalArgumentException("null data");
            _name = name;
            _data = data;
    Severity: Minor
    Found in zcommon/src/main/java/org/zkoss/image/AImage.java - About 1 hr to fix

      Method getLastModified has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public long getLastModified(K src) {
              if (src instanceof URL) {
                  URLConnection conn = null;
                  try {
                      URL url = (URL) src;
      Severity: Minor
      Found in zcommon/src/main/java/org/zkoss/util/resource/AbstractLoader.java - About 1 hr to fix

        Method expendValue has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private String expendValue(Map labels, String value) {
                if (labels != null && value != null) {
                    int offset = 0;
                    while (offset < value.length()) {
                        int start = value.indexOf("${", offset);

          Method toString has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public String toString(){
                  StringBuffer sb = new StringBuffer();
                  switch(type){
                  case TYPE_VALUE:
                      sb.append("VALUE(").append(value).append(')');
          Severity: Minor
          Found in zcommon/src/main/java/org/zkoss/json/parser/Yytoken.java - About 1 hr to fix

            Method matched has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private static boolean matched(Class[] types, Object[] args, boolean loosely) {
                    if (types.length == args.length) {
                        final Object[] argcvt = loosely ? new Object[args.length]: args;
                        boolean cvted = false;
                        for (int k = args.length;;) {
            Severity: Minor
            Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 1 hr to fix

              Method toAttributeName has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static final String toAttributeName(String methodName) {
                      int len = methodName.length();
                      if (len < 2)
                          return null;
              
              
              Severity: Minor
              Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 1 hr to fix

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

                    @SuppressWarnings({ "rawtypes", "unchecked" })
                    private Optional compare(boolean isMax) {
                        Comparable result = null;
                
                        if (iterator.hasNext()) {
                Severity: Minor
                Found in zel/src/main/java/org/zkoss/zel/impl/stream/Stream.java - About 1 hr to fix

                  Method getOutputStream has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          @Override
                          public ServletOutputStream getOutputStream() throws IOException {
                              if (writer != null) {
                                  throw new IllegalStateException(
                                          "getWriter() has already been called on this response.");

                    Method run has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            public void run() {
                                boolean disconnect=false;
                                while (!disconnect) {
                                    try {
                                        if(updating) {

                      Method manualOperation has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private Thread manualOperation(final Desktop desktop) {
                              return new Thread() {
                                  public void run() {
                                      try {
                                          Executions.activate(desktop);

                        Method getValidator1 has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public Validator getValidator1(){
                                return new AbstractValidator() {
                                    
                                    
                                    public void validate(ValidationContext ctx) {

                          Method addColumn has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              @Listen("onClick = #addColumn")
                              public void addColumn() {
                                  String columnLabel = "Column " + columnNum;
                                  String footLabel = "Footer " + columnNum;
                                  String width = "100px";

                            Method outLangStyleSheets has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public static final String outLangStyleSheets(Execution exec, WebApp wapp, String deviceType) {
                                    if (exec.isAsyncUpdate(null) || exec.getAttribute(ATTR_LANG_CSS_GENED) != null)
                                        return ""; //nothing to generate
                                    exec.setAttribute(ATTR_LANG_CSS_GENED, Boolean.TRUE);
                            
                            
                            Severity: Minor
                            Found in zk/src/main/java/org/zkoss/zk/ui/sys/HtmlPageRenders.java - About 1 hr to fix

                              Method sendEvent has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public static void sendEvent(Component comp, Event event) {
                                      final Execution exec = Executions.getCurrent();
                                      final Desktop desktop = exec.getDesktop();
                                      //note: we don't use comp.getDesktop because 1) it may be null
                                      //2) it may be different from the current desktop
                              Severity: Minor
                              Found in zk/src/main/java/org/zkoss/zk/ui/event/Events.java - About 1 hr to fix

                                Method processDynamicWpdWithSourceMapIfAny has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    private byte[] processDynamicWpdWithSourceMapIfAny(HttpServletRequest request, HttpServletResponse response, String pkgWpd, String path) throws Exception {
                                        List<String> dividedPaths = splitSourceMapJsPathIfAny(path);
                                        StringBuilder sb = new StringBuilder();
                                        int index = 0;
                                        String lastWpd = null;
                                Severity: Minor
                                Found in zk/src/main/java/org/zkoss/zk/ui/http/WpdExtendlet.java - About 1 hr to fix

                                  Method findResourcePath has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      private String findResourcePath(RequestContext reqctx, OutputStream out, String path, String dir, boolean locate, boolean write) throws ServletException, IOException {
                                          if (path.startsWith("~./")) path = path.substring(2);
                                          else if (path.charAt(0) != '/') path = Files.normalize(dir, path);
                                          //source map browser issue and check source map file is available or not
                                          String originalPath = "";
                                  Severity: Minor
                                  Found in zk/src/main/java/org/zkoss/zk/ui/http/WpdExtendlet.java - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language