gadael/gadael

View on GitHub

Showing 364 of 761 total issues

Avoid deeply nested control flow statements.
Open

                                    if ($scope.accountScheduleCalendars[i].from) {
                                        $scope.accountScheduleCalendars[i].from = new Date($scope.accountScheduleCalendars[i].from);
                                    }
Severity: Major
Found in public/js/controllers/admin/account-schedulecalendars-edit.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                        if ($scope.accountCollections[i].to) {
                                            $scope.accountCollections[i].to = new Date($scope.accountCollections[i].to);
                                        }
    Severity: Major
    Found in public/js/controllers/admin/account-collections-edit.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                          if ($scope.accountNWDaysCalendars[i].from) {
                                              $scope.accountNWDaysCalendars[i].from = new Date($scope.accountNWDaysCalendars[i].from);
                                          }
      Severity: Major
      Found in public/js/controllers/admin/account-nwdayscalendars-edit.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                            if (adjustedRenewals[id].adjustmentSum !== 0) {
                                                $scope.adjustedRenewals.push(adjustedRenewals[id]);
                                            }
        Severity: Major
        Found in public/js/controllers/admin/user-view.js - About 45 mins 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

            Avoid deeply nested control flow statements.
            Open

                                                if ($scope.accountNWDaysCalendars[i].to) {
                                                    $scope.accountNWDaysCalendars[i].to = new Date($scope.accountNWDaysCalendars[i].to);
                                                }
            Severity: Major
            Found in public/js/controllers/admin/account-nwdayscalendars-edit.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                                  if ($scope.accountCollections[i].from) {
                                                      $scope.accountCollections[i].from = new Date($scope.accountCollections[i].from);
                                                  }
              Severity: Major
              Found in public/js/controllers/admin/account-collections-edit.js - About 45 mins to fix

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

                api.createRandomAbsence = function(app, user, dtstart, dtend, nbdays, timeCreated) {
                Severity: Minor
                Found in api/Request.api.js - About 45 mins to fix

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

                  api.createRandomAccountRequest = function(app, collectionProps, rightProps, dtstart, dtend, nbdays) {
                  Severity: Minor
                  Found in api/User.api.js - About 45 mins to fix

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

                    exports = module.exports = function(models, userDocument, account, admin, manager, callback){
                    Severity: Minor
                    Found in modules/roles.js - About 45 mins to fix

                      Function query has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      var query = function(service, params, next) {
                      
                      
                      
                          let find = service.app.db.models.User.find()
                      Severity: Minor
                      Found in api/services/admin/users/list.js - About 45 mins to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

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

                      function getConsumedQuantityBetween(user, types, periods, quantityUnit, renewal, cap) {
                      Severity: Minor
                      Found in modules/consumptionHistory.js - About 45 mins to fix

                        Function getExpandedEra has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function getExpandedEra(docs, dtstart, dtend)
                        {
                        
                            if (!(dtstart instanceof Date) || !(dtend instanceof Date)) {
                                throw new Error('parameters must be dates');
                        Severity: Minor
                        Found in modules/getExpandedEra.js - About 45 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

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

                        api.createAbsenceOnRenewal = function(app, renewal, user, dtstart, dtend, nbdays) {
                        Severity: Minor
                        Found in api/Request.api.js - About 45 mins to fix

                          Function exports has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                          exports = module.exports = function(services, app) {
                          
                              var service = new services.list(app);
                          
                          
                          
                          Severity: Minor
                          Found in api/services/admin/beneficiaries/list.js - About 45 mins to fix

                          Cognitive Complexity

                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                          A method's cognitive complexity is based on a few simple rules:

                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                          • Code is considered more complex for each "break in the linear flow of the code"
                          • Code is considered more complex when "flow breaking structures are nested"

                          Further reading

                          Consider simplifying this complex logical expression.
                          Open

                                          if (!match[1] || !match[2] || !match[3] || !match[4] || !match[5] || !match[6]) {
                                              // Require at least year mont day hour minute second
                                              continue;
                                          }
                          Severity: Major
                          Found in public/js/jsondates.js - About 40 mins to fix

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

                                rightRuleSchema.methods.validateRule = function(renewal, user, dtstart, dtend, moment) {
                            Severity: Minor
                            Found in schema/Right_Rule.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

                                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 validateRules has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      rightSchema.methods.validateRules = function(renewal, user, dtstart, dtend, timeCreated) {
                                  Severity: Minor
                                  Found in schema/Right.js - About 35 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language