gadael/gadael

View on GitHub
public/js/services/calendar.js

Summary

Maintainability
F
5 days
Test Coverage

Function loadCalendarService has 298 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    return function loadCalendarService($locale, $q, $routeParams) {

        /**
         * Object for calendar day
         */
Severity: Major
Found in public/js/services/calendar.js - About 1 day to fix

    File calendar.js has 303 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    define(['moment'], function(moment) {
        'use strict';
    
        return function loadCalendarService($locale, $q, $routeParams) {
    
    
    Severity: Minor
    Found in public/js/services/calendar.js - About 3 hrs to fix

      Function initNextPrevious has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function initNextPrevious($scope, calendarEventsResource, personalEventsResource, requestsResource) {
      
                  var year, month, now = new Date();
                  var routeSet = false;
      
      
      Severity: Major
      Found in public/js/services/calendar.js - About 2 hrs to fix

        Function addEvents has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                function addEvents(cal, fromDate, toDate, calendarEventsResource, personalEventsResource, user)
                {
                    function admComp(params) {
                        if (undefined !== user) {
                            params.user = user._id;
        Severity: Minor
        Found in public/js/services/calendar.js - About 1 hr to fix

          Function addEvent has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function addEvent(cal, event, typeProperty)
                  {
                      function inEvents(events)
                      {
                          for (var i=0; i<events.length; i++) {
          Severity: Minor
          Found in public/js/services/calendar.js - About 1 hr to fix

            Function addToCalendar has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    function addToCalendar(calendar, loopDate, endDate, startDate)
                    {
                        var weekprop, id, lastid, monthid;
            
                        while (loopDate < endDate) {
            Severity: Minor
            Found in public/js/services/calendar.js - About 1 hr to fix

              Function addEvents has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      function addEvents(cal, fromDate, toDate, calendarEventsResource, personalEventsResource, user)
              Severity: Minor
              Found in public/js/services/calendar.js - About 45 mins to fix

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

                        function createCalendar(year, month, calendarEventsResource, personalEventsResource, user) {
                Severity: Minor
                Found in public/js/services/calendar.js - About 35 mins to fix

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

                          function setMonthView(cal, startDate, calendarEventsResource, personalEventsResource, user) {
                  Severity: Minor
                  Found in public/js/services/calendar.js - About 35 mins to fix

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

                                $scope.previousMonth = function previousMonth() {
                                    if (!$scope.isLoading) {
                                        $scope.isLoading = true;
                                        var startDate = getCalendarFirstDayInMonth($scope.cal.calendar);
                                        startDate.setMonth(startDate.getMonth() - 1);
                    Severity: Major
                    Found in public/js/services/calendar.js and 1 other location - About 6 hrs to fix
                    public/js/services/calendar.js on lines 419..433

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

                    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

                                $scope.nextMonth = function nextMonth() {
                                    if (!$scope.isLoading) {
                                        $scope.isLoading = true;
                                        var startDate = getCalendarFirstDayInMonth($scope.cal.calendar);
                                        startDate.setMonth(startDate.getMonth() + 1);
                    Severity: Major
                    Found in public/js/services/calendar.js and 1 other location - About 6 hrs to fix
                    public/js/services/calendar.js on lines 403..417

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

                    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

                            Day.prototype.isScheduled = function()
                            {
                                return (this.workschedule.length > 0 && this.events.length === 0 && this.nonworkingday.length === 0);
                            };
                    Severity: Major
                    Found in public/js/services/calendar.js and 1 other location - About 1 hr to fix
                    public/js/services/calendar.js on lines 40..43

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

                    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

                            Day.prototype.isNotScheduled = function()
                            {
                                return (this.workschedule.length === 0 && this.events.length === 0 && this.nonworkingday.length === 0);
                            };
                    Severity: Major
                    Found in public/js/services/calendar.js and 1 other location - About 1 hr to fix
                    public/js/services/calendar.js on lines 35..38

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

                    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

                            Day.prototype.isEnd = function(event)
                            {
                                return (event.dtend > this.boundaries.start &&
                                        event.dtend <= this.boundaries.end);
                            };
                    Severity: Major
                    Found in public/js/services/calendar.js and 1 other location - About 1 hr to fix
                    public/js/services/calendar.js on lines 61..65

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

                    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

                            Day.prototype.isStart = function(event)
                            {
                                return (event.dtstart >= this.boundaries.start &&
                                        event.dtstart < this.boundaries.end);
                            };
                    Severity: Major
                    Found in public/js/services/calendar.js and 1 other location - About 1 hr to fix
                    public/js/services/calendar.js on lines 72..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 64.

                    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 (undefined !== $routeParams.month) {
                                    month = parseInt($routeParams.month, 10);
                                    routeSet = true;
                                } else {
                                    month = now.getMonth();
                    Severity: Major
                    Found in public/js/services/calendar.js and 1 other location - About 1 hr to fix
                    public/js/services/calendar.js on lines 385..390

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

                    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 (undefined !== $routeParams.year) {
                                    year = parseInt($routeParams.year, 10);
                                    routeSet = true;
                                } else {
                                    year = now.getFullYear();
                    Severity: Major
                    Found in public/js/services/calendar.js and 1 other location - About 1 hr to fix
                    public/js/services/calendar.js on lines 392..397

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

                    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