sparklemotion/nokogiri

View on GitHub

Showing 539 of 539 total issues

Avoid deeply nested control flow statements.
Open

                  mk.sub!(/^PREFIX\s*=\s*$/, "PREFIX = #{host}-") if cross_build_p
Severity: Major
Found in ext/nokogiri/extconf.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                  if darwin?
                    # needed as of zlib 1.2.13
                    Dir.chdir(work_path) do
                      makefile = File.read("Makefile").gsub(/^AR=.*$/, "AR=#{host}-libtool")
                      File.open("Makefile", "w") { |m| m.write(makefile) }
    Severity: Major
    Found in ext/nokogiri/extconf.rb - About 45 mins to fix

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

        @JRubyMethod
        public IRubyObject
        prefix(ThreadContext context)
        {
          if (prefixRuby == null) {
      Severity: Minor
      Found in ext/java/nokogiri/XmlNamespace.java and 1 other location - About 40 mins to fix
      ext/java/nokogiri/XmlNamespace.java on lines 157..166

      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

          } else {
            // Import the node into doc so it has the correct owner document.
            dtd = doc.importNode(dtd, true);
            XmlDtd xmlDtd = (XmlDtd) NokogiriService.XML_DTD_ALLOCATOR.allocate(runtime, getNokogiriClass(runtime,
                            "Nokogiri::XML::DTD"));
      Severity: Minor
      Found in ext/java/nokogiri/XmlDtd.java and 1 other location - About 40 mins to fix
      ext/java/nokogiri/XmlDtd.java on lines 166..173

      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

        private void
        terminateTask(final Ruby runtime)
        {
          if (executor == null) { return; }
      
      
      Severity: Minor
      Found in ext/java/nokogiri/Html4SaxPushParser.java and 1 other location - About 40 mins to fix
      ext/java/nokogiri/XmlSaxPushParser.java on lines 186..198

      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

        private void
        terminateTask(final Ruby runtime)
        {
          if (executor == null) { return; }
      
      
      Severity: Minor
      Found in ext/java/nokogiri/XmlSaxPushParser.java and 1 other location - About 40 mins to fix
      ext/java/nokogiri/Html4SaxPushParser.java on lines 164..176

      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

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

        @JRubyMethod
        public IRubyObject
        href(ThreadContext context)
        {
          if (hrefRuby == null) {
      Severity: Minor
      Found in ext/java/nokogiri/XmlNamespace.java and 1 other location - About 40 mins to fix
      ext/java/nokogiri/XmlNamespace.java on lines 168..177

      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

      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 173..180

      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

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

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

      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

          } else {
            // Import the node into doc so it has the correct owner document.
            dtd = doc.importNode(dtd, true);
            XmlDtd xmlDtd = (XmlDtd) NokogiriService.XML_DTD_ALLOCATOR.allocate(runtime, getNokogiriClass(runtime,
                            "Nokogiri::XML::DTD"));
      Severity: Minor
      Found in ext/java/nokogiri/XmlDtd.java and 1 other location - About 40 mins to fix
      ext/java/nokogiri/XmlDtd.java on lines 190..197

      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

      Consider simplifying this complex logical expression.
      Open

              if Nokogiri.jruby?
                save_options = options[:save_with] || options[1]
                indent_times = options[:indent] || 0
              else
                save_options = options[:save_with] || options[1] || SaveOptions::FORMAT
      Severity: Major
      Found in lib/nokogiri/xml/node.rb - About 40 mins to fix

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

          public enum Type {
            PCDATA(1),
            ELEMENT(2),
            SEQ(3),
            OR(4);
        Severity: Minor
        Found in ext/java/nokogiri/XmlElementContent.java and 1 other location - About 40 mins to fix
        ext/java/nokogiri/XmlElementContent.java on lines 58..73

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

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

          public enum Occur {
            ONCE(1),
            OPT(2),
            MULT(3),
            PLUS(4);
        Severity: Minor
        Found in ext/java/nokogiri/XmlElementContent.java and 1 other location - About 40 mins to fix
        ext/java/nokogiri/XmlElementContent.java on lines 41..56

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

        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

            for (int i = 0; i < nodes.length; i++) {
              if (nodes[i] instanceof XmlNode) {
                ((XmlNode) nodes[i]).unlink(context);
              }
            }
        Severity: Minor
        Found in ext/java/nokogiri/XmlNodeSet.java and 1 other location - About 40 mins to fix
        ext/java/nokogiri/XmlNode.java on lines 502..506

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

        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 6 locations. Consider refactoring.
        Open

            if (encoding != context.runtime.getNil()) {
              if (!(encoding instanceof RubyEncoding)) {
                throw context.runtime.newTypeError("encoding must be kind_of Encoding");
              }
              java_encoding = ((RubyEncoding)encoding).toString();
        Severity: Major
        Found in ext/java/nokogiri/XmlSaxParserContext.java and 5 other locations - About 40 mins to fix
        ext/java/nokogiri/Html4SaxParserContext.java on lines 77..82
        ext/java/nokogiri/Html4SaxParserContext.java on lines 99..104
        ext/java/nokogiri/Html4SaxParserContext.java on lines 125..130
        ext/java/nokogiri/XmlSaxParserContext.java on lines 103..108
        ext/java/nokogiri/XmlSaxParserContext.java on lines 130..135

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

        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 6 locations. Consider refactoring.
        Open

            if (encoding != context.runtime.getNil()) {
              if (!(encoding instanceof RubyEncoding)) {
                throw context.runtime.newTypeError("encoding must be kind_of Encoding");
              }
              java_encoding = ((RubyEncoding)encoding).toString();
        Severity: Major
        Found in ext/java/nokogiri/Html4SaxParserContext.java and 5 other locations - About 40 mins to fix
        ext/java/nokogiri/Html4SaxParserContext.java on lines 99..104
        ext/java/nokogiri/Html4SaxParserContext.java on lines 125..130
        ext/java/nokogiri/XmlSaxParserContext.java on lines 103..108
        ext/java/nokogiri/XmlSaxParserContext.java on lines 130..135
        ext/java/nokogiri/XmlSaxParserContext.java on lines 163..168

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

        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

            for (int i = 0; i < nodes.length; i++) {
              if (nodes[i] instanceof XmlNode) {
                ((XmlNode) nodes[i]).relink_namespace(context);
              }
            }
        Severity: Minor
        Found in ext/java/nokogiri/XmlNode.java and 1 other location - About 40 mins to fix
        ext/java/nokogiri/XmlNodeSet.java on lines 432..436

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

        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 6 locations. Consider refactoring.
        Open

            if (encoding != context.runtime.getNil()) {
              if (!(encoding instanceof RubyEncoding)) {
                throw context.runtime.newTypeError("encoding must be kind_of Encoding");
              }
              java_encoding = ((RubyEncoding)encoding).toString();
        Severity: Major
        Found in ext/java/nokogiri/Html4SaxParserContext.java and 5 other locations - About 40 mins to fix
        ext/java/nokogiri/Html4SaxParserContext.java on lines 77..82
        ext/java/nokogiri/Html4SaxParserContext.java on lines 125..130
        ext/java/nokogiri/XmlSaxParserContext.java on lines 103..108
        ext/java/nokogiri/XmlSaxParserContext.java on lines 130..135
        ext/java/nokogiri/XmlSaxParserContext.java on lines 163..168

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

        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 6 locations. Consider refactoring.
        Open

            if (encoding != context.runtime.getNil()) {
              if (!(encoding instanceof RubyEncoding)) {
                throw context.runtime.newTypeError("encoding must be kind_of Encoding");
              }
              java_encoding = ((RubyEncoding)encoding).toString();
        Severity: Major
        Found in ext/java/nokogiri/Html4SaxParserContext.java and 5 other locations - About 40 mins to fix
        ext/java/nokogiri/Html4SaxParserContext.java on lines 77..82
        ext/java/nokogiri/Html4SaxParserContext.java on lines 99..104
        ext/java/nokogiri/XmlSaxParserContext.java on lines 103..108
        ext/java/nokogiri/XmlSaxParserContext.java on lines 130..135
        ext/java/nokogiri/XmlSaxParserContext.java on lines 163..168

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

        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 6 locations. Consider refactoring.
        Open

            if (encoding != context.runtime.getNil()) {
              if (!(encoding instanceof RubyEncoding)) {
                throw context.runtime.newTypeError("encoding must be kind_of Encoding");
              }
              java_encoding = ((RubyEncoding)encoding).toString();
        Severity: Major
        Found in ext/java/nokogiri/XmlSaxParserContext.java and 5 other locations - About 40 mins to fix
        ext/java/nokogiri/Html4SaxParserContext.java on lines 77..82
        ext/java/nokogiri/Html4SaxParserContext.java on lines 99..104
        ext/java/nokogiri/Html4SaxParserContext.java on lines 125..130
        ext/java/nokogiri/XmlSaxParserContext.java on lines 103..108
        ext/java/nokogiri/XmlSaxParserContext.java on lines 163..168

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

        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

        Severity
        Category
        Status
        Source
        Language