gadael/gadael

View on GitHub

Showing 364 of 761 total issues

Function createElement has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function createElement(service, user, elem, collection, setElemProperties)
{

    if (undefined === elem.right) {
        throw new Error('element must contain a right property');
Severity: Minor
Found in api/services/user/requests/saveAbsence.js - About 35 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 isDbNameValid has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    isDbNameValid: function isDbNameValid(app, dbName, callback) {


        if (!dbName.match(/[a-z0-9]+/gi) || dbName.length <= 2 || dbName.length > 100)
        {
Severity: Minor
Found in api/Company.api.js - About 35 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 exports has a Cognitive Complexity of 7 (exceeds 5 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 35 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

Avoid too many return statements within this function.
Open

            return elem.getLength();
Severity: Major
Found in schema/Right.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return Promise.reject('Unexpected consumption type '+right.consumption);
    Severity: Major
    Found in schema/Right.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                          return 'has-warning';
      Severity: Major
      Found in public/js/services/absence-edit.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        return 'has-success';
        Severity: Major
        Found in public/js/services/absence-edit.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          return {
                              created: 'accepted',
                              deleted: null
                          };
          Severity: Major
          Found in schema/Request.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                            return null;
            Severity: Major
            Found in schema/Right.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return service.error(gt.gettext('either departments or collections must contain items'));
              Severity: Major
              Found in api/services/admin/compulsoryleaves/save.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return true;
                Severity: Major
                Found in modules/testoverlap.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return false;
                  Severity: Major
                  Found in modules/apputil.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return true;
                    Severity: Major
                    Found in modules/apputil.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                                  return;
                      Severity: Major
                      Found in api/services/manager/waitingrequests/save.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return Promise.reject(new Error('Wrong parameter type for user or account'));
                        Severity: Major
                        Found in api/services/user/accountbeneficiaries/list.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return true;
                          Severity: Major
                          Found in api/services/user/calendarevents/list.js - About 30 mins to fix

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

                            exports = module.exports = function(params) {
                            
                                var mongoose = params.mongoose;
                            
                                var beneficiarySchema = new params.mongoose.Schema({
                            Severity: Minor
                            Found in schema/Beneficiary.js - About 25 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 saveUserRoles has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function saveUserRoles(service, params, userDocument) {
                            
                                const gt = service.app.utility.gettext;
                            
                                if (!userDocument) {
                            Severity: Minor
                            Found in api/services/admin/users/save.js - About 25 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function getConsumedQuantityBetween(user, types, periods, quantityUnit, renewal, cap) {
                            
                                /**
                                 * test if element match at least one period in list
                                 * @return {boolean}
                            Severity: Minor
                            Found in modules/consumptionHistory.js - About 25 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 getStrategy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            exports = module.exports = function getStrategy(config) {
                            
                                if (undefined === config.company || null === config.company || undefined === config.company.calendar || undefined === config.company.calendar.google) {
                                    throw new Error('Wrong company configuration');
                                }
                            Severity: Minor
                            Found in modules/gcalstrategy.js - About 25 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

                            Severity
                            Category
                            Status
                            Source
                            Language