OWASP/railsgoat

View on GitHub
app/assets/javascripts/date-picker/daterangepicker.js

Summary

Maintainability
F
5 days
Test Coverage

File daterangepicker.js has 553 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
* @version: 1.1
* @author: Dan Grossman http://www.dangrossman.info/
* @date: 2013-03-04
* @copyright: Copyright (c) 2012 Dan Grossman. All rights reserved.
Severity: Major
Found in app/assets/javascripts/date-picker/daterangepicker.js - About 1 day to fix

    Function DateRangePicker has 197 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        var DateRangePicker = function (element, options, cb) {
            var hasOptions = typeof options == 'object';
            var localeObject;
    
            //state
    Severity: Major
    Found in app/assets/javascripts/date-picker/daterangepicker.js - About 7 hrs to fix

      Function renderCalendar has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              renderCalendar: function (calendar, selected, minDate, maxDate) {
                  var html = '<table class="table-condensed">';
                  html += '<thead>';
                  html += '<tr>';
                  
      Severity: Major
      Found in app/assets/javascripts/date-picker/daterangepicker.js - About 2 hrs to fix

        Function clickDate has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                clickDate: function (e) {
                    var title = $(e.target).attr('title');
                    var row = title.substr(1, 1);
                    var col = title.substr(3, 1);
                    var cal = $(e.target).parents('.calendar');
        Severity: Major
        Found in app/assets/javascripts/date-picker/daterangepicker.js - About 2 hrs to fix

          Avoid deeply nested control flow statements.
          Open

                                  if (calendar[row][col].equals(this.startDate)) { cname += ' start-date '; }
          Severity: Major
          Found in app/assets/javascripts/date-picker/daterangepicker.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if (calendar[row][col].equals(this.endDate)) { cname += ' end-date '; }
            Severity: Major
            Found in app/assets/javascripts/date-picker/daterangepicker.js - About 45 mins to fix

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

                                  } else if (calendar[row][col].equals(selected)) {
                                      cname += ' active ';
                                      if (calendar[row][col].equals(this.startDate)) { cname += ' start-date '; }
                                      if (calendar[row][col].equals(this.endDate)) { cname += ' end-date '; }
                                  } else if (calendar[row][col] >= this.startDate && calendar[row][col] <= this.endDate) {
              Severity: Major
              Found in app/assets/javascripts/date-picker/daterangepicker.js and 1 other location - About 2 hrs to fix
              app/assets/javascripts/date-picker/daterangepicker.js on lines 694..698

              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 79.

              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

                                  } else if (calendar[row][col] >= this.startDate && calendar[row][col] <= this.endDate) {
                                      cname += ' in-range ';
                                      if (calendar[row][col].equals(this.startDate)) { cname += ' start-date '; }
                                      if (calendar[row][col].equals(this.endDate)) { cname += ' end-date '; }
                                  }
              Severity: Major
              Found in app/assets/javascripts/date-picker/daterangepicker.js and 1 other location - About 2 hrs to fix
              app/assets/javascripts/date-picker/daterangepicker.js on lines 690..698

              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 79.

              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

                      this.rightCalendar = {
                          month: Date.today().set({ day: 1, month: this.endDate.getMonth(), year: this.endDate.getFullYear() }),
                          calendar: Array()
                      };
              Severity: Major
              Found in app/assets/javascripts/date-picker/daterangepicker.js and 1 other location - About 2 hrs to fix
              app/assets/javascripts/date-picker/daterangepicker.js on lines 47..50

              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 77.

              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

                      this.leftCalendar = {
                          month: Date.today().set({ day: 1, month: this.startDate.getMonth(), year: this.startDate.getFullYear() }),
                          calendar: Array()
                      };
              Severity: Major
              Found in app/assets/javascripts/date-picker/daterangepicker.js and 1 other location - About 2 hrs to fix
              app/assets/javascripts/date-picker/daterangepicker.js on lines 52..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 77.

              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

                          } else {
                              this.container.find('input[name=daterangepicker_end]').val(this.rightCalendar.calendar[row][col].toString(this.format));
                          }
              Severity: Minor
              Found in app/assets/javascripts/date-picker/daterangepicker.js and 1 other location - About 55 mins to fix
              app/assets/javascripts/date-picker/daterangepicker.js on lines 437..439

              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 54.

              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

                          this.leftCalendar.calendar = this.buildCalendar(this.leftCalendar.month.getMonth(), this.leftCalendar.month.getFullYear());
              Severity: Minor
              Found in app/assets/javascripts/date-picker/daterangepicker.js and 1 other location - About 55 mins to fix
              app/assets/javascripts/date-picker/daterangepicker.js on lines 542..542

              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 54.

              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

                          this.container.find('.calendar.left').html(this.renderCalendar(this.leftCalendar.calendar, this.startDate, this.minDate, this.maxDate));
              Severity: Minor
              Found in app/assets/javascripts/date-picker/daterangepicker.js and 1 other location - About 55 mins to fix
              app/assets/javascripts/date-picker/daterangepicker.js on lines 544..544

              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 54.

              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

                          this.rightCalendar.calendar = this.buildCalendar(this.rightCalendar.month.getMonth(), this.rightCalendar.month.getFullYear());
              Severity: Minor
              Found in app/assets/javascripts/date-picker/daterangepicker.js and 1 other location - About 55 mins to fix
              app/assets/javascripts/date-picker/daterangepicker.js on lines 541..541

              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 54.

              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

                          this.container.find('.calendar.right').html(this.renderCalendar(this.rightCalendar.calendar, this.endDate, this.startDate, this.maxDate));
              Severity: Minor
              Found in app/assets/javascripts/date-picker/daterangepicker.js and 1 other location - About 55 mins to fix
              app/assets/javascripts/date-picker/daterangepicker.js on lines 543..543

              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 54.

              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

                          if (cal.hasClass('left')) {
                              this.container.find('input[name=daterangepicker_start]').val(this.leftCalendar.calendar[row][col].toString(this.format));
                          } else {
              Severity: Minor
              Found in app/assets/javascripts/date-picker/daterangepicker.js and 1 other location - About 55 mins to fix
              app/assets/javascripts/date-picker/daterangepicker.js on lines 439..441

              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 54.

              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 6 locations. Consider refactoring.
              Open

                          this.leftCalendar.month.set({ month: this.startDate.getMonth(), year: this.startDate.getFullYear() });
              Severity: Major
              Found in app/assets/javascripts/date-picker/daterangepicker.js and 5 other locations - About 50 mins to fix
              app/assets/javascripts/date-picker/daterangepicker.js on lines 292..292
              app/assets/javascripts/date-picker/daterangepicker.js on lines 399..399
              app/assets/javascripts/date-picker/daterangepicker.js on lines 400..400
              app/assets/javascripts/date-picker/daterangepicker.js on lines 499..499
              app/assets/javascripts/date-picker/daterangepicker.js on lines 500..500

              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 52.

              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 6 locations. Consider refactoring.
              Open

                              this.leftCalendar.month.set({ month: this.startDate.getMonth(), year: this.startDate.getFullYear() });
              Severity: Major
              Found in app/assets/javascripts/date-picker/daterangepicker.js and 5 other locations - About 50 mins to fix
              app/assets/javascripts/date-picker/daterangepicker.js on lines 291..291
              app/assets/javascripts/date-picker/daterangepicker.js on lines 292..292
              app/assets/javascripts/date-picker/daterangepicker.js on lines 400..400
              app/assets/javascripts/date-picker/daterangepicker.js on lines 499..499
              app/assets/javascripts/date-picker/daterangepicker.js on lines 500..500

              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 52.

              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 6 locations. Consider refactoring.
              Open

                              this.rightCalendar.month.set({ month: this.endDate.getMonth(), year: this.endDate.getFullYear() });
              Severity: Major
              Found in app/assets/javascripts/date-picker/daterangepicker.js and 5 other locations - About 50 mins to fix
              app/assets/javascripts/date-picker/daterangepicker.js on lines 291..291
              app/assets/javascripts/date-picker/daterangepicker.js on lines 292..292
              app/assets/javascripts/date-picker/daterangepicker.js on lines 399..399
              app/assets/javascripts/date-picker/daterangepicker.js on lines 499..499
              app/assets/javascripts/date-picker/daterangepicker.js on lines 500..500

              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 52.

              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 6 locations. Consider refactoring.
              Open

                          this.rightCalendar.month.set({ month: this.endDate.getMonth(), year: this.endDate.getFullYear() });
              Severity: Major
              Found in app/assets/javascripts/date-picker/daterangepicker.js and 5 other locations - About 50 mins to fix
              app/assets/javascripts/date-picker/daterangepicker.js on lines 291..291
              app/assets/javascripts/date-picker/daterangepicker.js on lines 292..292
              app/assets/javascripts/date-picker/daterangepicker.js on lines 399..399
              app/assets/javascripts/date-picker/daterangepicker.js on lines 400..400
              app/assets/javascripts/date-picker/daterangepicker.js on lines 499..499

              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 52.

              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 6 locations. Consider refactoring.
              Open

                          this.rightCalendar.month.set({ month: this.endDate.getMonth(), year: this.endDate.getFullYear() });
              Severity: Major
              Found in app/assets/javascripts/date-picker/daterangepicker.js and 5 other locations - About 50 mins to fix
              app/assets/javascripts/date-picker/daterangepicker.js on lines 291..291
              app/assets/javascripts/date-picker/daterangepicker.js on lines 399..399
              app/assets/javascripts/date-picker/daterangepicker.js on lines 400..400
              app/assets/javascripts/date-picker/daterangepicker.js on lines 499..499
              app/assets/javascripts/date-picker/daterangepicker.js on lines 500..500

              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 52.

              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 6 locations. Consider refactoring.
              Open

                          this.leftCalendar.month.set({ month: this.startDate.getMonth(), year: this.startDate.getFullYear() });
              Severity: Major
              Found in app/assets/javascripts/date-picker/daterangepicker.js and 5 other locations - About 50 mins to fix
              app/assets/javascripts/date-picker/daterangepicker.js on lines 291..291
              app/assets/javascripts/date-picker/daterangepicker.js on lines 292..292
              app/assets/javascripts/date-picker/daterangepicker.js on lines 399..399
              app/assets/javascripts/date-picker/daterangepicker.js on lines 400..400
              app/assets/javascripts/date-picker/daterangepicker.js on lines 500..500

              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 52.

              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

              There are no issues that match your filters.

              Category
              Status