sparklemotion/nokogiri

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

Summary

Maintainability
F
1 wk
Test Coverage

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

/**
 * (The MIT License)
 *
 * Copyright (c) 2008 - 2012:
 *
Severity: Major
Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 1 day to fix

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

    public class SaveContextVisitor {
    
        private final StringBuilder buffer;
        private final Stack<String> indentation;
        private String encoding;
    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);
              }
              if (node instanceof Element) {
      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);
                  return;
              }
      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);
                  if (element == element.getOwnerDocument().getDocumentElement()) {
                      c14nNodeList.add(element.getOwnerDocument());
      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 18 (exceeds 5 allowed). Consider refactoring.
      Open

          public void leave(Element element) {
              if (canonical) {
                  c14nNamespaceStack.poll();
                  c14nAttrStack.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();
              while (iter.hasNext()) {
                  Attr[] parentAttr = iter.next();
      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) {
                  if (attrs == null || attrs.getLength() == 0) return new Attr[0];
                  Attr[] attrsAndNamespaces = new Attr[attrs.getLength()];
      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();
              while (iter.hasNext()) {
                  Attr[] parentNamespaces = iter.next();
      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);
                  return;
              }
      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);
                    if (element == element.getOwnerDocument().getDocumentElement()) {
                        c14nNodeList.add(element.getOwnerDocument());
        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) {
                      if (attrs == null || attrs.getLength() == 0) return new Attr[0];
                      Attr[] attrsAndNamespaces = new Attr[attrs.getLength()];
          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);
                    }
                    if (node instanceof Element) {
            Severity: Minor
            Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 1 hr to fix

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

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

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

                    private static CharSequence serializeAttrTextContent(String str, boolean htmlDoc) {
                        if (str == null || str.length() == 0) return "";
                
                        StringBuilder buffer = new StringBuilder(str.length() + 16);
                
                
                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 getAttrsOfAncestors has a Cognitive Complexity of 7 (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();
                        if (attrs == null || attrs.getLength() == 0) return;
                        for (int i=0; i < attrs.getLength(); i++) {
                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);
                            return true;
                        }
                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 encodeStringToHtmlEntity has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    private CharSequence encodeStringToHtmlEntity(CharSequence text) {
                        if (encoding == null) return text;
                
                        CharsetEncoder encoder = Charset.forName(encoding).newEncoder();
                        StringBuilder sb = new StringBuilder(text.length() + 16);
                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;
                        if (format) return true;
                        if (asBuilder && element.getFirstChild() != null && element.getFirstChild().getNodeType() == Node.ELEMENT_NODE) return true;
                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((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 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 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

                                    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 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;
                              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 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;
                                    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

                                                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;
                                            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 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;
                                                    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 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++) {
                                                                    Attr attr = (Attr)attrs.item(i);
                                                                    if (isNamespace(attr.getNodeName())) {
                                                        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 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) {
                                                                    for (int i=0; i < attributes.size(); i++) {
                                                                        if (attributes.get(i).getNodeName().equals("xml:space")) {
                                                        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 540..548

                                                        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 561..569

                                                        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",
                                                                    "selected"
                                                        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 195..201

                                                        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

                                                        There are no issues that match your filters.

                                                        Category
                                                        Status