gadael/gadael

View on GitHub

Showing 761 of 761 total issues

Function requestEdit has 181 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    return function requestEdit(gettextCatalog) {
        /**
         * Duration in milliseconds updated on every period changes
         * @var {int}
         */
Severity: Major
Found in public/js/services/request-edit.js - About 7 hrs to fix

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

    exports = module.exports = function(params) {
    
        var mongoose = params.mongoose;
    
        var eventSchema = new mongoose.Schema({
    Severity: Major
    Found in schema/CalendarEvent.js - About 7 hrs to fix

      File absence-edit.js has 448 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      define(['angular', 'services/request-edit'], function(angular, loadRequestEdit) {
          'use strict';
      
          return function(gettextCatalog) {
              var RequestEdit = loadRequestEdit(gettextCatalog);
      Severity: Minor
      Found in public/js/services/absence-edit.js - About 6 hrs to fix

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

            rightRuleSchema.methods.validateSeniority = function(dtstart, dtend, user) {
        
                if (undefined === user.populated('roles.account')) {
                    throw new Error('The roles.account field need to be populated');
                }
        Severity: Major
        Found in schema/Right_Rule.js and 1 other location - About 6 hrs to fix
        schema/Right_Rule.js on lines 308..335

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

        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

            rightRuleSchema.methods.validateAge = function(dtstart, dtend, user) {
        
                if (undefined === user.populated('roles.account')) {
                    throw new Error('The roles.account field need to be populated');
                }
        Severity: Major
        Found in schema/Right_Rule.js and 1 other location - About 6 hrs to fix
        schema/Right_Rule.js on lines 355..381

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

        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

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

        exports = module.exports = function(services, app) {
        
            let service = new services.list(app);
        
            let collaborators = {};
        Severity: Major
        Found in api/services/user/collaborators/list.js - About 6 hrs to fix

          File Company.api.js has 428 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          'use strict';
          
          const models = require('../models');
          const helmet = require('helmet');
          const routes = require('../rest/routes');
          Severity: Minor
          Found in api/Company.api.js - About 6 hrs to fix

            Function getInfos has 155 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            exports.getInfos = function(req, res) {
            
            
                let gt = req.app.utility.gettext;
            
            
            Severity: Major
            Found in rest/Common.js - About 6 hrs 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

              Function pages has 153 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              exports = module.exports = function pages(server) {
              
                  function createUser() {
                      return new Promise((resolve, reject) => {
                          server.post('/rest/admin/users', {
              Severity: Major
              Found in doc/create_screenshots/pages.js - About 6 hrs to fix

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

                    rightSchema.methods.addCollectionBeneficiary = function addCollectionBeneficiary(collection) {
                        let model = this.model('Beneficiary');
                
                        let id = collection;
                        if (undefined !== collection._id) {
                Severity: Major
                Found in schema/Right.js and 1 other location - About 6 hrs to fix
                schema/Right.js on lines 490..507

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

                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

                    rightSchema.methods.addUserBeneficiary = function addUserBeneficiary(user) {
                        let model = this.model('Beneficiary');
                
                        let id = user;
                        if (undefined !== user._id) {
                Severity: Major
                Found in schema/Right.js and 1 other location - About 6 hrs to fix
                schema/Right.js on lines 463..480

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

                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

                            getRefreshToken: (refreshToken) => {
                                return app.db.models.User
                                .findOne({ 'api.refreshToken': refreshToken }, 'api')
                                .exec()
                                .then(user => {
                Severity: Major
                Found in modules/oauth.js and 1 other location - About 5 hrs to fix
                modules/oauth.js on lines 122..140

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

                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

                            getAuthorizationCode: (authorizationCode) => {
                                return app.db.models.User
                                .findOne({ 'api.authorizationCode': authorizationCode }, 'api')
                                .exec()
                                .then(user => {
                Severity: Major
                Found in modules/oauth.js and 1 other location - About 5 hrs to fix
                modules/oauth.js on lines 100..118

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

                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

                File Calendar.js has 412 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                'use strict';
                
                const ical = require('ical');
                const util = require('util');
                const latinize = require('latinize');
                Severity: Minor
                Found in schema/Calendar.js - About 5 hrs to fix

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

                  var asyncAdminTask = function(models, userDocument, roleProperties) {
                  
                      var checkedRole = (null !== roleProperties);
                  
                      return function(asyncTaskEnd) {
                  Severity: Major
                  Found in modules/roles.js and 1 other location - About 5 hrs to fix
                  modules/roles.js on lines 159..183

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

                  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

                  var asyncManagerTask = function(models, userDocument, roleProperties) {
                  
                      var checkedRole = (null !== roleProperties);
                  
                      return function(asyncTaskEnd) {
                  Severity: Major
                  Found in modules/roles.js and 1 other location - About 5 hrs to fix
                  modules/roles.js on lines 118..142

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

                  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

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

                  exports = module.exports = function(params) {
                  
                      const mongoose = params.mongoose;
                  
                      const ruleTypes = [
                  Severity: Minor
                  Found in schema/Right_Rule.js - About 5 hrs 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 exports has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                  Open

                  exports = module.exports = function(app, passport) {
                  
                      let loginservices = app.config.company.loginservices;
                      let User = app.db.models.User;
                      let gt = app.utility.gettext;
                  Severity: Minor
                  Found in modules/passport.js - About 5 hrs 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

                  Severity
                  Category
                  Status
                  Source
                  Language