lfzawacki/musical-artifacts

View on GitHub
app/helpers/artifacts_helper.rb

Summary

Maintainability
A
1 hr
Test Coverage
A
93%

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

  def insert_hash(hash, path, value)
    head, *tail = path
    if tail.empty?
      hash.merge(head => value)
    else
Severity: Minor
Found in app/helpers/artifacts_helper.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 title_from_tags has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def title_from_tags tags
    title = ''

    if tags[:apps].present?
      title += tags[:apps].split(',').join(', ')
Severity: Minor
Found in app/helpers/artifacts_helper.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 external_link_to has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def external_link_to text, link=nil, opt=nil
    if block_given?
      link ||={}
      link_to(text, rel: 'nofollow', target: '_blank', class: link[:class] || "external-link normal") do
        yield
Severity: Minor
Found in app/helpers/artifacts_helper.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

There are no issues that match your filters.

Category
Status