sparklemotion/nokogiri

View on GitHub
ext/java/nokogiri/internals/ReaderNode.java

Summary

Maintainability
D
2 days
Test Coverage

File ReaderNode.java has 481 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package nokogiri.internals;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Severity: Minor
Found in ext/java/nokogiri/internals/ReaderNode.java - About 7 hrs to fix

    ReaderNode has 29 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public abstract class ReaderNode
    {
    
      final Ruby ruby;
      public ReaderAttributeList attributeList;
    Severity: Minor
    Found in ext/java/nokogiri/internals/ReaderNode.java - About 3 hrs to fix

      Method getXmlBaseUri has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          private String
          getXmlBaseUri(String n, String v, Stack<String> xmlBaseStack)
          {
            if ("xml:base".equals(n)) {
              if (v.startsWith("http://")) {
      Severity: Minor
      Found in ext/java/nokogiri/internals/ReaderNode.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 parseAttributes has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          private void
          parseAttributes(XMLAttributes attrs, Stack<String> langStack, Stack<String> xmlBaseStack)
          {
            if (attrs.getLength() > 0) { attributeList = new ReaderAttributeList(); }
            String u, n, v;
      Severity: Minor
      Found in ext/java/nokogiri/internals/ReaderNode.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 createElementNode has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        createElementNode(Ruby ruby, String uri, String localName, String qName, XMLAttributes attrs, int depth,
                          Stack<String> langStack, Stack<String> xmlBaseStack)
      Severity: Major
      Found in ext/java/nokogiri/internals/ReaderNode.java - About 1 hr to fix

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

          public IRubyObject
          getAttributesNodes()
          {
            RubyArray<?> array = RubyArray.newArray(ruby);
            if (attributeList != null && attributeList.length > 0) {
        Severity: Minor
        Found in ext/java/nokogiri/internals/ReaderNode.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 createClosingNode has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          createClosingNode(Ruby ruby, String uri, String localName, String qName, int depth, Stack<String> langStack,
                            Stack<String> xmlBaseStack)
        Severity: Major
        Found in ext/java/nokogiri/internals/ReaderNode.java - About 50 mins to fix

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

            createTextNode(Ruby ruby, String content, int depth, Stack<String> langStack, Stack<String> xmlBaseStack)
          Severity: Minor
          Found in ext/java/nokogiri/internals/ReaderNode.java - About 35 mins to fix

            Avoid too many return statements within this method.
            Open

                      return v;
            Severity: Major
            Found in ext/java/nokogiri/internals/ReaderNode.java - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                        return base.substring(0, pos).concat(sub);
              Severity: Major
              Found in ext/java/nokogiri/internals/ReaderNode.java - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                      return null;
                Severity: Major
                Found in ext/java/nokogiri/internals/ReaderNode.java - About 30 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status