kpricorn/foundation-navigation

View on GitHub

Showing 4 of 4 total issues

Method initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(contain_to_grid: false, fixed: false, sticky: true, **args, &block)
      if contain_to_grid || fixed || sticky
        classes = []
        classes << 'contain-to-grid' if contain_to_grid
        classes << 'fixed' if fixed
Severity: Minor
Found in lib/foundation-navigation/topbar.rb - About 55 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 to_s has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def to_s
      if children.size > 0
        "<#{name}#{' ' + attrs unless attrs.empty?}>#{children.join}</#{name}>"
      else
        "<#{name}#{' ' + attrs unless attrs.empty?} />"
Severity: Minor
Found in lib/foundation-navigation/node.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 add_node has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def add_node(name, *opts, &block)
      parent = @node
      @node = Node.new(parent, name, *opts)
      parent.children << @node if parent
      if block_given?
Severity: Minor
Found in lib/foundation-navigation/builder.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(title: nil, title_link: nil, menu_text: 'Menu', menu_icon:
                   true)
      ul(class: 'title-area') do
        if title.present?
          li(class: 'name') { h1 { a(href: title_link || '#') {  title } } }
Severity: Minor
Found in lib/foundation-navigation/title_area.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