calblueprint/ashby-village

View on GitHub

Showing 25 of 51 total issues

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

  def notifications
    @email_notif = current_user.global_email_notifications
    if @email_notif == true
      if current_user.update_attribute(:global_email_notifications, false)
        flash[:notice] = "Your email notifications are now off."
Severity: Minor
Found in app/controllers/users_controller.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 autocomplete_group_name has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def autocomplete_group_name
    if params[:term].nil?
      puts "<<< Error no term"
    else
      term = params[:term].downcase
Severity: Minor
Found in app/controllers/groups_controller.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 add_users has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def add_users(current_user, organizers)
    @event_organizers = [current_user]
    if organizers
      @event_organizers.concat(User.find(organizers))
    end
Severity: Minor
Found in app/models/event.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 event_endtime_later_than_starttime has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def event_endtime_later_than_starttime
    if enddate.present? && endtime.present?
      if enddate.nil?
        errors.add(:enddate, "You must choose a end date.")
      elsif enddate < startdate
Severity: Minor
Found in app/models/event.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 event_starttime_later_than_now has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def event_starttime_later_than_now
    if starttime.present? && startdate.present?
      if startdate.nil?
        errors.add(:startdate, "You must choose a start date.")
      elsif startdate < DateTime.now.to_date
Severity: Minor
Found in app/models/event.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