zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java

Summary

Maintainability
F
1 mo
Test Coverage

Method parseItem has a Cognitive Complexity of 303 (exceeds 5 allowed). Consider refactoring.
Open

    private Object parseItem(PageDefinition pgdef, NodeInfo parent, Element el, AnnotationHelper annHelper,
            boolean bNativeContent, ParsingState parsingState) throws Exception {
        final String nm = el.getLocalName();
        final Namespace ns = el.getNamespace();
        final String pref = ns != null ? ns.getPrefix() : "";
Severity: Minor
Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 6 days to fix

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

File Parser.java has 1497 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* Parser.java

    Purpose:
        
    Description:
Severity: Major
Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 3 days to fix

    Method parseItems has a Cognitive Complexity of 139 (exceeds 5 allowed). Consider refactoring.
    Open

        private void parseItems(final PageDefinition pgdef, final NodeInfo parent, Collection items,
                AnnotationHelper annHelper, boolean bNativeContent) throws Exception {
            LanguageDefinition parentlang = getLanguageDefinition(parent);
            if (parentlang == null)
                parentlang = pgdef.getLanguageDefinition();
    Severity: Minor
    Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 2 days to fix

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

        private static NodeInfo parseShadowElement(PageDefinition pgdef, NodeInfo parent, Element el,
                AnnotationHelper annHelper) throws Exception {
            String ifc = null, unless = null, name = el.getLocalName();
            AnnotationHelper attrAnnHelper = null;
            final LanguageDefinition lookup = LanguageDefinition.lookup("xul/html");
    Severity: Minor
    Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 1 day to fix

    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

    Parser has 62 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class Parser {
        private static final Logger log = LoggerFactory.getLogger(Parser.class);
    
        private final WebApp _wapp;
        private final Locator _locator;
    Severity: Major
    Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 1 day to fix

      Method parseItem has 223 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private Object parseItem(PageDefinition pgdef, NodeInfo parent, Element el, AnnotationHelper annHelper,
                  boolean bNativeContent, ParsingState parsingState) throws Exception {
              final String nm = el.getLocalName();
              final Namespace ns = el.getNamespace();
              final String pref = ns != null ? ns.getPrefix() : "";
      Severity: Major
      Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 1 day to fix

        Method optimizeNativeInfos has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
        Open

            private static void optimizeNativeInfos(NativeInfo compInfo) {
                //Optimize 1: merge to prolog, if the first children are
                //native and have no child
                for (Iterator it = compInfo.getChildren().iterator(); it.hasNext();) {
                    final NodeInfo o = (NodeInfo) it.next();
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 7 hrs to fix

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

            private void addAttribute(ComponentInfo compInfo, Namespace attrns, String name, String value, ConditionImpl cond,
                    org.zkoss.xml.Locator xl) throws Exception {
                if (Events.isValid(name)) {
                    boolean bZkAttr = attrns == null;
                    if (!bZkAttr) {
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 7 hrs to fix

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

            private static String modifyAttrValueIfSimplified(String attrName, String attrValue) {
                boolean isCommand = attrValue.matches("@(global-)?command\\(.*\\)");
                if (attrValue.matches("@\\(.*\\)") || isCommand) {
                    if (Events.isValid(attrName) || isCommand) {
                        int attrValueIndex = attrValue.indexOf("(") + 1;
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 6 hrs to fix

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

            public PageDefinition parse(Document doc, String extension) throws Exception {
                //1. parse the page and import directive if any
                final List<ProcessingInstruction> pis = new LinkedList<ProcessingInstruction>();
                final List<String[]> imports = new LinkedList<String[]>();
                final List<String> impclses = new LinkedList<String>();
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 6 hrs to fix

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

            private void parseComponentDirective(PageDefinition pgdef, ProcessingInstruction pi, Map<String, String> params)
                    throws Exception {
                final String name = params.remove("name");
                noELnorEmpty("name", name, pi);
        
        
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 5 hrs to fix

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

            private void parse(PageDefinition pgdef, ProcessingInstruction pi) throws Exception {
                final String target = pi.getTarget();
                final Map<String, String> params = pi.parseData();
                if ("page".equals(target)) {
                    parsePageDirective(pgdef, pi, params);
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 4 hrs to fix

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

            private static ZkInfo parseZk(NodeInfo parent, Element el, AnnotationHelper annHelper) throws Exception {
                if (annHelper.clear())
                    log.warn(message("Annotations are ignored since <zk> doesn't support them", el));
        
                final ZkInfo zi = new ZkInfo(parent, null);
        Severity: Minor
        Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 4 hrs to fix

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

            private void parseItems(final PageDefinition pgdef, final NodeInfo parent, Collection items,
                    AnnotationHelper annHelper, boolean bNativeContent) throws Exception {
                LanguageDefinition parentlang = getLanguageDefinition(parent);
                if (parentlang == null)
                    parentlang = pgdef.getLanguageDefinition();
        Severity: Major
        Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 4 hrs to fix

          Method parseEvaluatorDirective has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              private static void parseEvaluatorDirective(PageDefinition pgdef, ProcessingInstruction pi,
                      Map<String, String> params) throws Exception {
                  final String clsnm = params.remove("class");
                  if (clsnm != null && clsnm.length() > 0) {
                      noELnorEmpty("class", clsnm, pi);
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 3 hrs to fix

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

              private void parseZScript(NodeInfo parent, Element el, AnnotationHelper annHelper) {
                  if (el.getAttributeItem("forEach") != null)
                      throw new UiException(message("forEach not applicable to <zscript>", el));
                  if (annHelper.clear())
                      log.warn(message("Annotations are ignored since <zscript> doesn't support them", el));
          Severity: Minor
          Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 3 hrs to fix

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

              private void parseComponentDirective(PageDefinition pgdef, ProcessingInstruction pi, Map<String, String> params)
                      throws Exception {
                  final String name = params.remove("name");
                  noELnorEmpty("name", name, pi);
          
          
          Severity: Major
          Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 3 hrs to fix

            Method parseShadowElement has 82 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private static NodeInfo parseShadowElement(PageDefinition pgdef, NodeInfo parent, Element el,
                        AnnotationHelper annHelper) throws Exception {
                    String ifc = null, unless = null, name = el.getLocalName();
                    AnnotationHelper attrAnnHelper = null;
                    final LanguageDefinition lookup = LanguageDefinition.lookup("xul/html");
            Severity: Major
            Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 3 hrs to fix

              Method parseTemplate has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

                  private static TemplateInfo parseTemplate(NodeInfo parent, Element el, AnnotationHelper annHelper)
                          throws Exception {
                      if (annHelper.clear())
                          log.warn(message("Annotations are ignored since <template> doesn't support them", el));
                      if (el.getAttributeItem("forEach") != null)
              Severity: Minor
              Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 2 hrs to fix

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

                  private static void parseCustomAttributes(LanguageDefinition langdef, NodeInfo parent, Element el,
                          AnnotationHelper annHelper) throws Exception {
                      //if (!el.getElements().isEmpty())
                      //    throw new UiException(message("Child elements are not allowed for <custom-attributes>", el));
              
              
              Severity: Minor
              Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 2 hrs to fix

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

                  public PageDefinition parse(Document doc, String extension) throws Exception {
                      //1. parse the page and import directive if any
                      final List<ProcessingInstruction> pis = new LinkedList<ProcessingInstruction>();
                      final List<String[]> imports = new LinkedList<String[]>();
                      final List<String> impclses = new LinkedList<String>();
              Severity: Major
              Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 2 hrs to fix

                Method parsePageDirective has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    private static void parsePageDirective(PageDefinition pgdef, ProcessingInstruction pi, Map<String, String> params)
                            throws Exception {
                        for (Map.Entry<String, String> me : pi.parseData().entrySet()) {
                            final String nm = me.getKey();
                            final String val = me.getValue();
                Severity: Minor
                Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 2 hrs to fix

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

                    private boolean textAsAllowed(LanguageDefinition langdef, Collection<Item> items, boolean bNativeContent) {
                        boolean textAsAllowed = true;
                        String xmlFound = null; //whether a XML fragment
                        String zkElem = null; //a ZK element
                        boolean empty = true; //whether there is anything other than whitespace
                Severity: Minor
                Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 2 hrs to fix

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

                    private void parse(PageDefinition pgdef, ProcessingInstruction pi) throws Exception {
                        final String target = pi.getTarget();
                        final Map<String, String> params = pi.parseData();
                        if ("page".equals(target)) {
                            parsePageDirective(pgdef, pi, params);
                Severity: Major
                Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 2 hrs to fix

                  Method modifyAttrValueIfSimplified has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private static String modifyAttrValueIfSimplified(String attrName, String attrValue) {
                          boolean isCommand = attrValue.matches("@(global-)?command\\(.*\\)");
                          if (attrValue.matches("@\\(.*\\)") || isCommand) {
                              if (Events.isValid(attrName) || isCommand) {
                                  int attrValueIndex = attrValue.indexOf("(") + 1;
                  Severity: Major
                  Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 2 hrs to fix

                    Method optimizeNativeInfos has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private static void optimizeNativeInfos(NativeInfo compInfo) {
                            //Optimize 1: merge to prolog, if the first children are
                            //native and have no child
                            for (Iterator it = compInfo.getChildren().iterator(); it.hasNext();) {
                                final NodeInfo o = (NodeInfo) it.next();
                    Severity: Major
                    Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 2 hrs to fix

                      Method addAttribute has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private void addAttribute(ComponentInfo compInfo, Namespace attrns, String name, String value, ConditionImpl cond,
                                  org.zkoss.xml.Locator xl) throws Exception {
                              if (Events.isValid(name)) {
                                  boolean bZkAttr = attrns == null;
                                  if (!bZkAttr) {
                      Severity: Major
                      Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 2 hrs to fix

                        Method parseVariables has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private static void parseVariables(LanguageDefinition langdef, NodeInfo parent, Element el,
                                    AnnotationHelper annHelper) throws Exception {
                                //if (!el.getElements().isEmpty())
                                //    throw new UiException(message("Child elements are not allowed for <variables> element", el));
                        
                        
                        Severity: Minor
                        Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 1 hr to fix

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

                            private void parseZScript(NodeInfo parent, Element el, AnnotationHelper annHelper) {
                                if (el.getAttributeItem("forEach") != null)
                                    throw new UiException(message("forEach not applicable to <zscript>", el));
                                if (annHelper.clear())
                                    log.warn(message("Annotations are ignored since <zscript> doesn't support them", el));
                        Severity: Minor
                        Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 1 hr to fix

                          Method parsePageDirective has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private static void parsePageDirective(PageDefinition pgdef, ProcessingInstruction pi, Map<String, String> params)
                                      throws Exception {
                                  for (Map.Entry<String, String> me : pi.parseData().entrySet()) {
                                      final String nm = me.getKey();
                                      final String val = me.getValue();
                          Severity: Minor
                          Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 1 hr to fix

                            Method toAbsoluteURI has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                            Open

                                private String toAbsoluteURI(String uri) {
                                    if (uri != null && uri.length() > 0) {
                                        final char cc = uri.charAt(0);
                                        if (cc != '/' && cc != '~' && !Servlets.isUniversalURL(uri)) {
                                            final String dir = getLocator().getDirectory();
                            Severity: Minor
                            Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 1 hr to fix

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

                                private void parseInitDirective(PageDefinition pgdef, ProcessingInstruction pi, Map<String, String> params)
                                        throws Exception {
                                    final String clsnm = params.remove("class");
                                    final String zsrc = params.remove("zscript");
                            
                            
                            Severity: Minor
                            Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 1 hr to fix

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

                                private static ZkInfo parseZk(NodeInfo parent, Element el, AnnotationHelper annHelper) throws Exception {
                                    if (annHelper.clear())
                                        log.warn(message("Annotations are ignored since <zk> doesn't support them", el));
                            
                                    final ZkInfo zi = new ZkInfo(parent, null);
                            Severity: Minor
                            Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 1 hr to fix

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

                                  private static void parseCustomAttributes(LanguageDefinition langdef, NodeInfo parent, Element el,
                                          AnnotationHelper annHelper) throws Exception {
                                      //if (!el.getElements().isEmpty())
                                      //    throw new UiException(message("Child elements are not allowed for <custom-attributes>", el));
                              
                              
                              Severity: Minor
                              Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 1 hr to fix

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

                                    private static final LanguageDefinition getLanguageDefinition(NodeInfo node) {
                                        for (; node != null; node = node.getParent()) {
                                            if (node instanceof ComponentInfo) {
                                                LanguageDefinition langdef = ((ComponentInfo) node).getLanguageDefinition();
                                                if (langdef != null)
                                Severity: Minor
                                Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 1 hr to fix

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

                                    private static TemplateInfo parseTemplate(NodeInfo parent, Element el, AnnotationHelper annHelper)
                                            throws Exception {
                                        if (annHelper.clear())
                                            log.warn(message("Annotations are ignored since <template> doesn't support them", el));
                                        if (el.getAttributeItem("forEach") != null)
                                Severity: Minor
                                Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 1 hr to fix

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

                                      private boolean textAsAllowed(LanguageDefinition langdef, Collection<Item> items, boolean bNativeContent) {
                                          boolean textAsAllowed = true;
                                          String xmlFound = null; //whether a XML fragment
                                          String zkElem = null; //a ZK element
                                          boolean empty = true; //whether there is anything other than whitespace
                                  Severity: Minor
                                  Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 1 hr to fix

                                    Method parseAttribute has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        private void parseAttribute(PageDefinition pgdef, ComponentInfo parent, Element el, AnnotationHelper annHelper)
                                                throws Exception {
                                            if (el.getAttributeItem("forEach") != null)
                                                throw new UiException(message("forEach not applicable to attribute", el));
                                    
                                    
                                    Severity: Minor
                                    Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 1 hr to fix

                                      Method parseAttribute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          private void parseAttribute(PageDefinition pgdef, ComponentInfo parent, Element el, AnnotationHelper annHelper)
                                                  throws Exception {
                                              if (el.getAttributeItem("forEach") != null)
                                                  throw new UiException(message("forEach not applicable to attribute", el));
                                      
                                      
                                      Severity: Minor
                                      Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 55 mins to fix

                                      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 applyAttrAnnot has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                          private static void applyAttrAnnot(AnnotationHelper attrAnnHelper, ShadowInfo compInfo, String nm, String val,
                                                  boolean selfAllowed, org.zkoss.util.resource.Location loc) {
                                      Severity: Minor
                                      Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 45 mins to fix

                                        Method addAttribute has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                            private void addAttribute(ComponentInfo compInfo, Namespace attrns, String name, String value, ConditionImpl cond,
                                                    org.zkoss.xml.Locator xl) throws Exception {
                                        Severity: Minor
                                        Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 45 mins to fix

                                          Method applyAttrAnnot has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                          Open

                                              private static void applyAttrAnnot(AnnotationHelper attrAnnHelper, ComponentInfo compInfo, String nm, String val,
                                                      boolean selfAllowed, org.zkoss.util.resource.Location loc) {
                                          Severity: Minor
                                          Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 45 mins to fix

                                            Avoid deeply nested control flow statements.
                                            Open

                                                                            if (nsParser.isMatched(attURI)) {
                                                                                if (nsParser.parse(attr, compInfo, pgdef)) {
                                                                                    handled = true;
                                                                                    break;
                                                                                }
                                            Severity: Major
                                            Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 45 mins to fix

                                              Avoid deeply nested control flow statements.
                                              Open

                                                                      for (Annotation anno : annotationMap.getAnnotations(propName)) {
                                                                          compInfo.addAnnotation(propName, anno.getName(), anno.getAttributes(), anno.getLocation());
                                                                      }
                                              Severity: Major
                                              Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 45 mins to fix

                                                Method parseItem has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                                Open

                                                    private Object parseItem(PageDefinition pgdef, NodeInfo parent, Element el, AnnotationHelper annHelper,
                                                            boolean bNativeContent, ParsingState parsingState) throws Exception {
                                                Severity: Minor
                                                Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 45 mins to fix

                                                  Method isShadowElement has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                                  Open

                                                      private static final boolean isShadowElement(LanguageDefinition langdef, PageDefinition pgdef, String nm,
                                                              String pref, String uri, boolean bNativeContent) {
                                                  Severity: Minor
                                                  Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 45 mins to fix

                                                    Method parseAsProperty has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                                    Open

                                                        private void parseAsProperty(PageDefinition pgdef, ComponentInfo compInfo, String name, Collection items,
                                                                AnnotationHelper annHelper, ConditionImpl cond) throws Exception {
                                                    Severity: Minor
                                                    Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 45 mins to fix

                                                      Avoid deeply nested control flow statements.
                                                      Open

                                                                              if (cc == ',') {
                                                                                  sb.append(cc);
                                                                                  modifiedCommandPropertySb.append(modifyAttrValueIfSimplified0(nm, sb.toString().trim(), paramIndex, isNamedParam));
                                                                                  if (paramIndex != 0 && !isNamedParam && nm != null) { // named param and un-named parameters together
                                                                                      throwCommandSimplifiedErrorUsage();
                                                      Severity: Major
                                                      Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 45 mins to fix

                                                        Consider simplifying this complex logical expression.
                                                        Open

                                                                                    if (!bNativeContent && !bNative && (shouldIgnoreAnnotNamespace
                                                                                            || (attURI.length() == 0 || LanguageDefinition.ZK_NAMESPACE.endsWith(attURI)))
                                                                                            && AnnotationHelper.isAnnotation(attvaltrim)) {
                                                                                        if (attrAnnHelper == null)
                                                                                            attrAnnHelper = new AnnotationHelper();
                                                        Severity: Major
                                                        Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 40 mins to fix

                                                          Consider simplifying this complex logical expression.
                                                          Open

                                                                                  if (!isZkAttr(langdef, attrns) && !isZKNamespace(attURI) && !"xmlns".equals(attPref)
                                                                                          && !("xmlns".equals(attnm) && "".equals(attPref))
                                                                                          && !"http://www.w3.org/2001/XMLSchema-instance".equals(attURI)) {
                                                          
                                                                                      // Bug ZK-2995
                                                          Severity: Major
                                                          Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 40 mins to fix

                                                            Consider simplifying this complex logical expression.
                                                            Open

                                                                            if (isZkElement(langdef, e, bNativeContent) && ("attribute".equals(n) || "custom-attributes".equals(n)
                                                                                    || "variables".equals(n) || "template".equals(n) || "zscript".equals(n))) { //we have to skip zscript because of B50-3259479
                                                                                zkElem = n;
                                                                                textAsAllowed = false;
                                                                                //unable to handle them because EL/zscript might affect
                                                            Severity: Major
                                                            Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 40 mins to fix

                                                              Consider simplifying this complex logical expression.
                                                              Open

                                                                              if (!"xmlns".equals(attnm) && !"xml".equals(attnm) && !attURI.contains("w3.org")
                                                                                      && (attPref == null || (!"xmlns".equals(attPref) && !"xml".equals(attPref))))
                                                                                  warnWrongZkAttr(attr);
                                                              Severity: Major
                                                              Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 40 mins to fix

                                                                Consider simplifying this complex logical expression.
                                                                Open

                                                                                if (!"xmlns".equals(attnm) && !"xml".equals(attnm) && !attURI.contains("w3.org")
                                                                                        && (attPref == null || (!"xmlns".equals(attPref) && !"xml".equals(attPref))))
                                                                                    params.put(attnm, attval);
                                                                Severity: Major
                                                                Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 40 mins to fix

                                                                  Method parseItems has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                  Open

                                                                      private void parseItems(final PageDefinition pgdef, final NodeInfo parent, Collection items,
                                                                              AnnotationHelper annHelper, boolean bNativeContent) throws Exception {
                                                                  Severity: Minor
                                                                  Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 35 mins to fix

                                                                    Method isZkElement has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                    Open

                                                                        private static final boolean isZkElement(LanguageDefinition langdef, String nm, String pref, String uri,
                                                                                boolean bNativeContent) {
                                                                    Severity: Minor
                                                                    Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 35 mins to fix

                                                                      Method isShadowElement has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                      Open

                                                                          private static final boolean isShadowElement(LanguageDefinition langdef, PageDefinition pgdef, String nm,
                                                                                  String pref, String uri, boolean bNativeContent) {
                                                                              // feature in 8.0.0, no need to check namespace, if any.
                                                                              if ("true".equalsIgnoreCase(Library.getProperty("org.zkoss.zk.namespace.tolerant", "false")))
                                                                                  return langdef.hasShadowDefinition(nm) || (!"xul/html".equals(langdef.getName())
                                                                      Severity: Minor
                                                                      Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 35 mins to fix

                                                                      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

                                                                      Avoid too many return statements within this method.
                                                                      Open

                                                                                      return;
                                                                      Severity: Major
                                                                      Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 30 mins to fix

                                                                        Avoid too many return statements within this method.
                                                                        Open

                                                                                        return; //done
                                                                        Severity: Major
                                                                        Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 30 mins to fix

                                                                          Method modifyAttrValueIfSimplified0 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                          Open

                                                                              private static String modifyAttrValueIfSimplified0(String nm, String val, int paramIndex, boolean isNamedParam) {
                                                                                  if (nm == null) {
                                                                                      if (isNamedParam)
                                                                                          throwCommandSimplifiedErrorUsage();
                                                                                      if (paramIndex != -1) //skip command method name
                                                                          Severity: Minor
                                                                          Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 25 mins to fix

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

                                                                              private static void addDeclaredNamespace(NativeInfo nativeInfo, Collection<Namespace> namespaces,
                                                                                      LanguageDefinition langdef) {
                                                                                  for (Namespace ns : namespaces) {
                                                                                      final String uri = ns.getURI();
                                                                                      boolean bNatPrefix = uri.startsWith(LanguageDefinition.NATIVE_NAMESPACE_PREFIX);
                                                                          Severity: Minor
                                                                          Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java - About 25 mins to fix

                                                                          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

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

                                                                                          if (!"xmlns".equals(attnm) && !"xml".equals(attnm) && !attURI.contains("w3.org")
                                                                                                  && (attPref == null || (!"xmlns".equals(attPref) && !"xml".equals(attPref))))
                                                                          Severity: Minor
                                                                          Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java and 1 other location - About 50 mins to fix
                                                                          zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java on lines 1529..1530

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

                                                                          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

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

                                                                                          if (!"xmlns".equals(attnm) && !"xml".equals(attnm) && !attURI.contains("w3.org")
                                                                                                  && (attPref == null || (!"xmlns".equals(attPref) && !"xml".equals(attPref))))
                                                                          Severity: Minor
                                                                          Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java and 1 other location - About 50 mins to fix
                                                                          zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java on lines 1576..1577

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

                                                                          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 PageDefinition parse(File file, String path) throws Exception {
                                                                                  //if (log.isDebugEnabled()) log.debug("Parsing "+file);
                                                                                  String extension = Servlets.getExtension(file.getName());
                                                                                  final PageDefinition pgdef = parse(TreeBuilderFactory.makeBuilder(extension).parse(file), extension);
                                                                                  pgdef.setRequestPath(path);
                                                                          Severity: Minor
                                                                          Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java and 1 other location - About 40 mins to fix
                                                                          zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java on lines 131..137

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

                                                                          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 PageDefinition parse(URL url, String path) throws Exception {
                                                                                  //if (log.isDebugEnabled()) log.debug("Parsing "+url);
                                                                                  String extension = Servlets.getExtension(url.toExternalForm());
                                                                                  final PageDefinition pgdef = parse(TreeBuilderFactory.makeBuilder(extension).parse(url), extension);
                                                                                  pgdef.setRequestPath(path);
                                                                          Severity: Minor
                                                                          Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java and 1 other location - About 40 mins to fix
                                                                          zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java on lines 117..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 51.

                                                                          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 void applyAttrAnnot(AnnotationHelper attrAnnHelper, ShadowInfo compInfo, String nm, String val,
                                                                                      boolean selfAllowed, org.zkoss.util.resource.Location loc) {
                                                                                  attrAnnHelper.addByCompoundValue(val.trim(), loc);
                                                                                  attrAnnHelper.applyAnnotations(compInfo, selfAllowed && "self".equals(nm) ? null : nm, true);
                                                                              }
                                                                          Severity: Minor
                                                                          Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java and 1 other location - About 35 mins to fix
                                                                          zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java on lines 1231..1235

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

                                                                          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 void applyAttrAnnot(AnnotationHelper attrAnnHelper, ComponentInfo compInfo, String nm, String val,
                                                                                      boolean selfAllowed, org.zkoss.util.resource.Location loc) {
                                                                                  attrAnnHelper.addByCompoundValue(val.trim(), loc);
                                                                                  attrAnnHelper.applyAnnotations(compInfo, selfAllowed && "self".equals(nm) ? null : nm, true);
                                                                              }
                                                                          Severity: Minor
                                                                          Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java and 1 other location - About 35 mins to fix
                                                                          zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java on lines 1238..1242

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

                                                                          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

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

                                                                                                      for (NamespaceParser nsParser : _nsParsers) {
                                                                                                          if (nsParser.isMatched(attURI)) {
                                                                                                              if (nsParser.parse(attr, compInfo, pgdef)) {
                                                                                                                  handled = true;
                                                                                                                  break;
                                                                          Severity: Minor
                                                                          Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java and 1 other location - About 35 mins to fix
                                                                          zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java on lines 1030..1037

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

                                                                          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

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

                                                                                                          for (NamespaceParser nsParser : _nsParsers) {
                                                                                                              if (nsParser.isMatched(attURI)) {
                                                                                                                  if (nsParser.parse(attr, compInfo, pgdef)) {
                                                                                                                      handled = true;
                                                                                                                      break;
                                                                          Severity: Minor
                                                                          Found in zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java and 1 other location - About 35 mins to fix
                                                                          zk/src/main/java/org/zkoss/zk/ui/metainfo/Parser.java on lines 954..961

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

                                                                          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

                                                                          There are no issues that match your filters.

                                                                          Category
                                                                          Status