linagora/openpaas-esn

View on GitHub

Showing 726 of 2,177 total issues

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

    function searchCard(options) {
      if (!options) {
        return $q.reject('Missing options');
      }

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

      function DisplayShellProvider(ContactDisplayShell) {
    
        var displayShellsRegistered = [];
    
        return {

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

        function contactActionMoveController(
          _,
          asyncAction,
          contactAddressbookDisplayService,
          contactAddressbookService,

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

        function createPlatformAdmin(req, res) {
          const { type, data } = req.body;
          const addPlatformAdminHandlers = {
            email: corePlatformAdmin.addPlatformAdminByEmail,
            id: corePlatformAdmin.addPlatformAdminById
        Severity: Minor
        Found in backend/webserver/controllers/platformadmins.js - About 1 hr to fix

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

          function getOne(req, res) {
            if (!req.params.id) {
              return res.status(400).json({ error: { code: 400, message: 'Bad request', details: 'Message ID is required'}});
            }
          
          
          Severity: Minor
          Found in backend/webserver/controllers/messages.js - About 1 hr to fix

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

            function _requiresAPILoginAndFailWithError(failWithError = false) {
              return (req, res, next) => {
                if (req.isAuthenticated()) {
                  return next();
                }
            Severity: Minor
            Found in backend/webserver/middleware/authorization.js - About 1 hr to fix

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

              function removeMembershipRequest(req, res) {
                if (!req.isCollaborationManager && !req.user._id.equals(req.params.user_id)) {
                  return res.status(403).json({error: {code: 403, message: 'Forbidden', details: 'Current user is not the target user'}});
                }
              
              
              Severity: Minor
              Found in backend/webserver/controllers/collaborations.js - About 1 hr to fix

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

                exports = module.exports = function(application) {
                  application.all('/api/*', cors({origin: true, credentials: true}));
                
                  application.use(require('./middleware/modules'));
                
                
                Severity: Minor
                Found in backend/webserver/routes.js - About 1 hr to fix

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

                  function requireDomainInfo(req, res, next) {
                    let details;
                  
                    if (!req.body.name) {
                      details = 'Domain does not have name';
                  Severity: Minor
                  Found in backend/webserver/middleware/domain.js - About 1 hr to fix

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

                    function profile(req, res) {
                      var uuid = req.params.uuid;
                      const denormalizeOptions = {
                        includeIsFollowing: true,
                        includeFollow: true,
                    Severity: Minor
                    Found in backend/webserver/controllers/users.js - About 1 hr to fix

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

                      function updateClient(callback) {
                        return getConfig().then(config => {
                          const hash = getConfigurationHash(config);
                      
                          if (hash === currentClientHash) {
                      Severity: Minor
                      Found in backend/core/elasticsearch/elasticsearch.js - About 1 hr to fix

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

                        function upsertUserAccount(user, account, callback) {
                          var status = 'created';
                        
                          function accountExists(userAccount) {
                            return userAccount.type === account.type && userAccount.data && userAccount.data.provider === account.data.provider && userAccount.data.id === account.data.id;
                        Severity: Minor
                        Found in backend/core/oauth/helpers.js - About 1 hr to fix

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

                          function createClient(options, callback) {
                            var redisConfig = getRedisConfiguration(options);
                          
                            var client = redisConfig.client || require('redis').createClient(redisConfig.port || redisConfig.socket, redisConfig.host, redisConfig);
                            if (redisConfig.pass) {
                          Severity: Minor
                          Found in backend/core/db/redis/index.js - About 1 hr to fix

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

                            function index(data, options, callback) {
                            
                              function _index() {
                                const indexOptions = {
                                  denormalize: options.denormalize || function(data) {return data;},
                            Severity: Minor
                            Found in backend/core/elasticsearch/listeners.js - About 1 hr to fix

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

                                  function link(scope, element, attrs) {
                                    scope.updateMembers = updateMembers;
                                    scope.inSlicesOf = attrs.inSlicesOf && angular.isNumber(parseInt(attrs.inSlicesOf, 10)) ?
                                      parseInt(attrs.inSlicesOf, 10) : 3;
                                    scope.error = false;

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

                                    function link(scope) {
                                      scope.additionalData = {
                                        pollChoices: angular.copy(ESN_MESSAGE_DEFAULT_POLL_CHOICES)
                                      };
                                
                                
                                Severity: Minor
                                Found in frontend/js/modules/message.js - About 1 hr to fix

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

                                      PageAggregatorService.prototype.loadNextItems = function() {
                                  
                                        var self = this;
                                        var result = [];
                                        var isFirstPage = self.isFirstPage;
                                  Severity: Minor
                                  Found in frontend/js/modules/aggregator.js - About 1 hr to fix

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

                                      function searchRouter($stateProvider) {
                                        $stateProvider
                                          .state('search', {
                                            url: '/search',
                                            abstract: true,
                                    Severity: Minor
                                    Found in frontend/js/modules/search/search.router.js - About 1 hr to fix

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

                                      module.exports = function(dependencies) {
                                      
                                        var arrayHelper = dependencies('helpers').array;
                                      
                                        function getLastResponse(message) {
                                      Severity: Minor
                                      Found in modules/linagora.esn.digest.daily/lib/weight/strategies/date.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 canRead has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      module.exports.canRead = function(timelineEntry, tuple, callback) {
                                        if (!timelineEntry || !tuple) {
                                          return callback(new Error('timelineEntry and tuple are required'));
                                        }
                                      
                                      
                                      Severity: Minor
                                      Found in backend/core/activitystreams/permission.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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language