denispeplin/link_to_action

View on GitHub

Showing 4 of 4 total issues

Method action_class has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def self.action_class(action, options)
    if LinkToAction.use_classes
      class_default = LinkToAction.class_default
      class_action = LinkToAction.send("class_#{action}")
    end
Severity: Minor
Found in lib/link_to_action/utils.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 link_to_show has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def link_to_show(object, options = {})
    name = options.delete(:name)
    raw = options.delete(:raw)
    send = options.delete(:send)
    i18n = options.delete(:i18n)
Severity: Minor
Found in lib/link_to_action/helpers.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_icon_to_name has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def self.add_icon_to_name(action, name, options)
    icon = self.action_icon(action, options)
    icon_swap = options.delete(:icon_swap)
    if LinkToAction.use_icons && icon
      icon = "<i class=\"#{icon}\"></i>"
Severity: Minor
Found in lib/link_to_action/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 link_to_destroy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def link_to_destroy(object, options = {})
    options[:method] = :delete
    if (options.has_key? :confirm)
      confirm = options.delete(:confirm)
    else
Severity: Minor
Found in lib/link_to_action/helpers.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