crewmate/crewmate

View on GitHub
app/helpers/application_helper.rb

Summary

Maintainability
A
3 hrs
Test Coverage

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

  def js_id(*args)
    if args.is_a?(Array)
      element = args[0].is_a?(String) || args[0].is_a?(Symbol) ? args[0] : nil
      models = args.slice(1,args.size-1)
      raise ArgumentError unless models.all?{|a|a.is_a?(ActiveRecord::Base)}
Severity: Minor
Found in app/helpers/application_helper.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 organization_link_colour has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def organization_link_colour
    "".tap do |html|
      html << '<style type="text/css">'
      html << "a { color: ##{@organization ? @organization.settings['colours']['links'] : ''};}"
      html << "a:hover { color: ##{@organization ? @organization.settings['colours']['link_hover'] : ''};}"
Severity: Minor
Found in app/helpers/application_helper.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 upload_form_html_options has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def upload_form_html_options(page, upload)
    id = upload.new_record? ? 'new_upload' : 'upload_file_form'
    form_classes = %w(upload_form app_form)
    form_classes << 'form_error' unless upload.errors.empty?
    form_classes << 'new_upload' if upload.new_record?
Severity: Minor
Found in app/helpers/application_helper.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 human_hours has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def human_hours(hours)
    hours = (hours.to_f * 100).round.to_f / 100
    if hours > 0
      minutes = ((hours % 1) * 60).round

Severity: Minor
Found in app/helpers/application_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