sparklemotion/nokogiri

View on GitHub

Showing 537 of 537 total issues

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

  @JRubyMethod
  public IRubyObject
  previous_element(ThreadContext context)
  {
    Node prevNode = node.getPreviousSibling();
Severity: Major
Found in ext/java/nokogiri/XmlNode.java and 1 other location - About 1 hr to fix
ext/java/nokogiri/XmlNode.java on lines 1641..1653

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

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

    if source_dir
      recipe.source_directory = source_dir
    else
      minor_version = Gem::Version.new(recipe.version).segments.take(2).join(".")
      recipe.files = [{
Severity: Major
Found in ext/nokogiri/extconf.rb and 1 other location - About 1 hr to fix
ext/nokogiri/extconf.rb on lines 898..906

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

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

    if source_dir
      recipe.source_directory = source_dir
    else
      minor_version = Gem::Version.new(recipe.version).segments.take(2).join(".")
      recipe.files = [{
Severity: Major
Found in ext/nokogiri/extconf.rb and 1 other location - About 1 hr to fix
ext/nokogiri/extconf.rb on lines 958..966

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

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

Method native_write has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  @JRubyMethod
  public IRubyObject
  native_write(ThreadContext context, IRubyObject chunk,
               IRubyObject isLast)
  {
Severity: Minor
Found in ext/java/nokogiri/XmlSaxPushParser.java - About 1 hr to fix

    Method writeCharToUtf8 has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public static void
      writeCharToUtf8(final char c, final OutputStream out) throws IOException
      {
        if (c < 0x80) {
          out.write(c);
    Severity: Minor
    Found in ext/java/nokogiri/internals/c14n/UtfHelper.java - About 1 hr to fix

      Method transform has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        @JRubyMethod(rest = true, required = 1, optional = 2)
        public IRubyObject
        transform(ThreadContext context, IRubyObject[] args)
        {
          Ruby runtime = context.getRuntime();
      Severity: Minor
      Found in ext/java/nokogiri/XsltStylesheet.java - About 1 hr to fix

        Method builtinCssClass has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private static boolean
          builtinCssClass(List<?> args) throws XPathFunctionException
          {
            if (args.size() != 2) {
              throw new XPathFunctionException("builtin function nokogiri:css-class takes two arguments");
        Severity: Minor
        Found in ext/java/nokogiri/internals/NokogiriXPathFunction.java - About 1 hr to fix

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

              for (int i = 0; i < length; i++) {
                char c = target.charAt(i);
                if (c == 0x0D) {
                  writer.write(XD);
                } else {
          Severity: Major
          Found in ext/java/nokogiri/internals/c14n/CanonicalizerBase.java and 1 other location - About 1 hr to fix
          ext/java/nokogiri/internals/c14n/CanonicalizerBase.java on lines 593..604

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

          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

              for (int i = 0; i < length; i++) {
                char c = data.charAt(i);
                if (c == 0x0D) {
                  writer.write(XD);
                } else {
          Severity: Major
          Found in ext/java/nokogiri/internals/c14n/CanonicalizerBase.java and 1 other location - About 1 hr to fix
          ext/java/nokogiri/internals/c14n/CanonicalizerBase.java on lines 537..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 82.

          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

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

            @JRubyMethod
            public IRubyObject
            native_write(ThreadContext context, IRubyObject chunk, IRubyObject isLast)
            {
              try {
          Severity: Minor
          Found in ext/java/nokogiri/Html4SaxPushParser.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 nkf has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                private static CharSequence
                nkf(ThreadContext context, Charset encoding, CharSequence str)
                {
                  final Ruby runtime = context.getRuntime();
                  final ByteList opt;
              Severity: Minor
              Found in ext/java/nokogiri/internals/NokogiriHelpers.java - About 1 hr to fix

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

                      def visit_attribute_condition(node)
                        attribute = node.value.first.accept(self)
                        return attribute if node.value.length == 1
                
                        value = node.value.last
                Severity: Minor
                Found in lib/nokogiri/css/xpath_visitor.rb - About 1 hr to fix

                  Identical blocks of code found in 20 locations. Consider refactoring.
                  Open

                    public static final ObjectAllocator XML_ELEMENT_ALLOCATOR = new ObjectAllocator()
                    {
                      private XmlElement xmlElement = null;
                      public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
                        if (xmlElement == null) { xmlElement = new XmlElement(runtime, klazz); }
                  Severity: Major
                  Found in ext/java/nokogiri/NokogiriService.java and 19 other locations - About 1 hr to fix
                  ext/java/nokogiri/NokogiriService.java on lines 232..245
                  ext/java/nokogiri/NokogiriService.java on lines 247..260
                  ext/java/nokogiri/NokogiriService.java on lines 278..291
                  ext/java/nokogiri/NokogiriService.java on lines 293..306
                  ext/java/nokogiri/NokogiriService.java on lines 308..321
                  ext/java/nokogiri/NokogiriService.java on lines 323..336
                  ext/java/nokogiri/NokogiriService.java on lines 338..351
                  ext/java/nokogiri/NokogiriService.java on lines 353..366
                  ext/java/nokogiri/NokogiriService.java on lines 383..396
                  ext/java/nokogiri/NokogiriService.java on lines 398..411
                  ext/java/nokogiri/NokogiriService.java on lines 413..426
                  ext/java/nokogiri/NokogiriService.java on lines 428..441
                  ext/java/nokogiri/NokogiriService.java on lines 443..456
                  ext/java/nokogiri/NokogiriService.java on lines 458..471
                  ext/java/nokogiri/NokogiriService.java on lines 510..523
                  ext/java/nokogiri/NokogiriService.java on lines 525..538
                  ext/java/nokogiri/NokogiriService.java on lines 554..567
                  ext/java/nokogiri/NokogiriService.java on lines 576..589
                  ext/java/nokogiri/NokogiriService.java on lines 598..611

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

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

                    public static final ObjectAllocator XML_TEXT_ALLOCATOR = new ObjectAllocator()
                    {
                      private XmlText xmlText = null;
                      public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
                        if (xmlText == null) { xmlText = new XmlText(runtime, klazz); }
                  Severity: Major
                  Found in ext/java/nokogiri/NokogiriService.java and 19 other locations - About 1 hr to fix
                  ext/java/nokogiri/NokogiriService.java on lines 232..245
                  ext/java/nokogiri/NokogiriService.java on lines 247..260
                  ext/java/nokogiri/NokogiriService.java on lines 278..291
                  ext/java/nokogiri/NokogiriService.java on lines 293..306
                  ext/java/nokogiri/NokogiriService.java on lines 308..321
                  ext/java/nokogiri/NokogiriService.java on lines 323..336
                  ext/java/nokogiri/NokogiriService.java on lines 338..351
                  ext/java/nokogiri/NokogiriService.java on lines 353..366
                  ext/java/nokogiri/NokogiriService.java on lines 368..381
                  ext/java/nokogiri/NokogiriService.java on lines 383..396
                  ext/java/nokogiri/NokogiriService.java on lines 398..411
                  ext/java/nokogiri/NokogiriService.java on lines 413..426
                  ext/java/nokogiri/NokogiriService.java on lines 428..441
                  ext/java/nokogiri/NokogiriService.java on lines 443..456
                  ext/java/nokogiri/NokogiriService.java on lines 458..471
                  ext/java/nokogiri/NokogiriService.java on lines 510..523
                  ext/java/nokogiri/NokogiriService.java on lines 525..538
                  ext/java/nokogiri/NokogiriService.java on lines 554..567
                  ext/java/nokogiri/NokogiriService.java on lines 598..611

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

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

                    public static final ObjectAllocator XML_DOCUMENT_ALLOCATOR = new ObjectAllocator()
                    {
                      private XmlDocument xmlDocument = null;
                      public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
                        if (xmlDocument == null) { xmlDocument = new XmlDocument(runtime, klazz); }
                  Severity: Major
                  Found in ext/java/nokogiri/NokogiriService.java and 19 other locations - About 1 hr to fix
                  ext/java/nokogiri/NokogiriService.java on lines 232..245
                  ext/java/nokogiri/NokogiriService.java on lines 247..260
                  ext/java/nokogiri/NokogiriService.java on lines 278..291
                  ext/java/nokogiri/NokogiriService.java on lines 293..306
                  ext/java/nokogiri/NokogiriService.java on lines 308..321
                  ext/java/nokogiri/NokogiriService.java on lines 338..351
                  ext/java/nokogiri/NokogiriService.java on lines 353..366
                  ext/java/nokogiri/NokogiriService.java on lines 368..381
                  ext/java/nokogiri/NokogiriService.java on lines 383..396
                  ext/java/nokogiri/NokogiriService.java on lines 398..411
                  ext/java/nokogiri/NokogiriService.java on lines 413..426
                  ext/java/nokogiri/NokogiriService.java on lines 428..441
                  ext/java/nokogiri/NokogiriService.java on lines 443..456
                  ext/java/nokogiri/NokogiriService.java on lines 458..471
                  ext/java/nokogiri/NokogiriService.java on lines 510..523
                  ext/java/nokogiri/NokogiriService.java on lines 525..538
                  ext/java/nokogiri/NokogiriService.java on lines 554..567
                  ext/java/nokogiri/NokogiriService.java on lines 576..589
                  ext/java/nokogiri/NokogiriService.java on lines 598..611

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

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

                    public static final ObjectAllocator XML_DOCUMENT_FRAGMENT_ALLOCATOR = new ObjectAllocator()
                    {
                      private XmlDocumentFragment xmlDocumentFragment = null;
                      public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
                        if (xmlDocumentFragment == null) { xmlDocumentFragment = new XmlDocumentFragment(runtime, klazz); }
                  Severity: Major
                  Found in ext/java/nokogiri/NokogiriService.java and 19 other locations - About 1 hr to fix
                  ext/java/nokogiri/NokogiriService.java on lines 232..245
                  ext/java/nokogiri/NokogiriService.java on lines 247..260
                  ext/java/nokogiri/NokogiriService.java on lines 278..291
                  ext/java/nokogiri/NokogiriService.java on lines 293..306
                  ext/java/nokogiri/NokogiriService.java on lines 308..321
                  ext/java/nokogiri/NokogiriService.java on lines 323..336
                  ext/java/nokogiri/NokogiriService.java on lines 353..366
                  ext/java/nokogiri/NokogiriService.java on lines 368..381
                  ext/java/nokogiri/NokogiriService.java on lines 383..396
                  ext/java/nokogiri/NokogiriService.java on lines 398..411
                  ext/java/nokogiri/NokogiriService.java on lines 413..426
                  ext/java/nokogiri/NokogiriService.java on lines 428..441
                  ext/java/nokogiri/NokogiriService.java on lines 443..456
                  ext/java/nokogiri/NokogiriService.java on lines 458..471
                  ext/java/nokogiri/NokogiriService.java on lines 510..523
                  ext/java/nokogiri/NokogiriService.java on lines 525..538
                  ext/java/nokogiri/NokogiriService.java on lines 554..567
                  ext/java/nokogiri/NokogiriService.java on lines 576..589
                  ext/java/nokogiri/NokogiriService.java on lines 598..611

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

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

                    public static final ObjectAllocator XML_NODESET_ALLOCATOR = new ObjectAllocator()
                    {
                      private XmlNodeSet xmlNodeSet = null;
                      public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
                        if (xmlNodeSet == null) { xmlNodeSet = new XmlNodeSet(runtime, klazz); }
                  Severity: Major
                  Found in ext/java/nokogiri/NokogiriService.java and 19 other locations - About 1 hr to fix
                  ext/java/nokogiri/NokogiriService.java on lines 232..245
                  ext/java/nokogiri/NokogiriService.java on lines 247..260
                  ext/java/nokogiri/NokogiriService.java on lines 278..291
                  ext/java/nokogiri/NokogiriService.java on lines 293..306
                  ext/java/nokogiri/NokogiriService.java on lines 308..321
                  ext/java/nokogiri/NokogiriService.java on lines 323..336
                  ext/java/nokogiri/NokogiriService.java on lines 338..351
                  ext/java/nokogiri/NokogiriService.java on lines 353..366
                  ext/java/nokogiri/NokogiriService.java on lines 368..381
                  ext/java/nokogiri/NokogiriService.java on lines 383..396
                  ext/java/nokogiri/NokogiriService.java on lines 398..411
                  ext/java/nokogiri/NokogiriService.java on lines 413..426
                  ext/java/nokogiri/NokogiriService.java on lines 428..441
                  ext/java/nokogiri/NokogiriService.java on lines 458..471
                  ext/java/nokogiri/NokogiriService.java on lines 510..523
                  ext/java/nokogiri/NokogiriService.java on lines 525..538
                  ext/java/nokogiri/NokogiriService.java on lines 554..567
                  ext/java/nokogiri/NokogiriService.java on lines 576..589
                  ext/java/nokogiri/NokogiriService.java on lines 598..611

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

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

                    public static ObjectAllocator XML_PROCESSING_INSTRUCTION_ALLOCATOR = new ObjectAllocator()
                    {
                      private XmlProcessingInstruction xmlProcessingInstruction = null;
                      public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
                        if (xmlProcessingInstruction == null) { xmlProcessingInstruction = new XmlProcessingInstruction(runtime, klazz); }
                  Severity: Major
                  Found in ext/java/nokogiri/NokogiriService.java and 19 other locations - About 1 hr to fix
                  ext/java/nokogiri/NokogiriService.java on lines 232..245
                  ext/java/nokogiri/NokogiriService.java on lines 247..260
                  ext/java/nokogiri/NokogiriService.java on lines 278..291
                  ext/java/nokogiri/NokogiriService.java on lines 293..306
                  ext/java/nokogiri/NokogiriService.java on lines 308..321
                  ext/java/nokogiri/NokogiriService.java on lines 323..336
                  ext/java/nokogiri/NokogiriService.java on lines 338..351
                  ext/java/nokogiri/NokogiriService.java on lines 353..366
                  ext/java/nokogiri/NokogiriService.java on lines 368..381
                  ext/java/nokogiri/NokogiriService.java on lines 383..396
                  ext/java/nokogiri/NokogiriService.java on lines 398..411
                  ext/java/nokogiri/NokogiriService.java on lines 413..426
                  ext/java/nokogiri/NokogiriService.java on lines 428..441
                  ext/java/nokogiri/NokogiriService.java on lines 443..456
                  ext/java/nokogiri/NokogiriService.java on lines 510..523
                  ext/java/nokogiri/NokogiriService.java on lines 525..538
                  ext/java/nokogiri/NokogiriService.java on lines 554..567
                  ext/java/nokogiri/NokogiriService.java on lines 576..589
                  ext/java/nokogiri/NokogiriService.java on lines 598..611

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

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

                    public static final ObjectAllocator XML_DTD_ALLOCATOR = new ObjectAllocator()
                    {
                      private XmlDtd xmlDtd = null;
                      public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
                        if (xmlDtd == null) { xmlDtd = new XmlDtd(runtime, klazz); }
                  Severity: Major
                  Found in ext/java/nokogiri/NokogiriService.java and 19 other locations - About 1 hr to fix
                  ext/java/nokogiri/NokogiriService.java on lines 232..245
                  ext/java/nokogiri/NokogiriService.java on lines 247..260
                  ext/java/nokogiri/NokogiriService.java on lines 278..291
                  ext/java/nokogiri/NokogiriService.java on lines 293..306
                  ext/java/nokogiri/NokogiriService.java on lines 308..321
                  ext/java/nokogiri/NokogiriService.java on lines 323..336
                  ext/java/nokogiri/NokogiriService.java on lines 338..351
                  ext/java/nokogiri/NokogiriService.java on lines 368..381
                  ext/java/nokogiri/NokogiriService.java on lines 383..396
                  ext/java/nokogiri/NokogiriService.java on lines 398..411
                  ext/java/nokogiri/NokogiriService.java on lines 413..426
                  ext/java/nokogiri/NokogiriService.java on lines 428..441
                  ext/java/nokogiri/NokogiriService.java on lines 443..456
                  ext/java/nokogiri/NokogiriService.java on lines 458..471
                  ext/java/nokogiri/NokogiriService.java on lines 510..523
                  ext/java/nokogiri/NokogiriService.java on lines 525..538
                  ext/java/nokogiri/NokogiriService.java on lines 554..567
                  ext/java/nokogiri/NokogiriService.java on lines 576..589
                  ext/java/nokogiri/NokogiriService.java on lines 598..611

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

                  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