pixelate/raev

View on GitHub

Showing 8 of 8 total issues

Method headline has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def headline
      if linked_data && linked_data["headline"]
        return Sanitize.clean(linked_data["headline"])
      end
      
Severity: Minor
Found in lib/raev/url.rb - About 1 hr 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 pubdate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def pubdate      
      if linked_data && linked_data["datePublished"]
        return Date.parse(linked_data["datePublished"])
      end
      
Severity: Minor
Found in lib/raev/url.rb - About 1 hr 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 headline has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def headline
      if linked_data && linked_data["headline"]
        return Sanitize.clean(linked_data["headline"])
      end
      
Severity: Minor
Found in lib/raev/url.rb - About 1 hr to fix

    Method normalize_name has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.normalize_name author_name
          if author_name.nil?
            return nil
          else
            # Strip whitespace
    Severity: Minor
    Found in lib/raev/author.rb - About 45 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 remove_extra_linebreaks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def remove_extra_linebreaks(doc)
          doc.css("br".freeze).each do |node|
            next_node = node.next
            
            if next_node
    Severity: Minor
    Found in lib/raev/article.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 feed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def feed
          feed_url = nil
          
          node = document.css('link[type="application/rss+xml"][rel="alternate"]'.freeze)
          
    Severity: Minor
    Found in lib/raev/url.rb - 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 ratingValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

            def ratingValue
                node = document.search('*[itemprop="ratingValue"]'.freeze).first
                
                if node
                    if node.attribute("content".freeze)
    Severity: Minor
    Found in lib/raev/url.rb - 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 bestRating has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

            def bestRating
                node = document.search('*[itemprop="bestRating"]'.freeze).first
                
                if node
                    if node.attribute("content".freeze)
    Severity: Minor
    Found in lib/raev/url.rb - 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