sparklemotion/nokogiri

View on GitHub

Showing 400 of 533 total issues

Method engineCanonicalizeSubTree has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  protected byte[]
  engineCanonicalizeSubTree(Node rootNode, Node excludeNode, CanonicalFilter filter)
  throws CanonicalizationException
  {
    this.excludeNode = excludeNode;
Severity: Minor
Found in ext/java/nokogiri/internals/c14n/CanonicalizerBase.java - About 1 hr to fix

    Method native_write_to has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      @JRubyMethod(required = 4, visibility = Visibility.PRIVATE)
      public IRubyObject
      native_write_to(ThreadContext context, IRubyObject[] args)
      {
    
    
    Severity: Minor
    Found in ext/java/nokogiri/XmlNode.java - About 1 hr to fix

      Method logicalNextDOMTextNode has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        private Node
        logicalNextDOMTextNode(Node n)
        {
          Node p = n.getNextSibling();
          if (p == null) {
      Severity: Minor
      Found in ext/java/nokogiri/internals/dom2dtm/DOM2DTM.java - About 1 hr to fix

        Method createElementNode has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          createElementNode(Ruby ruby, String uri, String localName, String qName, XMLAttributes attrs, int depth,
                            Stack<String> langStack, Stack<String> xmlBaseStack)
        Severity: Major
        Found in ext/java/nokogiri/internals/ReaderNode.java - About 1 hr to fix

          Method evaluate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            @JRubyMethod
            public IRubyObject
            evaluate(ThreadContext context, IRubyObject rbQuery, IRubyObject handler)
            {
              String query = rbQuery.convertToString().asJavaString();
          Severity: Minor
          Found in ext/java/nokogiri/XmlXpathContext.java - About 55 mins 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 dispatchNodeData has a Cognitive Complexity of 9 (exceeds 5 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 55 mins 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 getLocalName has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            public String
            getLocalName(int nodeHandle)
            {
          //        if(JJK_NEWCODE)
          //        {
          Severity: Minor
          Found in ext/java/nokogiri/internals/dom2dtm/DOM2DTM.java - About 55 mins 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 getOwnerDocument has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            public static Document
            getOwnerDocument(Set<Node> xpathNodeSet)
            {
              NullPointerException npe = null;
              for (Node node : xpathNodeSet) {
          Severity: Minor
          Found in ext/java/nokogiri/internals/c14n/XMLUtils.java - About 55 mins 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 isDescendantOrSelf has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            public static boolean
            isDescendantOrSelf(Node ctx, Node descendantOrSelf)
            {
              if (ctx == descendantOrSelf) {
                return true;
          Severity: Minor
          Found in ext/java/nokogiri/internals/c14n/XMLUtils.java - About 55 mins 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 removeNamespaceRecursively has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            private void
            removeNamespaceRecursively(XmlNode xmlNode)
            {
              Node node = xmlNode.node;
              if (node.getNodeType() == Node.ELEMENT_NODE) {
          Severity: Minor
          Found in ext/java/nokogiri/XmlDocument.java - About 55 mins 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 getAttributesNodes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            public IRubyObject
            getAttributesNodes()
            {
              RubyArray<?> array = RubyArray.newArray(ruby);
              if (attributeList != null && attributeList.length > 0) {
          Severity: Minor
          Found in ext/java/nokogiri/internals/ReaderNode.java - About 55 mins 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 dispatchCharactersEvents has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            public void
            dispatchCharactersEvents(
              int nodeHandle, org.xml.sax.ContentHandler ch,
              boolean normalize)
            throws org.xml.sax.SAXException
          Severity: Minor
          Found in ext/java/nokogiri/internals/dom2dtm/DOM2DTM.java - About 55 mins 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 getCachedNodeOrCreate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            public static IRubyObject
            getCachedNodeOrCreate(Ruby runtime, Node node)
            {
              if (node == null) { return runtime.getNil(); }
              if (node.getNodeType() == Node.ATTRIBUTE_NODE && isNamespace(node.getNodeName())) {
          Severity: Minor
          Found in ext/java/nokogiri/internals/NokogiriHelpers.java - About 55 mins 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 node_type has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            @JRubyMethod(name = {"node_type", "type"})
            public IRubyObject
            node_type(ThreadContext context)
            {
              String type;
          Severity: Minor
          Found in ext/java/nokogiri/XmlNode.java - About 55 mins 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 engineCanonicalizeSubTree has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            protected byte[]
            engineCanonicalizeSubTree(Node rootNode, Node excludeNode, CanonicalFilter filter)
            throws CanonicalizationException
            {
              this.excludeNode = excludeNode;
          Severity: Minor
          Found in ext/java/nokogiri/internals/c14n/CanonicalizerBase.java - About 55 mins 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 serializeAttrTextContent has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            private static CharSequence
            serializeAttrTextContent(String str, boolean htmlDoc)
            {
              if (str == null || str.length() == 0) { return ""; }
          
          
          Severity: Minor
          Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 55 mins 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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                def initialize(document, tags = nil, ctx = nil, options = ParseOptions::DEFAULT_XML) # rubocop:disable Lint/MissingSuper
                  return self unless tags
          
                  options = Nokogiri::XML::ParseOptions.new(options) if Integer === options
                  yield options if block_given?
          Severity: Minor
          Found in lib/nokogiri/xml/document_fragment.rb - About 55 mins 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 extractDecls has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            protected IRubyObject[]
            extractDecls(ThreadContext context, Node node)
            {
              List<IRubyObject> decls = new ArrayList<IRubyObject>();
              while (node != null) {
          Severity: Minor
          Found in ext/java/nokogiri/XmlDtd.java - About 55 mins 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 read has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                def read(len)
                  # no support for a call without len
          
                  unless @firstchunk
                    (@firstchunk = @io.read(len)) || return
          Severity: Minor
          Found in lib/nokogiri/html4/encoding_reader.rb - About 55 mins 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 create_element has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                def create_element(name, *contents_or_attrs, &block)
                  elm = Nokogiri::XML::Element.new(name, self, &block)
                  contents_or_attrs.each do |arg|
                    case arg
                    when Hash
          Severity: Minor
          Found in lib/nokogiri/xml/document.rb - About 55 mins 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