sparklemotion/nokogiri

View on GitHub

Showing 537 of 537 total issues

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

  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_ATTR_ALLOCATOR = new ObjectAllocator()
  {
    private XmlAttr xmlAttr = null;
    public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
      if (xmlAttr == null) { xmlAttr = new XmlAttr(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 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_NAMESPACE_ALLOCATOR = new ObjectAllocator()
  {
    private XmlNamespace xmlNamespace = null;
    public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
      if (xmlNamespace == null) { xmlNamespace = new XmlNamespace(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 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 HTML_DOCUMENT_ALLOCATOR = new ObjectAllocator()
  {
    private Html4Document htmlDocument = null;
    public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
      if (htmlDocument == null) { htmlDocument = new Html4Document(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 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
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_NODE_ALLOCATOR = new ObjectAllocator()
  {
    private XmlNode xmlNode = null;
    public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
      if (xmlNode == null) { xmlNode = new XmlNode(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 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_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_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_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_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_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

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

Method handleParent has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  protected void
  handleParent(Element e, NameSpaceSymbTable ns)
  {
    if (!e.hasAttributes() && e.getNamespaceURI() == null) {
      return;
Severity: Minor
Found in ext/java/nokogiri/internals/c14n/CanonicalizerBase.java - About 1 hr to fix

    Method add_namespace_definition has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      @JRubyMethod(name = {"add_namespace_definition", "add_namespace"})
      public IRubyObject
      add_namespace_definition(ThreadContext context, IRubyObject prefix, IRubyObject href)
      {
        String hrefStr, prefixStr = prefix.isNil() ? null : prefix.convertToString().decodeString();
    Severity: Minor
    Found in ext/java/nokogiri/XmlNode.java - About 1 hr to fix

      Method dispatchNodeData has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        @SuppressWarnings("fallthrough")
        protected static void
        dispatchNodeData(Node node,
                         org.xml.sax.ContentHandler ch,
                         int depth)
      Severity: Minor
      Found in ext/java/nokogiri/internals/dom2dtm/DOM2DTM.java - About 1 hr to fix

        Method addNamespaceDeclIfNeeded has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private static String
          addNamespaceDeclIfNeeded(XmlDocument doc, String tags)
          {
            if (doc.getDocument() == null) { return tags; }
            if (doc.getDocument().getDocumentElement() == null) { return tags; }
        Severity: Minor
        Found in ext/java/nokogiri/XmlDocumentFragment.java - About 1 hr to fix

          Method reencode has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def reencode(body, content_type = nil)
                  if body.encoding == Encoding::ASCII_8BIT
                    encoding = nil
          
                    # look for a Byte Order Mark (BOM)
          Severity: Minor
          Found in lib/nokogiri/html5.rb - About 1 hr to fix

            Method parse has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    def parse(string_or_io, url = nil, encoding = nil, options = XML::ParseOptions::DEFAULT_HTML)
                      options = Nokogiri::XML::ParseOptions.new(options) if Integer === options
                      yield options if block_given?
            
                      url ||= string_or_io.respond_to?(:path) ? string_or_io.path : nil
            Severity: Minor
            Found in lib/nokogiri/html4/document.rb - About 1 hr to fix

              Method method_missing has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def method_missing(method, *args, &block)
                        opts = args.last.is_a?(Hash) ? args.pop : {}
                        case method.to_s
                        when /^(.*)!$/
                          @node["id"] = Regexp.last_match(1)
              Severity: Minor
              Found in lib/nokogiri/xml/builder.rb - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language