sparklemotion/nokogiri

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

Summary

Maintainability
F
1 wk
Test Coverage

File SaveContextVisitor.java has 758 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package nokogiri.internals;

import static nokogiri.internals.NokogiriHelpers.canonicalizeWhitespace;
import static nokogiri.internals.NokogiriHelpers.encodeJavaString;
import static nokogiri.internals.NokogiriHelpers.isNamespace;
Severity: Major
Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 1 day to fix

    SaveContextVisitor has 48 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class SaveContextVisitor
    {
    
      private final StringBuilder buffer;
      private final Stack<String> indentation;
    Severity: Minor
    Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 6 hrs to fix

      Method enter has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

        public boolean
        enter(Node node)
        {
          if (node instanceof Document) {
            return enter((Document)node);
      Severity: Minor
      Found in ext/java/nokogiri/internals/SaveContextVisitor.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 leave has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

        public void
        leave(Node node)
        {
          if (node instanceof Document) {
            leave((Document)node);
      Severity: Minor
      Found in ext/java/nokogiri/internals/SaveContextVisitor.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 enter has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

        public boolean
        enter(Element element)
        {
          if (canonical) {
            c14nNodeList.add(element);
      Severity: Minor
      Found in ext/java/nokogiri/internals/SaveContextVisitor.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 leave has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

        public void
        leave(Element element)
        {
          if (canonical) {
            c14nNamespaceStack.poll();
      Severity: Minor
      Found in ext/java/nokogiri/internals/SaveContextVisitor.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 getAttributesWithPropagated has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

        private void
        getAttributesWithPropagated(List<Attr> attributes, Attr attr)
        {
          boolean newAttribute = true;
          Iterator<Attr[]> iter = c14nAttrStack.iterator();
      Severity: Minor
      Found in ext/java/nokogiri/internals/SaveContextVisitor.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 getAttrsAndNamespaces has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

        private Attr[]
        getAttrsAndNamespaces(Element element)
        {
          NamedNodeMap attrs = element.getAttributes();
          if (!canonical) {
      Severity: Minor
      Found in ext/java/nokogiri/internals/SaveContextVisitor.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 getNamespacesWithPropagated has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

        private void
        getNamespacesWithPropagated(List<Attr> namespaces, Attr attr)
        {
          boolean newNamespace = true;
          Iterator<Attr[]> iter = c14nNamespaceStack.iterator();
      Severity: Minor
      Found in ext/java/nokogiri/internals/SaveContextVisitor.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 leave has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        public void
        leave(Node node)
        {
          if (node instanceof Document) {
            leave((Document)node);
      Severity: Minor
      Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 1 hr to fix

        Method enter has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          public boolean
          enter(Element element)
          {
            if (canonical) {
              c14nNodeList.add(element);
        Severity: Minor
        Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 1 hr to fix

          Method getAttrsAndNamespaces has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private Attr[]
            getAttrsAndNamespaces(Element element)
            {
              NamedNodeMap attrs = element.getAttributes();
              if (!canonical) {
          Severity: Minor
          Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 1 hr to fix

            Method enter has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              public boolean
              enter(Node node)
              {
                if (node instanceof Document) {
                  return enter((Document)node);
            Severity: Minor
            Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 1 hr to fix

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

                private static CharSequence
                serializeAttrTextContent(String str, boolean htmlDoc)
                {
                  if (str == null || str.length() == 0) { return ""; }
              
              
              Severity: Minor
              Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 1 hr to fix

                Method leave has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  public void
                  leave(Element element)
                  {
                    if (canonical) {
                      c14nNamespaceStack.poll();
                Severity: Minor
                Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 1 hr to fix

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

                    private static CharSequence
                    serializeAttrTextContent(String str, boolean htmlDoc)
                    {
                      if (str == null || str.length() == 0) { return ""; }
                  
                  
                  Severity: Minor
                  Found in ext/java/nokogiri/internals/SaveContextVisitor.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 getAttrsOfAncestors has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    private void
                    getAttrsOfAncestors(Node parent, List<Attr> namespaces, List<Attr> attributes)
                    {
                      if (parent == null) { return; }
                      NamedNodeMap attrs = parent.getAttributes();
                  Severity: Minor
                  Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 45 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 encodeStringToHtmlEntity has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                    private CharSequence
                    encodeStringToHtmlEntity(CharSequence text)
                    {
                      if (encoding == null) { return text; }
                  
                  
                  Severity: Minor
                  Found in ext/java/nokogiri/internals/SaveContextVisitor.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

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

                    private boolean
                    needBreakInOpening(Element element)
                    {
                      if (containsText(element)) { return false; }
                      if (fragment) { return false; }
                  Severity: Minor
                  Found in ext/java/nokogiri/internals/SaveContextVisitor.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

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

                    public boolean
                    enter(DocumentType docType)
                    {
                      if (canonical) {
                        c14nNodeList.add(docType);
                  Severity: Minor
                  Found in ext/java/nokogiri/internals/SaveContextVisitor.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 enter((Comment)node);
                  Severity: Major
                  Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

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

                      Avoid too many return statements within this method.
                      Open

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

                        Avoid too many return statements within this method.
                        Open

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

                          Avoid too many return statements within this method.
                          Open

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

                            Avoid too many return statements within this method.
                            Open

                                  return enter((ProcessingInstruction)node);
                            Severity: Major
                            Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

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

                                Avoid too many return statements within this method.
                                Open

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

                                  Avoid too many return statements within this method.
                                  Open

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

                                    Avoid too many return statements within this method.
                                    Open

                                          return enter((DocumentType)node);
                                    Severity: Major
                                    Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                            return enter((Entity)node);
                                      Severity: Major
                                      Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

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

                                          Avoid too many return statements within this method.
                                          Open

                                                return enter((Notation)node);
                                          Severity: Major
                                          Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                  return enter((EntityReference) node);
                                            Severity: Major
                                            Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                    return enter((CDATASection)node);
                                              Severity: Major
                                              Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                    if (value.contains(encoding)) { return value; }  // no need to replace
                                                Severity: Major
                                                Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                      if (format && element.getNextSibling() == null && element.hasChildNodes()) { return true; }
                                                  Severity: Major
                                                  Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 30 mins to fix

                                                    Avoid too many return statements within this method.
                                                    Open

                                                        return value.replace(m.group(), "charset=" + encoding);
                                                    Severity: Major
                                                    Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Open

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

                                                        Avoid too many return statements within this method.
                                                        Open

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

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

                                                            private void
                                                            verifyXmlSpace(List<Attr> attributes, NamedNodeMap attrs)
                                                            {
                                                              Attr attr = (Attr) attrs.getNamedItem("xml:space");
                                                              if (attr == null) {
                                                          Severity: Minor
                                                          Found in ext/java/nokogiri/internals/SaveContextVisitor.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 getNamespacesAndAttrs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                          Open

                                                            private void
                                                            getNamespacesAndAttrs(Node current, List<Attr> namespaces, List<Attr> attributes)
                                                            {
                                                              NamedNodeMap attrs = current.getAttributes();
                                                              for (int i = 0; i < attrs.getLength(); i++) {
                                                          Severity: Minor
                                                          Found in ext/java/nokogiri/internals/SaveContextVisitor.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 (parentAttr[n].getNodeName().equals(attr.getNodeName())) {
                                                                    if (parentAttr[n].getNodeValue().equals(attr.getNodeValue())) {
                                                                      // exactly the same attribute should not be added
                                                                      newAttribute = false;
                                                                    } else {
                                                          Severity: Minor
                                                          Found in ext/java/nokogiri/internals/SaveContextVisitor.java and 1 other location - About 50 mins to fix
                                                          ext/java/nokogiri/internals/SaveContextVisitor.java on lines 589..597

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

                                                          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 (parentNamespaces[n].getNodeName().equals(attr.getNodeName())) {
                                                                    if (parentNamespaces[n].getNodeValue().equals(attr.getNodeValue())) {
                                                                      // exactly the same namespace should not be added
                                                                      newNamespace = false;
                                                                    } else {
                                                          Severity: Minor
                                                          Found in ext/java/nokogiri/internals/SaveContextVisitor.java and 1 other location - About 50 mins to fix
                                                          ext/java/nokogiri/internals/SaveContextVisitor.java on lines 612..620

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

                                                          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

                                                            static
                                                            {
                                                              final String[] _HTML_BOOLEAN_ATTRS = {
                                                                "checked", "compact", "declare", "defer", "disabled", "ismap",
                                                                "multiple", "nohref", "noresize", "noshade", "nowrap", "readonly",
                                                          Severity: Minor
                                                          Found in ext/java/nokogiri/internals/SaveContextVisitor.java and 1 other location - About 40 mins to fix
                                                          ext/java/nokogiri/internals/NokogiriHandler.java on lines 174..181

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

                                                          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 ((format && indent == null) || (format && indent.length() == 0)) { indent = "  "; } // default, two spaces
                                                          Severity: Minor
                                                          Found in ext/java/nokogiri/internals/SaveContextVisitor.java and 1 other location - About 30 mins to fix
                                                          ext/java/nokogiri/internals/SaveContextVisitor.java on lines 117..117

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

                                                          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 ((asBuilder && indent == null) || (asBuilder && indent.length() == 0)) { indent = "  "; } // default, two spaces
                                                          Severity: Minor
                                                          Found in ext/java/nokogiri/internals/SaveContextVisitor.java and 1 other location - About 30 mins to fix
                                                          ext/java/nokogiri/internals/SaveContextVisitor.java on lines 115..115

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

                                                          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