sparklemotion/nokogiri

View on GitHub

Showing 513 of 513 total issues

Method process_recipe has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

def process_recipe(name, version, static_p, cross_p)
  MiniPortile.new(name, version).tap do |recipe|
    recipe.target = File.join(ROOT, "ports")
    # Prefer host_alias over host in order to use i586-mingw32msvc as
    # correct compiler prefix for cross build, but use host if not set.
Severity: Minor
Found in ext/nokogiri/extconf.rb - About 4 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 removeDotSegments has 101 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private static String removeDotSegments(String path) {

        // 1. The input buffer is initialized with the now-appended path
        // components then replace occurrences of "//" in the input buffer
        // with "/" until no more occurrences of "//" are in the input buffer.
Severity: Major
Found in ext/java/nokogiri/internals/c14n/Canonicalizer11.java - About 4 hrs to fix

    Class NodeSet has 31 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class NodeSet
          include Nokogiri::XML::Searchable
          include Enumerable
    
          # The Document this NodeSet is associated with
    Severity: Minor
    Found in lib/nokogiri/xml/node_set.rb - About 3 hrs to fix

      XmlNodeSet has 30 methods (exceeds 20 allowed). Consider refactoring.
      Open

      @JRubyClass(name="Nokogiri::XML::NodeSet")
      public class XmlNodeSet extends RubyObject implements NodeList {
      
          private IRubyObject[] nodes;
      
      
      Severity: Minor
      Found in ext/java/nokogiri/XmlNodeSet.java - About 3 hrs to fix

        Method canonicalizeSubTree has 91 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected final void canonicalizeSubTree(
                Node currentNode, NameSpaceSymbTable ns, Node endnode, int documentLevel, CanonicalFilter filter
            ) throws CanonicalizationException, IOException {
                if (isVisibleInt(currentNode) == -1) {
                    return;
        Severity: Major
        Found in ext/java/nokogiri/internals/c14n/CanonicalizerBase.java - About 3 hrs to fix

          NokogiriHandler has 29 methods (exceeds 20 allowed). Consider refactoring.
          Open

          public class NokogiriHandler extends DefaultHandler2 implements XmlDeclHandler {
          
              StringBuilder charactersBuilder;
              private final Ruby runtime;
              private final RubyClass attrClass;
          Severity: Minor
          Found in ext/java/nokogiri/internals/NokogiriHandler.java - About 3 hrs to fix

            ReaderNode has 29 methods (exceeds 20 allowed). Consider refactoring.
            Open

            public abstract class ReaderNode {
            
                final Ruby ruby;
                public ReaderAttributeList attributeList;
                public Map<String, String> namespaces;
            Severity: Minor
            Found in ext/java/nokogiri/internals/ReaderNode.java - About 3 hrs to fix

              Method process_recipe has 86 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              def process_recipe(name, version, static_p, cross_p)
                MiniPortile.new(name, version).tap do |recipe|
                  recipe.target = File.join(ROOT, "ports")
                  # Prefer host_alias over host in order to use i586-mingw32msvc as
                  # correct compiler prefix for cross build, but use host if not set.
              Severity: Major
              Found in ext/nokogiri/extconf.rb - About 3 hrs to fix

                Method protectAgainstWrappingAttack has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static boolean protectAgainstWrappingAttack(
                        Node startNode, Element knownElement, String value
                    ) {
                        Node startParent = startNode.getParentNode();
                        Node processedNode;
                Severity: Minor
                Found in ext/java/nokogiri/internals/c14n/XMLUtils.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 handleAttributesSubtree has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                    @Override
                    protected Iterator<Attr> handleAttributesSubtree(Element element, NameSpaceSymbTable ns)
                        throws CanonicalizationException {
                        // result will contain the attrs which have to be output
                        final SortedSet<Attr> result = this.result;
                Severity: Minor
                Found in ext/java/nokogiri/internals/c14n/Canonicalizer20010315Excl.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 addNode has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected int addNode(Node node, int parentIndex,
                                          int previousSibling, int forceNodeType)
                    {
                        int nodeIndex = m_nodes.size();
                
                
                Severity: Minor
                Found in ext/java/nokogiri/internals/dom2dtm/DOM2DTM.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

                File XmlNodeSet.java has 308 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /**
                 * (The MIT License)
                 *
                 * Copyright (c) 2008 - 2012:
                 *
                Severity: Minor
                Found in ext/java/nokogiri/XmlNodeSet.java - About 3 hrs to fix

                  Method startElement has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                  Open

                      @Override
                      public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
                          final Ruby runtime = this.runtime;
                          final ThreadContext context = runtime.getCurrentContext();
                  
                  
                  Severity: Minor
                  Found in ext/java/nokogiri/internals/NokogiriHandler.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

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

                  @JRubyClass(name="Nokogiri::XML::DTD", parent="Nokogiri::XML::Node")
                  public class XmlDtd extends XmlNode {
                      /** cache of children, Nokogiri::XML::NodeSet */
                      protected IRubyObject children = null;
                  
                  
                  Severity: Minor
                  Found in ext/java/nokogiri/XmlDtd.java - About 3 hrs to fix

                    File XmlDtd.java has 296 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    /**
                     * (The MIT License)
                     *
                     * Copyright (c) 2008 - 2011:
                     *
                    Severity: Minor
                    Found in ext/java/nokogiri/XmlDtd.java - About 3 hrs to fix

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

                          public boolean isEqualNode(Node arg) {
                              if (arg == this) {
                                  return true;
                              }
                              if (arg.getNodeType() != getNodeType()) {

                      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(); Node item;
                              for (int i = 0; i < list.getLength(); i++) {
                                  if ("head".equalsIgnoreCase((item = list.item(i)).getNodeName())) {
                      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 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);
                              }
                              if (node instanceof Element) {
                      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 visit_function has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def visit_function node
                      
                              msg = :"visit_function_#{node.value.first.gsub(/[(]/, '')}"
                              return self.send(msg, node) if self.respond_to?(msg)
                      
                      
                      Severity: Minor
                      Found in lib/nokogiri/css/xpath_visitor.rb - 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

                      File XMLUtils.java has 294 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/XMLUtils.java - About 3 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language