sparklemotion/nokogiri

View on GitHub

Showing 400 of 537 total issues

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

      def index(node = nil)
        if node
          warn("given block not used") if block_given?
          each_with_index { |member, j| return j if member == node }
        elsif block_given?
Severity: Minor
Found in lib/nokogiri/xml/node_set.rb - 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 related_class has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def related_class(class_name)
      klass = nil
      inspecting = self.class

      while inspecting
Severity: Minor
Found in lib/nokogiri/class_resolver.rb - 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 method_missing has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def method_missing(method, *args, &block) # :nodoc:
        if @context&.respond_to?(method)
          @context.send(method, *args, &block)
        else
          node = @doc.create_element(method.to_s.sub(/[_!]$/, ""), *args) do |n|
Severity: Minor
Found in lib/nokogiri/xml/builder.rb - 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 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 outputTextToWriter has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      protected static final void
      outputTextToWriter(
        final String text, final OutputStream writer
      ) throws IOException
      {
    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 parse_with has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              @JRubyMethod
              public IRubyObject
              parse_with(ThreadContext context, IRubyObject handlerRuby)
              {
                final Ruby runtime = context.getRuntime();
            Severity: Minor
            Found in ext/java/nokogiri/XmlSaxParserContext.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 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 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 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 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 setAttribute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              private void
              setAttribute(ThreadContext context, String key, String val)
              {
                Element element = (Element) node;
            
            
            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 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 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 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 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 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

            Severity
            Category
            Status
            Source
            Language