sparklemotion/nokogiri

View on GitHub

Showing 400 of 537 total issues

Method builtinCssClass has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  private static boolean
  builtinCssClass(List<?> args) throws XPathFunctionException
  {
    if (args.size() != 2) {
      throw new XPathFunctionException("builtin function nokogiri:css-class takes two arguments");
Severity: Minor
Found in ext/java/nokogiri/internals/NokogiriXPathFunction.java - About 1 hr to fix

    Method native_write has 29 lines of code (exceeds 25 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

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

        public void
        leave(Element element)
        {
          if (canonical) {
            c14nNamespaceStack.poll();
      Severity: Minor
      Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 1 hr to fix

        Method nkf has 29 lines of code (exceeds 25 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

          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 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 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 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 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 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 method_missing has 28 lines of code (exceeds 25 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

                          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 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 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 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 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 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 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 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

                            Severity
                            Category
                            Status
                            Source
                            Language