spk/validate-website

View on GitHub

Showing 4 of 6 total issues

Method check_static_not_found has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def check_static_not_found(links, site = @site)
      static_links = links.map { |l| StaticLink.new(l, site) }
      static_links.each do |static_link|
        next unless static_link.check?

Severity: Minor
Found in lib/validate_website/static.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 urls_to_absolute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def self.urls_to_absolute(node, page)
      if node[:node] == :function && node[:name] == 'url' || node[:node] == :url
        Array(node[:value]).map do |v|
          url = v.is_a?(String) ? v : v[:value]
          page.to_absolute(url).to_s
Severity: Minor
Found in lib/validate_website/utils.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 crawl has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def crawl(options = {})
      @options = @options.merge(options)
      @site = @options[:site]

      files = Dir.glob(@options[:pattern])
Severity: Minor
Found in lib/validate_website/static.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 any_css_errors? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def any_css_errors?(nodes)
      nodes.any? do |node|
        if node[:children]
          any_css_errors? node.delete(:children)
        elsif node[:tokens]
Severity: Minor
Found in lib/validate_website/core.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