zcommon/src/main/java/org/zkoss/idom/input/SAXHandler.java

Summary

Maintainability
F
3 days
Test Coverage

SAXHandler has 51 methods (exceeds 20 allowed). Consider refactoring.
Open

public class SAXHandler extends DefaultHandler
implements LexicalHandler, DeclHandler {
    private static final Logger log = LoggerFactory.getLogger(SAXHandler.class);

    /** The iDOM factory. */
Severity: Major
Found in zcommon/src/main/java/org/zkoss/idom/input/SAXHandler.java - About 7 hrs to fix

    File SAXHandler.java has 463 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* SAXHandler.java
    
    
        Purpose:
        Description:
    Severity: Minor
    Found in zcommon/src/main/java/org/zkoss/idom/input/SAXHandler.java - About 7 hrs to fix

      Method newElement has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          private Element newElement(String nsURI, String tname)
          throws SAXException {
              if (nsURI == null) nsURI = "";
      
              final int j = tname.indexOf(':');
      Severity: Minor
      Found in zcommon/src/main/java/org/zkoss/idom/input/SAXHandler.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 startElement has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public void
          startElement(String nsURI, String lname, String tname, Attributes attrs)
          throws SAXException {
      //        if (log.finerable())
      //            log.finer(message("start element: nsURI=\"" + nsURI + "\", lname=" + lname + ", tname=" + tname
      Severity: Minor
      Found in zcommon/src/main/java/org/zkoss/idom/input/SAXHandler.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 newElement has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private Element newElement(String nsURI, String tname)
          throws SAXException {
              if (nsURI == null) nsURI = "";
      
              final int j = tname.indexOf(':');
      Severity: Minor
      Found in zcommon/src/main/java/org/zkoss/idom/input/SAXHandler.java - About 1 hr to fix

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

            protected InputSource defaultResolveEntity(String publicId, String systemId)
            throws SAXException {
                if (systemId == null)
                    return null;
        
        
        Severity: Minor
        Found in zcommon/src/main/java/org/zkoss/idom/input/SAXHandler.java - About 1 hr to fix

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

              protected InputSource defaultResolveEntity(String publicId, String systemId)
              throws SAXException {
                  if (systemId == null)
                      return null;
          
          
          Severity: Minor
          Found in zcommon/src/main/java/org/zkoss/idom/input/SAXHandler.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 startElement has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public void
              startElement(String nsURI, String lname, String tname, Attributes attrs)
              throws SAXException {
          //        if (log.finerable())
          //            log.finer(message("start element: nsURI=\"" + nsURI + "\", lname=" + lname + ", tname=" + tname
          Severity: Minor
          Found in zcommon/src/main/java/org/zkoss/idom/input/SAXHandler.java - About 1 hr to fix

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

                public void attributeDecl(String eName, String aName, String type,
                String valueDefault, String value) throws SAXException {
            Severity: Minor
            Found in zcommon/src/main/java/org/zkoss/idom/input/SAXHandler.java - About 35 mins to fix

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

                  public void characters(char[] ch, int start, int length)
                  throws SAXException {
                      if (length == 0) return; //ignore zero length
              
                      //Note: Element's add will coalesce consecutive CDATA or Text
              Severity: Minor
              Found in zcommon/src/main/java/org/zkoss/idom/input/SAXHandler.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 comment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public void comment(char[] ch, int start, int length) throws SAXException {
                      if (length == 0 || isIgnoringComments())
                          return; //ignore zero length
              
                      String data = new String(ch, start, length);
              Severity: Minor
              Found in zcommon/src/main/java/org/zkoss/idom/input/SAXHandler.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

              There are no issues that match your filters.

              Category
              Status