codeRIT/hackathon_manager

View on GitHub
app/helpers/hackathon_manager_helper.rb

Summary

Maintainability
A
1 hr
Test Coverage

Method display_datetime has a Cognitive Complexity of 12 (exceeds 7 allowed). Consider refactoring.
Open

  def display_datetime(datetime, opts = {})
    if datetime.blank?
      return ""
    end
    opts[:relative] = true if opts[:relative].nil?
Severity: Minor
Found in app/helpers/hackathon_manager_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 active_link_to has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring.
Open

  def active_link_to(name = nil, options = nil, html_options = nil, &block)
    # this is from Rails source - ignore rubocop
    # rubocop:disable Style/ParallelAssignment
    html_options, options, name = options, name, block if block_given?
    options ||= {}
Severity: Minor
Found in app/helpers/hackathon_manager_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

Add empty line after guard clause.
Open

    end

This cop enforces empty line after guard clause

Example:

# bad
def foo
  return if need_return?
  bar
end

# good
def foo
  return if need_return?

  bar
end

# good
def foo
  return if something?
  return if something_different?

  bar
end

# also good
def foo
  if something?
    do_something
    return if need_return?
  end
end

There are no issues that match your filters.

Category
Status