sparklemotion/nokogiri

View on GitHub

Showing 400 of 533 total issues

Method visit_attribute_condition has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def visit_attribute_condition(node)
        attribute = node.value.first.accept(self)
        return attribute if node.value.length == 1

        value = node.value.last
Severity: Minor
Found in lib/nokogiri/css/xpath_visitor.rb - 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 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 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 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

                  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/UtfHelpper.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 nkf has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                    private static CharSequence
                    nkf(ThreadContext context, Charset encoding, CharSequence str)
                    {
                      final Ruby runtime = context.getRuntime();
                      final ByteList opt;
                  Severity: Minor
                  Found in ext/java/nokogiri/internals/NokogiriHelpers.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 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 write_to has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def write_to(io, *options)
                          options = options.first.is_a?(Hash) ? options.shift : {}
                          encoding = options[:encoding] || options[0] || document.encoding
                          if Nokogiri.jruby?
                            save_options = options[:save_with] || options[1]
                  Severity: Minor
                  Found in lib/nokogiri/xml/node.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)
                            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

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

                        def meta_encoding=(encoding)
                          if (meta = meta_content_type)
                            meta["content"] = format("text/html; charset=%s", encoding)
                            encoding
                          elsif (meta = at_xpath("//meta[@charset]"))
                  Severity: Minor
                  Found in lib/nokogiri/html4/document.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 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
                    Severity
                    Category
                    Status
                    Source
                    Language