sparklemotion/nokogiri

View on GitHub

Showing 133 of 533 total issues

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

  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 XML_ENTITY_REFERENCE_ALLOCATOR = new ObjectAllocator()
  {
    private XmlEntityReference xmlEntityRef = null;
    public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
      if (xmlEntityRef == null) { xmlEntityRef = new XmlEntityReference(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 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_RELAXNG_ALLOCATOR = new ObjectAllocator()
  {
    private XmlRelaxng xmlRelaxng = null;
    public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
      if (xmlRelaxng == null) { xmlRelaxng = new XmlRelaxng(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 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

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

  @JRubyMethod(meta = true, required = 4)
  public static IRubyObject
  read_memory(ThreadContext context, IRubyObject klass, IRubyObject[] args)
  {
    XmlDomParserContext ctx = new XmlDomParserContext(context.runtime, args[2], args[3]);
Severity: Major
Found in ext/java/nokogiri/XmlDocument.java and 3 other locations - About 1 hr to fix
ext/java/nokogiri/Html4Document.java on lines 140..147
ext/java/nokogiri/Html4Document.java on lines 149..156
ext/java/nokogiri/XmlDocument.java on lines 351..358

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

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

  @JRubyMethod(meta = true, required = 4)
  public static IRubyObject
  read_io(ThreadContext context, IRubyObject klass, IRubyObject[] args)
  {
    XmlDomParserContext ctx = new XmlDomParserContext(context.runtime, args[2], args[3]);
Severity: Major
Found in ext/java/nokogiri/XmlDocument.java and 3 other locations - About 1 hr to fix
ext/java/nokogiri/Html4Document.java on lines 140..147
ext/java/nokogiri/Html4Document.java on lines 149..156
ext/java/nokogiri/XmlDocument.java on lines 360..367

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

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

  @JRubyMethod(meta = true, required = 4)
  public static IRubyObject
  read_memory(ThreadContext context, IRubyObject klass, IRubyObject[] args)
  {
    HtmlDomParserContext ctx = new HtmlDomParserContext(context.runtime, args[2], args[3]);
Severity: Major
Found in ext/java/nokogiri/Html4Document.java and 3 other locations - About 1 hr to fix
ext/java/nokogiri/Html4Document.java on lines 140..147
ext/java/nokogiri/XmlDocument.java on lines 351..358
ext/java/nokogiri/XmlDocument.java on lines 360..367

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

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

  @JRubyMethod(meta = true, required = 4)
  public static IRubyObject
  read_io(ThreadContext context, IRubyObject klass, IRubyObject[] args)
  {
    HtmlDomParserContext ctx = new HtmlDomParserContext(context.runtime, args[2], args[3]);
Severity: Major
Found in ext/java/nokogiri/Html4Document.java and 3 other locations - About 1 hr to fix
ext/java/nokogiri/Html4Document.java on lines 149..156
ext/java/nokogiri/XmlDocument.java on lines 351..358
ext/java/nokogiri/XmlDocument.java on lines 360..367

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

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

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

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

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

Refactorings

Further Reading

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

      if (size == -1) {
        parentRendered = true;
      } else {
        XmlsStackElement e = levels.get(size);
        if (e.rendered && e.level + 1 == currentLevel) {
Severity: Minor
Found in ext/java/nokogiri/internals/c14n/Canonicalizer20010315.java and 1 other location - About 55 mins to fix
ext/java/nokogiri/internals/c14n/Canonicalizer11.java on lines 111..118

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

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

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

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

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

Refactorings

Further Reading

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

      if (size == -1) {
        parentRendered = true;
      } else {
        XmlsStackElement e = levels.get(size);
        if (e.rendered && e.level + 1 == currentLevel) {
Severity: Minor
Found in ext/java/nokogiri/internals/c14n/Canonicalizer11.java and 1 other location - About 55 mins to fix
ext/java/nokogiri/internals/c14n/Canonicalizer20010315.java on lines 107..114

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

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
  internal_subset(ThreadContext context)
  {
    Document document = getOwnerDocument();
Severity: Minor
Found in ext/java/nokogiri/XmlNode.java and 1 other location - About 50 mins to fix
ext/java/nokogiri/XmlNode.java on lines 1069..1083

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

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
  external_subset(ThreadContext context)
  {
    Document document = getOwnerDocument();
Severity: Minor
Found in ext/java/nokogiri/XmlNode.java and 1 other location - About 50 mins to fix
ext/java/nokogiri/XmlNode.java on lines 1029..1043

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

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

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

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

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

Refactorings

Further Reading

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

    if (shouldMergeN && n != null && n.getNodeType() == Node.TEXT_NODE) {
      xa.setContent(a.getNodeValue() + n.getNodeValue());
      parent.removeChild(n);
      xn.assimilateXmlNode(context, xa);
    }
Severity: Minor
Found in ext/java/nokogiri/XmlNode.java and 1 other location - About 50 mins to fix
ext/java/nokogiri/XmlNode.java on lines 169..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 60.

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

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

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

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

Refactorings

Further Reading

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

    if (shouldMergeP && p != null && p.getNodeType() == Node.TEXT_NODE) {
      xp.setContent(p.getNodeValue() + a.getNodeValue());
      parent.removeChild(a);
      xa.assimilateXmlNode(context, xp);
    }
Severity: Minor
Found in ext/java/nokogiri/XmlNode.java and 1 other location - About 50 mins to fix
ext/java/nokogiri/XmlNode.java on lines 164..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 60.

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

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

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

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

Refactorings

Further Reading

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

          if (isVisible(attribute) && isOutputElement) {
            // The Element is output element, add the prefix (if used)
            // to visibyUtilized
            String prefix = attribute.getPrefix();
            if (prefix != null && !(prefix.equals(XML) || prefix.equals(XMLNS))) {
Severity: Minor
Found in ext/java/nokogiri/internals/c14n/Canonicalizer20010315Excl.java and 1 other location - About 50 mins to fix
ext/java/nokogiri/internals/c14n/Canonicalizer20010315Excl.java on lines 146..156

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 58.

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

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

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

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

Refactorings

Further Reading

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

        if (parentAttr[n].getNodeName().equals(attr.getNodeName())) {
          if (parentAttr[n].getNodeValue().equals(attr.getNodeValue())) {
            // exactly the same attribute should not be added
            newAttribute = false;
          } else {
Severity: Minor
Found in ext/java/nokogiri/internals/SaveContextVisitor.java and 1 other location - About 50 mins to fix
ext/java/nokogiri/internals/SaveContextVisitor.java on lines 589..597

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 58.

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

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

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

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

Refactorings

Further Reading

Severity
Category
Status
Source
Language