sparklemotion/nokogiri

View on GitHub

Showing 400 of 533 total issues

Avoid too many return statements within this method.
Open

    if (format && element.getNextSibling() == null && element.hasChildNodes()) { return true; }
Severity: Major
Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

        return value.replace(m.group(), "charset=" + encoding);
    Severity: Major
    Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

            return obj.toJava(java.math.BigInteger.class);
      Severity: Major
      Found in ext/java/nokogiri/internals/NokogiriXPathFunction.java - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

            if (obj instanceof XmlNodeSet) { return obj; }
        Severity: Major
        Found in ext/java/nokogiri/internals/NokogiriXPathFunction.java - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

              /*if (o instanceof XmlNode)*/ return ((XmlNode) obj).getNode();
          Severity: Major
          Found in ext/java/nokogiri/internals/NokogiriXPathFunction.java - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                return false;
            Severity: Major
            Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                  return false;
              Severity: Major
              Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 30 mins to fix

                Method apply has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  protected void
                  apply(Ruby runtime, RubyClass klass,
                        XmlDocument doc,
                        NodeIter iter)
                  {
                Severity: Minor
                Found in ext/java/nokogiri/XmlElementContent.java - About 25 mins 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 encoding has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  @JRubyMethod
                  public IRubyObject
                  encoding(ThreadContext context)
                  {
                    if (this.encoding == null || this.encoding.isNil()) {
                Severity: Minor
                Found in ext/java/nokogiri/XmlDocument.java - About 25 mins 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 index has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  protected int
                  index(Object obj)
                  {
                    Object[] set = keys;
                    int length = set.length;
                Severity: Minor
                Found in ext/java/nokogiri/internals/c14n/NameSpaceSymbTable.java - About 25 mins 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 createElementForFamily has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  public static Element
                  createElementForFamily(Document doc, String namespace, String localName)
                  {
                    Element result;
                    String prefix = ElementProxy.getDefaultPrefix(namespace);
                Severity: Minor
                Found in ext/java/nokogiri/internals/c14n/ElementProxy.java - About 25 mins 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 findPreviousElement has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  private Node
                  findPreviousElement(Node n)
                  {
                    Node previous = n.getPreviousSibling() == null ? n.getParentNode() : n.getPreviousSibling();
                    if (previous == null || previous.getNodeType() == Node.DOCUMENT_NODE) { return null; }
                Severity: Minor
                Found in ext/java/nokogiri/XmlNode.java - About 25 mins 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 getNodeName has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  @Override
                  protected IRubyObject
                  getNodeName(ThreadContext context)
                  {
                    if (name != null) { return name; }
                Severity: Minor
                Found in ext/java/nokogiri/XmlAttr.java - About 25 mins 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 rbNew has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  @JRubyMethod(name = "new", meta = true, required = 1, optional = 3)
                  public static IRubyObject
                  rbNew(ThreadContext context, IRubyObject cls, IRubyObject[] args, Block block)
                  {
                    if (args.length < 1) {
                Severity: Minor
                Found in ext/java/nokogiri/XmlDocumentFragment.java - About 25 mins 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 createElementForFamilyLocal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  protected Element
                  createElementForFamilyLocal(
                    Document doc, String namespace, String localName
                  )
                  {
                Severity: Minor
                Found in ext/java/nokogiri/internals/c14n/ElementProxy.java - About 25 mins 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 prefixStr2Set has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  public static SortedSet<String>
                  prefixStr2Set(String inclusiveNamespaces)
                  {
                    SortedSet<String> prefixes = new TreeSet<String>();
                
                
                Severity: Minor
                Found in ext/java/nokogiri/internals/c14n/InclusiveNamespaces.java - About 25 mins 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 isVisibleDO has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  protected int
                  isVisibleDO(Node currentNode, int level)
                  {
                    if (nodeFilter != null) {
                      Iterator<NodeFilter> it = nodeFilter.iterator();
                Severity: Minor
                Found in ext/java/nokogiri/internals/c14n/CanonicalizerBase.java - About 25 mins 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 resolveNamespaceIfNecessary has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  private void
                  resolveNamespaceIfNecessary(Node node, String default_href)
                  {
                    if (node == null) { return; }
                    String nodePrefix = node.getPrefix();
                Severity: Minor
                Found in ext/java/nokogiri/XmlDocument.java - About 25 mins 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 findEncodingName has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  private static String
                  findEncodingName(ThreadContext context, IRubyObject encoding)
                  {
                    String rubyEncoding = null;
                    if (encoding instanceof RubyString) {
                Severity: Minor
                Found in ext/java/nokogiri/Html4SaxParserContext.java - About 25 mins 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 accept has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  @Override
                  public void
                  accept(ThreadContext context, SaveContextVisitor visitor)
                  {
                    visitor.enter(node);
                Severity: Minor
                Found in ext/java/nokogiri/XmlEntityReference.java - About 25 mins 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