myems-admin/js/plugins/datapicker/angular-datepicker.js

Summary

Maintainability
F
1 wk
Test Coverage

File angular-datepicker.js has 984 lines of code (exceeds 250 allowed). Consider refactoring.
Open

(function (global, factory) {'use strict';var fnc;fnc = (typeof exports === 'object' && typeof module !== 'undefined') ? module.exports = factory(require('angular'), require('moment')) :(typeof define === 'function' && define.amd) ? define(['angular', 'moment'], factory) :factory(global.angular, global.moment);}(this, function (angular, moment) {
//(function (global, factory) {
//  'use strict';
//  var fnc;
//  fnc = (typeof exports === 'object' && typeof module !== 'undefined') ? module.exports = factory(require('angular'), require('moment')) :
Severity: Major
Found in myems-admin/js/plugins/datapicker/angular-datepicker.js - About 2 days to fix

    Function datePickerDirective has 275 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        Module.directive('datePicker', ['datePickerConfig', 'datePickerUtils', function datePickerDirective(datePickerConfig, datePickerUtils) {
    
            //noinspection JSUnusedLocalSymbols
            return {
                // this is a bug ?
    Severity: Major
    Found in myems-admin/js/plugins/datapicker/angular-datepicker.js - About 1 day to fix

      Function link has 264 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  link: function (scope, element, attrs, ngModel) {
                      function prepareViews() {
                          scope.views = datePickerConfig.views.concat();
                          scope.view = attrs.view || datePickerConfig.view;
      
      
      Severity: Major
      Found in myems-admin/js/plugins/datapicker/angular-datepicker.js - About 1 day to fix

        Function link has 157 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    link: function (scope, element, attrs, ngModel) {
                        var format = attrs.format || dateTimeConfig.format,
                            parentForm = element.inheritedData('$formController'),
                            views = $parse(attrs.views)(scope) || dateTimeConfig.views.concat(),
                            view = attrs.view || views[0],
        Severity: Major
        Found in myems-admin/js/plugins/datapicker/angular-datepicker.js - About 6 hrs to fix

          Function link has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      link: function (scope, element, attrs) {
                          var dateChange = null,
                              pickerRangeID = element[0].id,
                              pickerIDs = [randomName(), randomName()],
                              createMoment = datePickerUtils.createMoment,
          Severity: Minor
          Found in myems-admin/js/plugins/datapicker/angular-datepicker.js - About 1 hr to fix

            Function showPicker has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                            function showPicker() {
                                if (picker) {
                                    return;
                                }
                                // create picker element
            Severity: Minor
            Found in myems-admin/js/plugins/datapicker/angular-datepicker.js - About 1 hr to fix

              Function update has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                              function update() {
                                  var view = scope.view;
                                  datePickerUtils.setParams(tz, firstDay);
              
                                  if (scope.model && !arrowClick) {
              Severity: Minor
              Found in myems-admin/js/plugins/datapicker/angular-datepicker.js - About 1 hr to fix

                Function createNewDate has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        var createNewDate = function (year, month, day, hour, minute) {
                Severity: Minor
                Found in myems-admin/js/plugins/datapicker/angular-datepicker.js - About 35 mins to fix

                  Function getTemplate has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          function getTemplate(attrs, id, model, min, max) {
                  Severity: Minor
                  Found in myems-admin/js/plugins/datapicker/angular-datepicker.js - About 35 mins to fix

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

                                "<div ng-switch=\"view\">\r" +
                                "\n" +
                                "  <div ng-switch-when=\"date\">\r" +
                                "\n" +
                                "    <table>\r" +
                    Severity: Major
                    Found in myems-admin/js/plugins/datapicker/angular-datepicker.js and 1 other location - About 1 hr to fix
                    myems-admin/js/plugins/daterangepicker/daterangepicker.js on lines 47..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 69.

                    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

                                    function setMin(date) {
                                        minDate = date;
                                        attrs.minDate = date ? date.format() : date;
                                        minValid = moment.isMoment(date);
                                    }
                    Severity: Major
                    Found in myems-admin/js/plugins/datapicker/angular-datepicker.js and 1 other location - About 1 hr to fix
                    myems-admin/js/plugins/datapicker/angular-datepicker.js on lines 800..804

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

                    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

                                    function setMax(date) {
                                        maxDate = date;
                                        attrs.maxDate = date ? date.format() : date;
                                        maxValid = moment.isMoment(date);
                                    }
                    Severity: Major
                    Found in myems-admin/js/plugins/datapicker/angular-datepicker.js and 1 other location - About 1 hr to fix
                    myems-admin/js/plugins/datapicker/angular-datepicker.js on lines 794..798

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

                    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 (angular.isDefined(data.minDate)) {
                                                    minDate = data.minDate ? data.minDate : false;
                                                    updateViewData = true;
                                                }
                    Severity: Minor
                    Found in myems-admin/js/plugins/datapicker/angular-datepicker.js and 1 other location - About 35 mins to fix
                    myems-admin/js/plugins/datapicker/angular-datepicker.js on lines 341..344

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

                    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 (angular.isDefined(data.maxDate)) {
                                                    maxDate = data.maxDate ? data.maxDate : false;
                                                    updateViewData = true;
                                                }
                    Severity: Minor
                    Found in myems-admin/js/plugins/datapicker/angular-datepicker.js and 1 other location - About 35 mins to fix
                    myems-admin/js/plugins/datapicker/angular-datepicker.js on lines 337..340

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

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

                                isSameMonth: function (model, date) {
                                    return this.isSameYear(model, date) && model.month() === date.month();
                                },
                    Severity: Major
                    Found in myems-admin/js/plugins/datapicker/angular-datepicker.js and 3 other locations - About 35 mins to fix
                    myems-admin/js/plugins/datapicker/angular-datepicker.js on lines 519..521
                    myems-admin/js/plugins/datapicker/angular-datepicker.js on lines 522..524
                    myems-admin/js/plugins/datapicker/angular-datepicker.js on lines 525..527

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

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

                                isSameHour: function (model, date) {
                                    return this.isSameDay(model, date) && model.hours() === date.hours();
                                },
                    Severity: Major
                    Found in myems-admin/js/plugins/datapicker/angular-datepicker.js and 3 other locations - About 35 mins to fix
                    myems-admin/js/plugins/datapicker/angular-datepicker.js on lines 516..518
                    myems-admin/js/plugins/datapicker/angular-datepicker.js on lines 519..521
                    myems-admin/js/plugins/datapicker/angular-datepicker.js on lines 525..527

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

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

                                isSameDay: function (model, date) {
                                    return this.isSameMonth(model, date) && model.date() === date.date();
                                },
                    Severity: Major
                    Found in myems-admin/js/plugins/datapicker/angular-datepicker.js and 3 other locations - About 35 mins to fix
                    myems-admin/js/plugins/datapicker/angular-datepicker.js on lines 516..518
                    myems-admin/js/plugins/datapicker/angular-datepicker.js on lines 522..524
                    myems-admin/js/plugins/datapicker/angular-datepicker.js on lines 525..527

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

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

                                isSameMinutes: function (model, date) {
                                    return this.isSameHour(model, date) && model.minutes() === date.minutes();
                                },
                    Severity: Major
                    Found in myems-admin/js/plugins/datapicker/angular-datepicker.js and 3 other locations - About 35 mins to fix
                    myems-admin/js/plugins/datapicker/angular-datepicker.js on lines 516..518
                    myems-admin/js/plugins/datapicker/angular-datepicker.js on lines 519..521
                    myems-admin/js/plugins/datapicker/angular-datepicker.js on lines 522..524

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

                    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