sparklemotion/nokogiri

View on GitHub

Showing 133 of 533 total issues

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

  public String
  getDocumentTypeDeclarationSystemIdentifier()
  {

    Document doc;
Severity: Major
Found in ext/java/nokogiri/internals/dom2dtm/DOM2DTM.java and 1 other location - About 1 hr to fix
ext/java/nokogiri/internals/dom2dtm/DOM2DTM.java on lines 1263..1284

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

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 String
  getDocumentTypeDeclarationPublicIdentifier()
  {

    Document doc;
Severity: Major
Found in ext/java/nokogiri/internals/dom2dtm/DOM2DTM.java and 1 other location - About 1 hr to fix
ext/java/nokogiri/internals/dom2dtm/DOM2DTM.java on lines 1232..1253

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

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
  next_element(ThreadContext context)
  {
    Node nextNode = node.getNextSibling();
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 1644..1656

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

  @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 1630..1642

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 873..881

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 929..937

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

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 538..549

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 = 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 594..605

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 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_SAXPARSER_CONTEXT_ALLOCATOR = new ObjectAllocator()
  {
    private XmlSaxParserContext xmlSaxParserContext = null;
    public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
      if (xmlSaxParserContext == null) { xmlSaxParserContext = new XmlSaxParserContext(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 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

  private static final ObjectAllocator HTML_SAXPARSER_CONTEXT_ALLOCATOR = new ObjectAllocator()
  {
    private Html4SaxParserContext htmlSaxParserContext = null;
    public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
      if (htmlSaxParserContext == null) { htmlSaxParserContext = new Html4SaxParserContext(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 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 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

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 ObjectAllocator XSLT_STYLESHEET_ALLOCATOR = new ObjectAllocator()
  {
    private XsltStylesheet xsltStylesheet = null;
    public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
      if (xsltStylesheet == null) { xsltStylesheet = new XsltStylesheet(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 576..589

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_COMMENT_ALLOCATOR = new ObjectAllocator()
  {
    private XmlComment xmlComment = null;
    public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
      if (xmlComment == null) { xmlComment = new XmlComment(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 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 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 ObjectAllocator XML_ELEMENT_DECL_ALLOCATOR = new ObjectAllocator()
  {
    private XmlElementDecl xmlElementDecl = null;
    public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
      if (xmlElementDecl == null) { xmlElementDecl = new XmlElementDecl(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 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_SCHEMA_ALLOCATOR = new ObjectAllocator()
  {
    private XmlSchema xmlSchema = null;
    public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
      if (xmlSchema == null) { xmlSchema = new XmlSchema(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 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_CDATA_ALLOCATOR = new ObjectAllocator()
  {
    private XmlCdata xmlCdata = null;
    public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
      if (xmlCdata == null) { xmlCdata = new XmlCdata(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 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 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_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

Severity
Category
Status
Source
Language