linagora/openpaas-esn

View on GitHub

Showing 726 of 2,177 total issues

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

function list(options) {
  var defer = q.defer();
  var query = {};

  if (options.type) {
Severity: Minor
Found in backend/core/resource-link/index.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 canReply has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

module.exports.canReply = function(message, user, callback) {
  if (!message || !user) {
    return callback(new Error('Message and user are required'));
  }

Severity: Minor
Found in backend/core/message/permission.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 json['gd:email'][0].$.address.replace('mailto:', '');
Severity: Major
Found in modules/linagora.esn.contact.import.google/backend/lib/mapping.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return json['gContact:nickname'][0];
    Severity: Major
    Found in modules/linagora.esn.contact.import.google/backend/lib/mapping.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return res.status(400).json({
                error: {
                  code: 400,
                  message: 'Bad Request',
                  details: 'openpaas:source is required for subscription'

        Avoid too many return statements within this function.
        Open

              return json['gd:phoneNumber'][0].$.uri.replace('tel:', '');
        Severity: Major
        Found in modules/linagora.esn.contact.import.google/backend/lib/mapping.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return contact.nickname;
          Severity: Major
          Found in modules/linagora.esn.contact/frontend/app/contact/helper.service.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return getFormattedAddress(contact.addresses[0]);
            Severity: Major
            Found in modules/linagora.esn.contact/frontend/app/contact/helper.service.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return contact.urls[0].value;
              Severity: Major
              Found in modules/linagora.esn.contact/frontend/app/contact/helper.service.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return contact.tags[0].text;
                Severity: Major
                Found in modules/linagora.esn.contact/frontend/app/contact/helper.service.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return contact.notes;
                  Severity: Major
                  Found in modules/linagora.esn.contact/frontend/app/contact/helper.service.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return contact.orgRole;
                    Severity: Major
                    Found in modules/linagora.esn.contact/frontend/app/contact/helper.service.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return esnDatetimeService.formatMediumDate(contact.birthday);
                      Severity: Major
                      Found in modules/linagora.esn.contact/frontend/app/contact/helper.service.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                  return email;
                        Severity: Major
                        Found in modules/linagora.esn.contact/frontend/app/contact/helper.service.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                    return tel;
                          Severity: Major
                          Found in modules/linagora.esn.contact/frontend/app/contact/helper.service.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                      return social;
                            Severity: Major
                            Found in modules/linagora.esn.contact/frontend/app/contact/helper.service.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                  return getGeneratedAvatar(req, res);
                              Severity: Major
                              Found in backend/webserver/controllers/avatars.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                  return composableMW([
                                    requiresCollaborationMember,
                                    targetUserCanBeRemoved
                                  ])(req, res, next);
                                Severity: Major
                                Found in backend/webserver/middleware/collaboration.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                    return res.status(400).json({ error: { code: 400, message: 'Bad request', details: 'Unknown objectType parameter'}});
                                  Severity: Major
                                  Found in backend/webserver/controllers/avatars.js - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                        return targetUserCanBeRemoved(req, res, next);
                                    Severity: Major
                                    Found in backend/webserver/middleware/collaboration.js - About 30 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language