sparklemotion/nokogiri

View on GitHub

Showing 388 of 514 total issues

File node.rb has 438 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'stringio'
require 'nokogiri/xml/node/save_options'

module Nokogiri
  module XML
Severity: Minor
Found in lib/nokogiri/xml/node.rb - About 6 hrs to fix

    Method canonicalizeSubTree has a Cognitive Complexity of 41 (exceeds 5 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: Minor
    Found in ext/java/nokogiri/internals/c14n/CanonicalizerBase.java - About 6 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 CanonicalizerBase.java has 423 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/CanonicalizerBase.java - About 6 hrs to fix

      Method circumventBug2650internal has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
      Open

          @SuppressWarnings("fallthrough")
          private static void circumventBug2650internal(Node node) {
              Node parent = null;
              Node sibling = null;
              final String namespaceNs = Constants.NamespaceSpecNS;
      Severity: Minor
      Found in ext/java/nokogiri/internals/c14n/XMLUtils.java - About 6 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

      XmlDocument has 44 methods (exceeds 20 allowed). Consider refactoring.
      Open

      @JRubyClass(name="Nokogiri::XML::Document", parent="Nokogiri::XML::Node")
      public class XmlDocument extends XmlNode {
          private NokogiriNamespaceCache nsCache;
      
          /* UserData keys for storing extra info in the document node. */
      Severity: Minor
      Found in ext/java/nokogiri/XmlDocument.java - About 6 hrs to fix

        NokogiriService has 43 methods (exceeds 20 allowed). Consider refactoring.
        Open

        public class NokogiriService implements BasicLibraryService {
            public boolean basicLoad(Ruby ruby) {
                init(ruby);
                return true;
            }
        Severity: Minor
        Found in ext/java/nokogiri/NokogiriService.java - About 5 hrs to fix

          File XmlReader.java has 407 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

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

            Method joinURI has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
            Open

                private static String joinURI(String baseURI, String relativeURI) throws URISyntaxException {
                    String bscheme = null;
                    String bauthority = null;
                    String bpath = "";
                    String bquery = null;
            Severity: Minor
            Found in ext/java/nokogiri/internals/c14n/Canonicalizer11.java - About 5 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 getNodeCompletePath has 142 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static String getNodeCompletePath(Node node) {
            
                    Node cur, tmp, next;
            
                    // TODO: Rename buffer to path.
            Severity: Major
            Found in ext/java/nokogiri/internals/NokogiriHelpers.java - About 5 hrs to fix

              Method getXmlnsAttr has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
              Open

                      void getXmlnsAttr(Collection<Attr> col) throws CanonicalizationException {
                          int size = levels.size() - 1;
                          if (cur == null) {
                              cur = new XmlsStackElement();
                              cur.level = currentLevel;
              Severity: Minor
              Found in ext/java/nokogiri/internals/c14n/Canonicalizer11.java - About 5 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

              DOM2DTM has 38 methods (exceeds 20 allowed). Consider refactoring.
              Open

              public class DOM2DTM extends DTMDefaultBaseIterators
              {
              //    static final boolean JJK_DEBUG=false;
              //    static final boolean JJK_NEWCODE=true;
              
              
              Severity: Minor
              Found in ext/java/nokogiri/internals/dom2dtm/DOM2DTM.java - About 5 hrs to fix

                File ReaderNode.java has 375 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

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

                  Method nextNode has 124 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected boolean nextNode()
                      {
                          // Non-recursive one-fetch-at-a-time depth-first traversal with
                          // attribute/namespace nodes and white-space stripping.
                          // Navigating the DOM is simple, navigating the DTM is simple;
                  Severity: Major
                  Found in ext/java/nokogiri/internals/dom2dtm/DOM2DTM.java - About 4 hrs to fix

                    XmlReader has 37 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    @JRubyClass(name="Nokogiri::XML::Reader")
                    public class XmlReader extends RubyObject {
                    
                        private static final int XML_TEXTREADER_MODE_INITIAL = 0;
                        private static final int XML_TEXTREADER_MODE_INTERACTIVE = 1;
                    Severity: Minor
                    Found in ext/java/nokogiri/XmlReader.java - About 4 hrs to fix

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

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

                          public void relink_namespace(ThreadContext context) {
                              if (!(node instanceof Element)) {
                                  return;
                              }
                      
                      
                      Severity: Minor
                      Found in ext/java/nokogiri/XmlNode.java - 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 lookupNamespaceURI has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public String lookupNamespaceURI(String specifiedPrefix) {
                              short type = this.getNodeType();
                              switch (type) {
                              case Node.ELEMENT_NODE : {
                      
                      

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

                          @Override
                          public /* synchronized */ int getDTMHandleFromNode(org.w3c.dom.Node node) {
                              //if (node == null) // "node must be non-null for getDTMHandleFromNode!");
                              //    throw new IllegalArgumentException(XMLMessages.createXMLMessage(XMLErrorResources.ER_NODE_NON_NULL, null));
                              assert node != null;
                      Severity: Minor
                      Found in ext/java/nokogiri/internals/XalanDTMManagerPatch.java - 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 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
                        Severity
                        Category
                        Status
                        Source
                        Language