YaleSTC/shifts

View on GitHub

Showing 294 of 294 total issues

Similar blocks of code found in 17 locations. Consider refactoring.
Open

describe ReportItemsController do
  fixtures :all
  render_views
  
  it "index action should render index template" do
Severity: Major
Found in spec_old/controllers/report_items_controller_spec.rb and 16 other locations - About 4 hrs to fix
spec_old/controllers/calendars_controller_spec.rb on lines 3..55
spec_old/controllers/categories_controller_spec.rb on lines 3..55
spec_old/controllers/locations_controller_spec.rb on lines 3..55
spec_old/controllers/payform_item_sets_controller_spec.rb on lines 3..55
spec_old/controllers/payform_sets_controller_spec.rb on lines 3..55
spec_old/controllers/punch_clocks_controller_spec.rb on lines 3..55
spec_old/controllers/repeating_events_controller_spec.rb on lines 3..55
spec_old/controllers/reports_controller_spec.rb on lines 3..55
spec_old/controllers/restrictions_controller_spec.rb on lines 3..55
spec_old/controllers/shifts_controller_spec.rb on lines 3..55
spec_old/controllers/sub_requests_controller_spec.rb on lines 3..55
spec_old/controllers/time_slots_controller_spec.rb on lines 3..55
spec_old/controllers/user_configs_controller_spec.rb on lines 3..55
spec_old/controllers/user_profile_entries_controller_spec.rb on lines 3..55
spec_old/controllers/user_profile_fields_controller_spec.rb on lines 3..55
spec_old/controllers/user_profiles_controller_spec.rb on lines 3..55

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 155.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 17 locations. Consider refactoring.
Open

describe PayformSetsController do
  fixtures :all
  render_views
  
  it "index action should render index template" do
Severity: Major
Found in spec_old/controllers/payform_sets_controller_spec.rb and 16 other locations - About 4 hrs to fix
spec_old/controllers/calendars_controller_spec.rb on lines 3..55
spec_old/controllers/categories_controller_spec.rb on lines 3..55
spec_old/controllers/locations_controller_spec.rb on lines 3..55
spec_old/controllers/payform_item_sets_controller_spec.rb on lines 3..55
spec_old/controllers/punch_clocks_controller_spec.rb on lines 3..55
spec_old/controllers/repeating_events_controller_spec.rb on lines 3..55
spec_old/controllers/report_items_controller_spec.rb on lines 3..55
spec_old/controllers/reports_controller_spec.rb on lines 3..55
spec_old/controllers/restrictions_controller_spec.rb on lines 3..55
spec_old/controllers/shifts_controller_spec.rb on lines 3..55
spec_old/controllers/sub_requests_controller_spec.rb on lines 3..55
spec_old/controllers/time_slots_controller_spec.rb on lines 3..55
spec_old/controllers/user_configs_controller_spec.rb on lines 3..55
spec_old/controllers/user_profile_entries_controller_spec.rb on lines 3..55
spec_old/controllers/user_profile_fields_controller_spec.rb on lines 3..55
spec_old/controllers/user_profiles_controller_spec.rb on lines 3..55

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 155.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 17 locations. Consider refactoring.
Open

describe UserConfigsController do
  fixtures :all
  render_views
  
  it "index action should render index template" do
Severity: Major
Found in spec_old/controllers/user_configs_controller_spec.rb and 16 other locations - About 4 hrs to fix
spec_old/controllers/calendars_controller_spec.rb on lines 3..55
spec_old/controllers/categories_controller_spec.rb on lines 3..55
spec_old/controllers/locations_controller_spec.rb on lines 3..55
spec_old/controllers/payform_item_sets_controller_spec.rb on lines 3..55
spec_old/controllers/payform_sets_controller_spec.rb on lines 3..55
spec_old/controllers/punch_clocks_controller_spec.rb on lines 3..55
spec_old/controllers/repeating_events_controller_spec.rb on lines 3..55
spec_old/controllers/report_items_controller_spec.rb on lines 3..55
spec_old/controllers/reports_controller_spec.rb on lines 3..55
spec_old/controllers/restrictions_controller_spec.rb on lines 3..55
spec_old/controllers/shifts_controller_spec.rb on lines 3..55
spec_old/controllers/sub_requests_controller_spec.rb on lines 3..55
spec_old/controllers/time_slots_controller_spec.rb on lines 3..55
spec_old/controllers/user_profile_entries_controller_spec.rb on lines 3..55
spec_old/controllers/user_profile_fields_controller_spec.rb on lines 3..55
spec_old/controllers/user_profiles_controller_spec.rb on lines 3..55

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 155.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 17 locations. Consider refactoring.
Open

