virajmahesh/icsi-shift-scheduler

View on GitHub

Showing 4 of 150 total issues

Method notify_users has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def notify_users
    @user = current_user
    unless @user.nil?
      Shift.shifts_with_skills(@user.skills).each do |shift|

Severity: Minor
Found in app/controllers/users/registrations_controller.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 notify_users has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def notify_users
    unless @shift.nil?

      User.users_with_skills(@shift.skills).each do |user|
        if not user.notified_about? @shift and @shift.event.is_future?
Severity: Minor
Found in app/controllers/shifts_controller.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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    edit  # Call the edit method and use it to set the controller variables

    if can? :update, @event
      old_date = @event.event_date
Severity: Minor
Found in app/controllers/events_controller.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 transfer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def transfer
    if params[:login].nil? or params[:login].empty?
      flash.alert = "Please specify the new event creator's email/username"
    else
      @user = User.find_first_by_auth_conditions params
Severity: Minor
Found in app/controllers/events_controller.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