gadael/gadael

View on GitHub

Showing 364 of 761 total issues

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

    app.checkPathOnRequest = function(ctrl) {
        const req = ctrl.req;
        const gt = req.app.utility.gettext;

        const adminResource     = 0 === ctrl.path.indexOf('/rest/admin/') || 0 === ctrl.path.indexOf('/api/admin/');
Severity: Minor
Found in modules/apputil.js - About 1 hr to fix

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

    exports = module.exports = function(services, app) {
    
        var service = new services.get(app);
    
        const gt = app.utility.gettext;
    Severity: Minor
    Found in api/services/admin/beneficiaries/get.js - About 1 hr to fix

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

      exports = module.exports = function(services, app) {
      
          var service = new services.list(app);
      
          /**
      Severity: Minor
      Found in api/services/manager/waitingrequests/list.js - About 1 hr to fix

        Function getInfos has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        exports.getInfos = function(req, res) {
        
        
            let gt = req.app.utility.gettext;
        
        
        Severity: Minor
        Found in rest/Common.js - About 1 hr 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 pagedFindPlugin has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        module.exports = exports = function pagedFindPlugin (schema) {
          schema.statics.pagedFind = function(options, cb) {
            var thisSchema = this;
        
            if (!options.filters) {
        Severity: Minor
        Found in schema/plugins/pagedFind.js - About 1 hr 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 getUserRequests has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        function getUserRequests(user, from, to, types) {
        
            let calendar;
        
        
        
        Severity: Minor
        Found in api/services/admin/exports/sage.js - About 1 hr 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 createRandomAbsence has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        api.createRandomAbsence = function(app, user, dtstart, dtend, nbdays, timeCreated) {
        
            function createOnRight(rightDocument) {
                return rightDocument.getPeriodRenewal(dtstart, dtend)
        
        
        Severity: Minor
        Found in api/Request.api.js - About 1 hr 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 saveUser has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        function saveUser(service, params) {
        
            const gt = service.app.utility.gettext;
        
            let User = service.app.db.models.User;
        Severity: Minor
        Found in api/services/admin/users/save.js - About 1 hr 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 testRequired has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        function testRequired(wrParams, workperiodRecoveryByApprover)
        {
            if (undefined === wrParams.quantity || wrParams.quantity <= 0) {
                throw new Error('The quantity parameter must be positive number');
            }
        Severity: Minor
        Found in api/services/user/requests/saveWorkperiodRecover.js - About 1 hr 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 controllerAction has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            this.controllerAction = function() {
                getInvitation(controller, controller.req.params.emailToken)
                .then(document => {
        
                    let invitation = document.toObject();
        Severity: Minor
        Found in rest/anonymous/invitation.js - About 1 hr to fix

          Function getSavingPeriod has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              rightRenewalSchema.methods.getSavingPeriod = function(right) {
          
                  if (undefined === right || null === right) {
                      if (undefined !== this.populated('right')) {
                          right = this.right;
          Severity: Minor
          Found in schema/Right_Renewal.js - About 1 hr to fix

            Function saveAccount has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                userSchema.methods.saveAccount = function(accountProperties) {
            
                    let userDocument = this;
            
                    return new Promise((resolve, reject) => {
            Severity: Minor
            Found in schema/User.js - About 1 hr to fix

              Function saveAdmin has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  userSchema.methods.saveAdmin = function(adminProperties) {
              
                      let userDocument = this;
              
                      return new Promise((resolve, reject) => {
              Severity: Minor
              Found in schema/User.js - About 1 hr to fix

                Function saveManager has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    userSchema.methods.saveManager = function(managerProperties) {
                
                        let userDocument = this;
                
                        return new Promise((resolve, reject) => {
                Severity: Minor
                Found in schema/User.js - About 1 hr to fix

                  Function exports has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  exports = module.exports = function(app) {
                  
                      let config = app.config;
                  
                      return function(req, res, next) {
                  Severity: Minor
                  Found in modules/gadaelMiddleware.js - About 1 hr to fix

                    Function populate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    api.populate = function(app, department, nbUsers, password) {
                    
                        const Charlatan = require('charlatan');
                        let userApi = require('./User.api');
                    
                    
                    Severity: Minor
                    Found in api/Department.api.js - About 1 hr to fix

                      Function useLocalStrategy has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function useLocalStrategy(username, password, done) {
                      
                              let conditions = {
                                  isActive: true,
                                  email: username
                      Severity: Minor
                      Found in modules/passport.js - About 1 hr to fix

                        Function setRenewal has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                function setRenewal(renewalDocument, stat) {
                        
                                    let renewalObj = renewalDocument.toObject();
                                    renewalObj.initial_quantity = stat.initial;
                                    renewalObj.consumed_quantity = stat.consumed;
                        Severity: Minor
                        Found in api/services/user/accountbeneficiaries/renewals.js - About 1 hr to fix

                          Function exports has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          exports = module.exports = function(services, app) {
                          
                              let service = new services.list(app);
                          
                              const gt = app.utility.gettext;
                          Severity: Minor
                          Found in api/services/user/googlecalendars/list.js - About 1 hr to fix

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

                                managerSchema.methods.getManagedDepartments = function() {
                            
                                    var deferred = {};
                                    deferred.promise = new Promise(function(resolve, reject) {
                                        deferred.resolve = resolve;
                            Severity: Minor
                            Found in schema/User_Manager.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language