describe ShiftsController do
  fixtures :all
  render_views
  
  it "index action should render index template" do
Severity: Major
Found in spec_old/controllers/shifts_controller_spec.rb and 16 other locations - About 4 hrs to fix
spec_old/controllers/calendars_controller_spec.rb on lines 3..55
spec_old/controllers/categories_controller_spec.rb on lines 3..55
spec_old/controllers/locations_controller_spec.rb on lines 3..55
spec_old/controllers/payform_item_sets_controller_spec.rb on lines 3..55
spec_old/controllers/payform_sets_controller_spec.rb on lines 3..55
spec_old/controllers/punch_clocks_controller_spec.rb on lines 3..55
spec_old/controllers/repeating_events_controller_spec.rb on lines 3..55
spec_old/controllers/report_items_controller_spec.rb on lines 3..55
spec_old/controllers/reports_controller_spec.rb on lines 3..55
spec_old/controllers/restrictions_controller_spec.rb on lines 3..55
spec_old/controllers/sub_requests_controller_spec.rb on lines 3..55
spec_old/controllers/time_slots_controller_spec.rb on lines 3..55
spec_old/controllers/user_configs_controller_spec.rb on lines 3..55
spec_old/controllers/user_profile_entries_controller_spec.rb on lines 3..55
spec_old/controllers/user_profile_fields_controller_spec.rb on lines 3..55
spec_old/controllers/user_profiles_controller_spec.rb on lines 3..55

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 155.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 17 locations. Consider refactoring.
Open

describe TimeSlotsController do
  fixtures :all
  render_views
  
  it "index action should render index template" do
Severity: Major
Found in spec_old/controllers/time_slots_controller_spec.rb and 16 other locations - About 4 hrs to fix
spec_old/controllers/calendars_controller_spec.rb on lines 3..55
spec_old/controllers/categories_controller_spec.rb on lines 3..55
spec_old/controllers/locations_controller_spec.rb on lines 3..55
spec_old/controllers/payform_item_sets_controller_spec.rb on lines 3..55
spec_old/controllers/payform_sets_controller_spec.rb on lines 3..55
spec_old/controllers/punch_clocks_controller_spec.rb on lines 3..55
spec_old/controllers/repeating_events_controller_spec.rb on lines 3..55
spec_old/controllers/report_items_controller_spec.rb on lines 3..55
spec_old/controllers/reports_controller_spec.rb on lines 3..55
spec_old/controllers/restrictions_controller_spec.rb on lines 3..55
spec_old/controllers/shifts_controller_spec.rb on lines 3..55
spec_old/controllers/sub_requests_controller_spec.rb on lines 3..55
spec_old/controllers/user_configs_controller_spec.rb on lines 3..55
spec_old/controllers/user_profile_entries_controller_spec.rb on lines 3..55
spec_old/controllers/user_profile_fields_controller_spec.rb on lines 3..55
spec_old/controllers/user_profiles_controller_spec.rb on lines 3..55

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 155.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

File application_controller.rb has 354 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class ApplicationController < ActionController::Base
  # almost everything we do is restricted to a department so we always load_department
  # feel free to skip_before_filter when desired
  before_filter :load_app_config
  before_filter :department_chooser
