sparklemotion/nokogiri

View on GitHub

Showing 400 of 537 total issues

Method nextNode has 112 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  protected boolean
  nextNode()
  {
    // Non-recursive one-fetch-at-a-time depth-first traversal with
    // attribute/namespace nodes and white-space stripping.
Severity: Major
Found in ext/java/nokogiri/internals/dom2dtm/DOM2DTM.java - About 4 hrs to fix

    Method lookupNamespaceURI has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

      public String
      lookupNamespaceURI(String specifiedPrefix)
      {
        short type = this.getNodeType();
        switch (type) {

    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 getDTMHandleFromNode has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

      @Override
      public /* synchronized */ int
      getDTMHandleFromNode(org.w3c.dom.Node node)
      {
        //if (node == null) // "node must be non-null for getDTMHandleFromNode!");
    Severity: Minor
    Found in ext/java/nokogiri/internals/XalanDTMManagerPatch.java - About 4 hrs 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 removeDotSegments has 101 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private static String
      removeDotSegments(String path)
      {
    
        // 1. The input buffer is initialized with the now-appended path
    Severity: Major
    Found in ext/java/nokogiri/internals/c14n/Canonicalizer11.java - About 4 hrs to fix

      Method visit_function has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

            def visit_function(node)
              msg = :"visit_function_#{node.value.first.gsub(/[(]/, "")}"
              return send(msg, node) if respond_to?(msg)
      
              case node.value.first
      Severity: Minor
      Found in lib/nokogiri/css/xpath_visitor.rb - About 3 hrs 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

      File XMLUtils.java has 327 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /**
       * Licensed to the Apache Software Foundation (ASF) under one
       * or more contributor license agreements. See the NOTICE file
       * distributed with this work for additional information
       * regarding copyright ownership. The ASF licenses this file
      Severity: Minor
      Found in ext/java/nokogiri/internals/c14n/XMLUtils.java - About 3 hrs to fix

        NokogiriHandler has 31 methods (exceeds 20 allowed). Consider refactoring.
        Open

        public class NokogiriHandler extends DefaultHandler2 implements XmlDeclHandler
        {
        
          StringBuilder charactersBuilder;
          private final Ruby runtime;
        Severity: Minor
        Found in ext/java/nokogiri/internals/NokogiriHandler.java - About 3 hrs to fix

          Class NodeSet has 31 methods (exceeds 20 allowed). Consider refactoring.
          Open

              class NodeSet
                include Nokogiri::XML::Searchable
                include Enumerable
          
                # The Document this NodeSet is associated with
          Severity: Minor
          Found in lib/nokogiri/xml/node_set.rb - About 3 hrs to fix

            Method process_recipe has 92 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def process_recipe(name, version, static_p, cross_p, cacheable_p = true)
              require "rubygems"
              gem("mini_portile2", REQUIRED_MINI_PORTILE_VERSION) # gemspec is not respected at install time
              require "mini_portile2"
              message("Using mini_portile version #{MiniPortile::VERSION}\n")
            Severity: Major
            Found in ext/nokogiri/extconf.rb - About 3 hrs to fix

              XmlNodeSet has 30 methods (exceeds 20 allowed). Consider refactoring.
              Open

              @JRubyClass(name = "Nokogiri::XML::NodeSet")
              public class XmlNodeSet extends RubyObject implements NodeList
              {
                private static final long serialVersionUID = 1L;
              
              
              Severity: Minor
              Found in ext/java/nokogiri/XmlNodeSet.java - About 3 hrs to fix

                Method canonicalizeSubTree has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  protected final void
                  canonicalizeSubTree(
                    Node currentNode, NameSpaceSymbTable ns, Node endnode, int documentLevel, CanonicalFilter filter
                  ) throws CanonicalizationException, IOException
                  {
                Severity: Major
                Found in ext/java/nokogiri/internals/c14n/CanonicalizerBase.java - About 3 hrs to fix

                  File NokogiriHandler.java has 318 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  package nokogiri.internals;
                  
                  import static nokogiri.internals.NokogiriHelpers.getLocalPart;
                  import static nokogiri.internals.NokogiriHelpers.getPrefix;
                  import static nokogiri.internals.NokogiriHelpers.isNamespace;
                  Severity: Minor
                  Found in ext/java/nokogiri/internals/NokogiriHandler.java - About 3 hrs to fix

                    Method addNode has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                    Open

                      protected int
                      addNode(Node node, int parentIndex,
                              int previousSibling, int forceNodeType)
                      {
                        int nodeIndex = m_nodes.size();
                    Severity: Minor
                    Found in ext/java/nokogiri/internals/dom2dtm/DOM2DTM.java - About 3 hrs 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

                    ReaderNode has 29 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    public abstract class ReaderNode
                    {
                    
                      final Ruby ruby;
                      public ReaderAttributeList attributeList;
                    Severity: Minor
                    Found in ext/java/nokogiri/internals/ReaderNode.java - About 3 hrs to fix

                      Method handleAttributesSubtree has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                      Open

                        @Override
                        protected Iterator<Attr>
                        handleAttributesSubtree(Element element, NameSpaceSymbTable ns)
                        throws CanonicalizationException
                        {
                      Severity: Minor
                      Found in ext/java/nokogiri/internals/c14n/Canonicalizer20010315Excl.java - About 3 hrs 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 protectAgainstWrappingAttack has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                      Open

                        public static boolean
                        protectAgainstWrappingAttack(
                          Node startNode, Element knownElement, String value
                        )
                        {
                      Severity: Minor
                      Found in ext/java/nokogiri/internals/c14n/XMLUtils.java - About 3 hrs 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 parse has a Cognitive Complexity of 24 (exceeds 5 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 3 hrs 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 startElement has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                      Open

                        @Override
                        public void
                        startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException
                        {
                          final Ruby runtime = this.runtime;
                      Severity: Minor
                      Found in ext/java/nokogiri/internals/NokogiriHandler.java - About 3 hrs 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

                      File NameSpaceSymbTable.java has 302 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /**
                       * Licensed to the Apache Software Foundation (ASF) under one
                       * or more contributor license agreements. See the NOTICE file
                       * distributed with this work for additional information
                       * regarding copyright ownership. The ASF licenses this file
                      Severity: Minor
                      Found in ext/java/nokogiri/internals/c14n/NameSpaceSymbTable.java - About 3 hrs to fix

                        XmlDtd has 27 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        @JRubyClass(name = "Nokogiri::XML::DTD", parent = "Nokogiri::XML::Node")
                        public class XmlDtd extends XmlNode
                        {
                          private static final long serialVersionUID = 1L;
                        
                        
                        Severity: Minor
                        Found in ext/java/nokogiri/XmlDtd.java - About 3 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language