sparklemotion/nokogiri

View on GitHub

Showing 400 of 537 total issues

Method outputAttrToWriter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  protected static final void
  outputAttrToWriter(
    final String name, final String value,
    final OutputStream writer, final Map<String, byte[]> cache
  ) throws IOException
Severity: Minor
Found in ext/java/nokogiri/internals/c14n/CanonicalizerBase.java - About 35 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 encodeStringToHtmlEntity has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  private CharSequence
  encodeStringToHtmlEntity(CharSequence text)
  {
    if (encoding == null) { return text; }

Severity: Minor
Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 35 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 adoptAsChild has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  private Node[]
  adoptAsChild(final Node parent, Node otherNode)
  {
    /*
     * This is a bit of a hack.  C-Nokogiri allows adding a bare text node as the root element.
Severity: Minor
Found in ext/java/nokogiri/XmlNode.java - About 35 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 getElements has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  private static List<Node>
  getElements(Node node, final boolean firstOnly)
  {
    NodeList children = node.getChildNodes();
    if (children.getLength() == 0) {
Severity: Minor
Found in ext/java/nokogiri/XmlNode.java - About 35 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 isNamespaceDefined has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  private static boolean
  isNamespaceDefined(String qName, NamedNodeMap nodeMap)
  {
    if (isNamespace(qName.intern())) { return true; }
    for (int i = 0; i < nodeMap.getLength(); i++) {
Severity: Minor
Found in ext/java/nokogiri/XmlDocumentFragment.java - About 35 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 needBreakInOpening has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  private boolean
  needBreakInOpening(Element element)
  {
    if (containsText(element)) { return false; }
    if (fragment) { return false; }
Severity: Minor
Found in ext/java/nokogiri/internals/SaveContextVisitor.java - About 35 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 clear has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  public void
  clear()
  {
    // removes namespace declarations from node
    for (CacheEntry entry : cache.values()) {
Severity: Minor
Found in ext/java/nokogiri/internals/NokogiriNamespaceCache.java - About 35 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 acceptChildren has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  void
  acceptChildren(ThreadContext context, IRubyObject[] nodes, SaveContextVisitor visitor)
  {
    if (nodes.length > 0) {
      for (int i = 0; i < nodes.length; i++) {
Severity: Minor
Found in ext/java/nokogiri/XmlNode.java - About 35 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 findSubElements has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  protected static List<String>
  findSubElements(HTMLElements.Element elem)
  {
    List<String> subs = subElements.get(elem.code);

Severity: Minor
Found in ext/java/nokogiri/Html4ElementDescription.java - About 35 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 root_set has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  @JRubyMethod(name = "root=")
  public IRubyObject
  root_set(ThreadContext context, IRubyObject new_root)
  {
    // in case of document fragment, temporary root node should be deleted.
Severity: Minor
Found in ext/java/nokogiri/XmlDocument.java - About 35 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 enter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

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

  protected static final void
  outputTextToWriter(
    final String text, final OutputStream writer
  ) throws IOException
  {
Severity: Minor
Found in ext/java/nokogiri/internals/c14n/CanonicalizerBase.java - About 35 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 get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  public XmlNamespace
  get(Node node, String prefix)
  {
    if (prefix == null) { return defaultNamespace; }
    for (Map.Entry<CacheKey, CacheEntry> entry : cache.entrySet()) {
Severity: Minor
Found in ext/java/nokogiri/internals/NokogiriNamespaceCache.java - About 35 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 getTextContentRecursively has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  private static StringBuilder
  getTextContentRecursively(StringBuilder buffer, Node currentNode)
  {
    CharSequence textContent = currentNode.getNodeValue();
    if (textContent != null && NokogiriHelpers.shouldDecode(currentNode)) {
Severity: Minor
Found in ext/java/nokogiri/XmlNode.java - About 35 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 commonElement has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private void
    commonElement(QName element, XMLAttributes attrs, boolean isEmpty)
    {
      String qName = element.rawname;
      String uri = element.uri;
Severity: Minor
Found in ext/java/nokogiri/XmlReader.java - About 35 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 do_parse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  protected Document
  do_parse() throws SAXException, IOException
  {
    try {
      parser.parse(getInputSource());
Severity: Minor
Found in ext/java/nokogiri/internals/XmlDomParserContext.java - About 35 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 compare has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  @JRubyMethod(visibility = Visibility.PRIVATE)
  public IRubyObject
  compare(ThreadContext context, IRubyObject other)
  {
    if (!(other instanceof XmlNode)) {
Severity: Minor
Found in ext/java/nokogiri/XmlNode.java - About 35 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 add_child has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def add_child(node_or_tags)
        raise "A document may not have multiple root nodes." if (root && root.name != "nokogiri_text_wrapper") && !(node_or_tags.comment? || node_or_tags.processing_instruction?)

        node_or_tags = coerce(node_or_tags)
        if node_or_tags.is_a?(XML::NodeSet)
Severity: Minor
Found in lib/nokogiri/xml/document.rb - About 35 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 getNextTask has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  protected int
  getNextTask()
  {
    while (true) {
      try {
Severity: Minor
Found in ext/java/nokogiri/internals/NokogiriBlockingQueueInputStream.java - About 35 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 == has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def ==(other)
        return false unless other.is_a?(Nokogiri::XML::NodeSet)
        return false unless length == other.length

        each_with_index do |node, i|
Severity: Minor
Found in lib/nokogiri/xml/node_set.rb - About 35 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