linagora/openpaas-esn

View on GitHub
modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js

Summary

Maintainability
F
1 wk
Test Coverage

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

module.exports = function(dependencies) {
  const logger = dependencies('logger');
  const contactModule = dependencies('contact');
  const proxy = require('../proxy')(dependencies)(PATH);
  const avatarHelper = require('./avatarHelper')(dependencies);

    File controller.js has 434 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    
    const q = require('q');
    const PATH = 'addressbooks';
    
    

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

      module.exports = function(dependencies) {
        const logger = dependencies('logger');
        const contactModule = dependencies('contact');
        const proxy = require('../proxy')(dependencies)(PATH);
        const avatarHelper = require('./avatarHelper')(dependencies);

      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 _searchContacts has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function _searchContacts(options) {
          const clientOptions = {
            ESNToken: options.ESNToken,
            davserver: options.davserver
          };

        Function updateContact has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function updateContact(req, res) {
            var headers = req.headers || {};
        
            headers.ESNToken = req.token && req.token.token ? req.token.token : '';
        
        

          Function getContactsFromDAV has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function getContactsFromDAV(req, res) {
              var options = {
                ESNToken: req.token && req.token.token ? req.token.token : '',
                davserver: req.davserver
              };

            Function getContacts has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function getContacts(req, res) {
                if (req.query.search) {
                  const options = {
                    user: req.user,
                    search: req.query.search,

              Function getAddressbook has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function getAddressbook(req, res) {
                  var options = {
                    ESNToken: req.token && req.token.token ? req.token.token : '',
                    davserver: req.davserver
                  };

                Function searchContacts has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function searchContacts(req, res) {
                    const options = {
                      user: req.user,
                      search: req.query.search,
                      limit: req.query.limit,

                  Function createAddressbook has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function createAddressbook(req, res) {
                      const options = {
                        ESNToken: req.token && req.token.token ? req.token.token : '',
                        davserver: req.davserver
                      };

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

                      function getAddressbooks(req, res) {
                        var options = {
                          ESNToken: req.token && req.token.token ? req.token.token : '',
                          davserver: req.davserver
                        };

                      Function onSuccess has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                            onSuccess: function(response, data, req, res, callback) {

                        Function onError has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                              onError: function(response, data, req, res, callback) {

                          Function onError has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                  onError: function(response, data, req, res, callback) {

                            Function onSuccess has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                    onSuccess: function(response, data, req, res, callback) {

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

                                  return _searchContacts(options)
                                    .then(result => {
                                      res.header('X-ESN-Items-Count', result.total_count);
                              
                                      return res.status(200).json(result.data);
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 283..301

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

                              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

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

                                    return _searchContacts(options)
                                      .then(result => {
                                        res.header('X-ESN-Items-Count', result.total_count);
                              
                                        return res.status(200).json(result.data);
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 352..370

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

                              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

                                return {
                                  createAddressbook,
                                  defaultHandler,
                                  deleteContact,
                                  getAddressbook,
                              frontend/js/modules/domain.js on lines 6..20

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

                              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 3 locations. Consider refactoring.
                              Open

                                  contactModule.lib.client(options)
                                    .addressbookHome(req.params.bookHome)
                                    .addressbook(req.params.bookName)
                                    .vcard(req.params.contactId)
                                    .move(destAddressbook)
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 170..174
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 209..213

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

                              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 3 locations. Consider refactoring.
                              Open

                                  contactModule.lib.client(options)
                                    .addressbookHome(req.params.bookHome)
                                    .addressbook(req.params.bookName)
                                    .vcard(req.params.contactId)
                                    .get()
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 209..213
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 314..318

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

                              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 3 locations. Consider refactoring.
                              Open

                                    contactModule.lib.client(options)
                                      .addressbookHome(req.params.bookHome)
                                      .addressbook(req.params.bookName)
                                      .vcard(req.params.contactId)
                                      .create(req.body)
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 170..174
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 314..318

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

                              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

                                    }, function(err) {
                                      logger.error('Error while getting addressbook list', err);
                                      res.status(500).json({
                                        error: {
                                          code: 500,
                              modules/linagora.esn.davproxy/backend/webserver/proxy/graceperiod/memory.js on lines 81..84

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

                              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

                                  contactModule.lib.client(options)
                                    .addressbookHome(req.params.bookHome)
                                    .addressbook(req.params.bookName)
                                    .vcard()
                                    .list(req.query)
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 70..74

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

                              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

                                  contactModule.lib.client(options)
                                    .addressbookHome(req.params.bookHome)
                                    .addressbook(req.params.bookName)
                                    .remove()
                                    .then(() => res.status(204).json())
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 131..135

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

                              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 8 locations. Consider refactoring.
                              Open

                                  const options = {
                                    ESNToken: req.token && req.token.token ? req.token.token : '',
                                    davserver: req.davserver
                                  };
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 29..32
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 65..68
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 126..129
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 165..168
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 308..311
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 374..377
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 406..409

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

                              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 8 locations. Consider refactoring.
                              Open

                                  const options = {
                                    ESNToken: req.token && req.token.token ? req.token.token : '',
                                    davserver: req.davserver
                                  };
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 29..32
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 65..68
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 91..94
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 126..129
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 165..168
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 374..377
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 406..409

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

                              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 8 locations. Consider refactoring.
                              Open

                                  const options = {
                                    ESNToken: req.token && req.token.token ? req.token.token : '',
                                    davserver: req.davserver
                                  };
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 29..32
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 91..94
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 126..129
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 165..168
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 308..311
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 374..377
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 406..409

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

                              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 8 locations. Consider refactoring.
                              Open

                                  var options = {
                                    ESNToken: req.token && req.token.token ? req.token.token : '',
                                    davserver: req.davserver
                                  };
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 29..32
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 65..68
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 91..94
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 165..168
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 308..311
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 374..377
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 406..409

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

                              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 8 locations. Consider refactoring.
                              Open

                                  var options = {
                                    ESNToken: req.token && req.token.token ? req.token.token : '',
                                    davserver: req.davserver
                                  };
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 29..32
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 65..68
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 91..94
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 126..129
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 165..168
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 308..311
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 406..409

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

                              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 8 locations. Consider refactoring.
                              Open

                                  const options = {
                                    ESNToken: req.token && req.token.token ? req.token.token : '',
                                    davserver: req.davserver
                                  };
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 65..68
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 91..94
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 126..129
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 165..168
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 308..311
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 374..377
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 406..409

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

                              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 8 locations. Consider refactoring.
                              Open

                                  var options = {
                                    ESNToken: req.token && req.token.token ? req.token.token : '',
                                    davserver: req.davserver
                                  };
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 29..32
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 65..68
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 91..94
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 126..129
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 165..168
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 308..311
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 374..377

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

                              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 8 locations. Consider refactoring.
                              Open

                                  var options = {
                                    ESNToken: req.token && req.token.token ? req.token.token : '',
                                    davserver: req.davserver
                                  };
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 29..32
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 65..68
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 91..94
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 126..129
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 308..311
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 374..377
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 406..409

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

                              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

                                    }, function(err) {
                                      res.status(500).json({
                                        error: {
                                          code: 500,
                                          message: 'Server Error',
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 181..189

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

                              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

                                    }, function(err) {
                                      res.status(500).json({
                                        error: {
                                          code: 500,
                                          message: 'Server Error',
                              modules/linagora.esn.davproxy/backend/webserver/addressbooks/controller.js on lines 153..161

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

                              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

                              There are no issues that match your filters.

                              Category
                              Status