sparklemotion/nokogiri

View on GitHub

Showing 533 of 533 total issues

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

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

Duplicated Code

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

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

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

Tuning

This issue has a mass of 79.

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

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

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

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

Refactorings

Further Reading

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

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

Duplicated Code

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

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

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

Tuning

This issue has a mass of 79.

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

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

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

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

Refactorings

Further Reading

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

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

Duplicated Code

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

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

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

Tuning

This issue has a mass of 79.

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

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

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

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

Refactorings

Further Reading

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

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

Duplicated Code

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

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

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

Tuning

This issue has a mass of 79.

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

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

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

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

Refactorings

Further Reading

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

  public static ObjectAllocator 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

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 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 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 iconv_configure_flags has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def iconv_configure_flags
            # give --with-iconv-dir and --with-opt-dir first priority
            ["iconv", "opt"].each do |target|
              config = preserving_globals { dir_config(target) }
              next unless config.any? && try_link_iconv("--with-#{target}-* flags") { dir_config(target) }
          Severity: Minor
          Found in ext/nokogiri/extconf.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 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 applyGroup has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  protected void
                  applyGroup(Ruby runtime, RubyClass klass,
                             XmlDocument doc, NodeIter iter)
                  {
                    // LEFT branch
                Severity: Minor
                Found in ext/java/nokogiri/XmlElementContent.java - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method native_write has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

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

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method writeCharToUtf8 has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

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

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method outputCommentToWriter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                  protected void
                  outputCommentToWriter(
                    Comment currentComment, OutputStream writer, int position
                  ) throws IOException
                  {
                Severity: Minor
                Found in ext/java/nokogiri/internals/c14n/CanonicalizerBase.java - About 1 hr to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Severity
                Category
                Status
                Source
                Language