Severity: Minor
Found in app/controllers/application_controller.rb - About 4 hrs to fix

    Method update has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

      def update
        @user_profile = UserProfile.find(params[:id])
        @user_profile.update_attributes(params[:user_profile]) #necessary for profile pics to save
    
        @user = User.find(@user_profile.user_id)
    Severity: Minor
    Found in app/controllers/user_profiles_controller.rb - About 4 hrs 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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        header_no_label.each(function(){
            var header_id = $(this).attr("id"),
                    child_checkboxes = $('[class='+header_id+'][id^="loc"]'),
                    child_checkboxes_checked = $('[class='+header_id+'][id^="loc"][checked="checked"]');
    
    
    Severity: Major
    Found in app/assets/javascripts/user_config.js and 1 other location - About 4 hrs to fix
    app/assets/javascripts/user_config.js on lines 20..29

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 123.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        header_no_label.each(function(){
            var header_id = $(this).attr("id"),
                    child_checkboxes_dt = $('[class='+header_id+'][id^="dt"]'),
                    child_checkboxes_checked_dt = $('[class='+header_id+'][id^="dt"][checked="checked"]');
            if(child_checkboxes_checked_dt.length === child_checkboxes_dt.length) {
    Severity: Major
    Found in app/assets/javascripts/user_config.js and 1 other location - About 4 hrs to fix
    app/assets/javascripts/user_config.js on lines 8..18

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 123.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Method update has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

      def update
        @punch_clock_set = PunchClockSet.find(params[:id])
        messages = []
        @punch_clock_set.punch_clocks.each do |pc|
          if params[:pause]
    Severity: Minor
    Found in app/controllers/punch_clock_sets_controller.rb - About 4 hrs 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

    Class ApplicationController has 32 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class ApplicationController < ActionController::Base
      # almost everything we do is restricted to a department so we always load_department
      # feel free to skip_before_filter when desired
      before_filter :load_app_config
      before_filter :department_chooser
    Severity: Minor
    Found in app/controllers/application_controller.rb - About 4 hrs to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              child_checkboxes_dt.click(function(){
                var child_checkboxes_checked_dt = 0;
                child_checkboxes_dt.each(function(){
                  if($(this).attr('checked')){
                    child_checkboxes_checked_dt++;
      Severity: Major
      Found in app/assets/javascripts/user_config.js and 1 other location - About 3 hrs to fix
      app/assets/javascripts/user_config.js on lines 53..64

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 113.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              child_checkboxes.click(function(){
                var child_checkboxes_checked = 0;
                child_checkboxes.each(function(){
                  if($(this).attr('checked')){
                    child_checkboxes_checked++;
      Severity: Major
      Found in app/assets/javascripts/user_config.js and 1 other location - About 3 hrs to fix
      app/assets/javascripts/user_config.js on lines 65..76

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 113.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Method add_job_after has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

        def add_job_after
          p = session[:external]
          unless p.blank?
            #if currently logged in user of RT and Payform are different
            if current_user.login != p[:netid]
      Severity: Minor
      Found in app/controllers/hooks_controller.rb - About 3 hrs 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 create has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

        def create
          if @user = User.where(login: params[:user][:login]).first
            if @user.departments.include? @department #if user is already in this department
              flash[:notice] = "This user already exists in this department."
            else
      Severity: Minor
      Found in app/controllers/users_controller.rb - About 3 hrs 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 23 (exceeds 5 allowed). Consider refactoring.
      Open

        def update
          #TODO: prevent params hacking w/ regard to setting roles and login and payrate
          params[:user][:role_ids] ||= []
          @user = User.find(params[:id])
          #store role changes, or else they'll overwrite roles in other departments
      Severity: Minor
      Found in app/controllers/users_controller.rb - About 3 hrs 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

      File user.rb has 302 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'net/ldap'
      require 'rails_extensions'
      require 'memoist'
      
      class User < ActiveRecord::Base
      Severity: Minor
      Found in app/models/user.rb - About 3 hrs to fix

        Method calendar_day_preprocessing has 78 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def calendar_day_preprocessing(day)
            @location_rows = {}
            @location_rows_timeslots = {}
        
        
        
        Severity: Major
        Found in app/helpers/calendars_helper.rb - About 3 hrs to fix

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              until shifts.empty?
                shift = shifts.shift
                if !shift.end
                  shift.end = Time.now
                elsif shift.end <= shift.start + current_department.department_config.time_increment.minutes
          Severity: Major
          Found in app/helpers/calendars_helper.rb and 1 other location - About 3 hrs to fix
          app/helpers/shifts_helper.rb on lines 214..241

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 107.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              until shifts.empty?
                shift = shifts.shift
                if !shift.end
                  shift.end = Time.now
                elsif shift.end <= shift.start + current_department.department_config.time_increment.minutes
          Severity: Major
          Found in app/helpers/shifts_helper.rb and 1 other location - About 3 hrs to fix
          app/helpers/calendars_helper.rb on lines 117..144

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 107.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Severity
          Category
          Status
          Source
          Language