sparklemotion/nokogiri

View on GitHub

Showing 400 of 533 total issues

Method pretty_print has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def pretty_print(pp)
          nice_name = self.class.name.split("::").last
          pp.group(2, "#(#{nice_name}:#{format("0x%x", object_id)} {", "})") do
            pp.breakable

Severity: Minor
Found in lib/nokogiri/xml/pp/node.rb - About 1 hr to fix

    Method serializeAttrTextContent has 32 lines of code (exceeds 25 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 1 hr to fix

      Method handleParent has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        @Override
        protected void
        handleParent(Element e, NameSpaceSymbTable ns)
        {
          if (!e.hasAttributes() && e.getNamespaceURI() == null) {
      Severity: Minor
      Found in ext/java/nokogiri/internals/c14n/Canonicalizer20010315.java - About 1 hr to fix

        Method handleParent has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          @Override
          protected void
          handleParent(Element e, NameSpaceSymbTable ns)
          {
            if (!e.hasAttributes() && e.getNamespaceURI() == null) {
        Severity: Minor
        Found in ext/java/nokogiri/internals/c14n/Canonicalizer11.java - About 1 hr to fix

          Method in_context has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            @JRubyMethod(required = 2, visibility = Visibility.PRIVATE)
            public IRubyObject
            in_context(ThreadContext context, IRubyObject str, IRubyObject options)
            {
              RubyClass klass;
          Severity: Minor
          Found in ext/java/nokogiri/XmlNode.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 key_p has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            @JRubyMethod(name = {"key?", "has_attribute?"})
            public IRubyObject
            key_p(ThreadContext context, IRubyObject rbkey)
            {
              if (node instanceof Element) {
          Severity: Minor
          Found in ext/java/nokogiri/XmlNode.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 getSchema has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            private Schema
            getSchema(Source source, ThreadContext context)
            {
              InputStream is;
              VerifierFactory factory = new com.thaiopensource.relaxng.jarv.VerifierFactoryImpl();
          Severity: Minor
          Found in ext/java/nokogiri/XmlRelaxng.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 getStringValue has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            public XMLString
            getStringValue(int nodeHandle)
            {
          
              int type = getNodeType(nodeHandle);
          Severity: Minor
          Found in ext/java/nokogiri/internals/dom2dtm/DOM2DTM.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 getHandleFromNode has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            public int
            getHandleFromNode(Node node)
            {
              if (null != node) {
                int len = m_nodes.size();
          Severity: Minor
          Found in ext/java/nokogiri/internals/dom2dtm/DOM2DTM.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 setUrl has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            public static void
            setUrl(ThreadContext context, InputSource source, IRubyObject url)
            {
              String path = rubyStringToString(url);
              // Dir.chdir might be called at some point before this.
          Severity: Minor
          Found in ext/java/nokogiri/internals/ParserContext.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 ancestors has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

                def ancestors(selector = nil)
                  return NodeSet.new(document) unless respond_to?(:parent)
                  return NodeSet.new(document) unless parent
          
                  parents = [parent]
          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 extractDecls has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            protected void
            extractDecls(ThreadContext context)
            {
              Ruby runtime = context.runtime;
          
          
          Severity: Minor
          Found in ext/java/nokogiri/XmlDtd.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 extractDecls has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            protected void
            extractDecls(ThreadContext context)
            {
              Ruby runtime = context.runtime;
          
          
          Severity: Minor
          Found in ext/java/nokogiri/XmlDtd.java - About 1 hr to fix

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

              @JRubyMethod
              public IRubyObject
              native_write(ThreadContext context, IRubyObject chunk,
                           IRubyObject isLast)
              {
            Severity: Minor
            Found in ext/java/nokogiri/XmlSaxPushParser.java - About 1 hr to fix

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

                @JRubyMethod(rest = true, required = 1, optional = 2)
                public IRubyObject
                transform(ThreadContext context, IRubyObject[] args)
                {
                  Ruby runtime = context.getRuntime();
              Severity: Minor
              Found in ext/java/nokogiri/XsltStylesheet.java - About 1 hr to fix

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

                  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
                          Severity
                          Category
                          Status
                          Source
                          Language