sparklemotion/nokogiri

View on GitHub

Showing 537 of 537 total issues

File NameSpaceSymbTable.java has 302 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
Severity: Minor
Found in ext/java/nokogiri/internals/c14n/NameSpaceSymbTable.java - About 3 hrs to fix

    XmlDtd has 27 methods (exceeds 20 allowed). Consider refactoring.
    Open

    @JRubyClass(name = "Nokogiri::XML::DTD", parent = "Nokogiri::XML::Node")
    public class XmlDtd extends XmlNode
    {
      private static final long serialVersionUID = 1L;
    
    
    Severity: Minor
    Found in ext/java/nokogiri/XmlDtd.java - About 3 hrs to fix

      Method enter has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

        public boolean
        enter(Node node)
        {
          if (node instanceof Document) {
            return enter((Document)node);
      Severity: Minor
      Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 3 hrs 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 tryGetCharsetFromHtml5MetaTag has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

        private static String
        tryGetCharsetFromHtml5MetaTag(Document document)
        {
          if (!"html".equalsIgnoreCase(document.getDocumentElement().getNodeName())) { return null; }
          NodeList list = document.getDocumentElement().getChildNodes();
      Severity: Minor
      Found in ext/java/nokogiri/internals/HtmlDomParserContext.java - About 3 hrs 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 canonicalize has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

        @JRubyMethod(optional = 3)
        public IRubyObject
        canonicalize(ThreadContext context, IRubyObject[] args, Block block)
        {
          int mode = 0;
      Severity: Minor
      Found in ext/java/nokogiri/XmlDocument.java - About 3 hrs 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 isEqualNode has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

        public boolean
        isEqualNode(Node arg)
        {
          if (arg == this) {
            return true;

      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

      File XmlElementContent.java has 292 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      package nokogiri;
      
      import static nokogiri.internals.NokogiriHelpers.getLocalPart;
      import static nokogiri.internals.NokogiriHelpers.getNokogiriClass;
      import static nokogiri.internals.NokogiriHelpers.getPrefix;
      Severity: Minor
      Found in ext/java/nokogiri/XmlElementContent.java - About 3 hrs to fix

        File XsltStylesheet.java has 291 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        package nokogiri;
        
        import static nokogiri.internals.NokogiriHelpers.getNokogiriClass;
        import static nokogiri.internals.NokogiriHelpers.stringOrBlank;
        
        
        Severity: Minor
        Found in ext/java/nokogiri/XsltStylesheet.java - About 3 hrs to fix

          Method handleAttributes has 73 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            @Override
            protected final Iterator<Attr>
            handleAttributes(Element element, NameSpaceSymbTable ns)
            throws CanonicalizationException
            {
          Severity: Major
          Found in ext/java/nokogiri/internals/c14n/Canonicalizer20010315Excl.java - About 2 hrs to fix

            Method leave has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

              public void
              leave(Node node)
              {
                if (node instanceof Document) {
                  leave((Document)node);
            Severity: Minor
            Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 2 hrs 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 getXmlnsAttr has 72 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                void
                getXmlnsAttr(Collection<Attr> col) throws CanonicalizationException
                {
                  int size = levels.size() - 1;
                  if (cur == null) {
            Severity: Major
            Found in ext/java/nokogiri/internals/c14n/Canonicalizer11.java - About 2 hrs to fix

              File xpath_visitor.rb has 284 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module Nokogiri
                module CSS
                  # When translating CSS selectors to XPath queries with Nokogiri::CSS.xpath_for, the XPathVisitor
                  # class allows for changing some of the behaviors related to builtin xpath functions and quirks
                  # of HTML5.
              Severity: Minor
              Found in lib/nokogiri/css/xpath_visitor.rb - About 2 hrs to fix

                Method to_hash has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def to_hash
                      header_directory = File.expand_path(File.join(File.dirname(__FILE__), "../../../ext/nokogiri"))
                
                      {}.tap do |vi|
                        vi["warnings"] = []
                Severity: Major
                Found in lib/nokogiri/version/info.rb - About 2 hrs to fix

                  Method addNamespaceDeclIfNeeded has a Cognitive Complexity of 20 (exceeds 5 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 2 hrs 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 enter has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                    public boolean
                    enter(Element element)
                    {
                      if (canonical) {
                        c14nNodeList.add(element);
                  Severity: Minor
                  Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 2 hrs 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 handleAttributesSubtree has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                    @Override
                    protected Iterator<Attr>
                    handleAttributesSubtree(Element element, NameSpaceSymbTable ns)
                    throws CanonicalizationException
                    {
                  Severity: Minor
                  Found in ext/java/nokogiri/internals/c14n/Canonicalizer11.java - About 2 hrs 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 handleAttributesSubtree has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                    @Override
                    protected Iterator<Attr>
                    handleAttributesSubtree(Element element, NameSpaceSymbTable ns)
                    throws CanonicalizationException
                    {
                  Severity: Minor
                  Found in ext/java/nokogiri/internals/c14n/Canonicalizer20010315.java - About 2 hrs 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 leave has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                    public void
                    leave(Element element)
                    {
                      if (canonical) {
                        c14nNamespaceStack.poll();
                  Severity: Minor
                  Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 2 hrs 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 builtinCssClass has a Cognitive Complexity of 20 (exceeds 5 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 2 hrs 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 pretty_print has a Cognitive Complexity of 20 (exceeds 5 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 2 hrs 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