linagora/hublin

View on GitHub

Showing 306 of 306 total issues

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

var AwesomeAnalyticsPiwikModule = new AwesomeModule('linagora.esn.analytics-piwik', {
  dependencies: [
    new Dependency(Dependency.TYPE_NAME, 'webserver.wrapper', 'webserver-wrapper')
  ],
  states: {
Severity: Major
Found in backend/core/analytics-piwik/backend/index.js and 1 other location - About 6 hrs to fix
backend/core/analytics-google/backend/index.js on lines 6..29

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

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 AwesomeAnalyticsGoogleModule = new AwesomeModule('linagora.esn.analytics-google', {
  dependencies: [
    new Dependency(Dependency.TYPE_NAME, 'webserver.wrapper', 'webserver-wrapper')
  ],
  states: {
Severity: Major
Found in backend/core/analytics-google/backend/index.js and 1 other location - About 6 hrs to fix
backend/core/analytics-piwik/backend/index.js on lines 6..29

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

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 index.js has 419 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

const extend = require('extend');
const q = require('q');
const async = require('async');
Severity: Minor
Found in backend/core/conference/index.js - About 6 hrs to fix

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

    function addJSInjection(moduleName, files, innerApps) {
      injections[moduleName] = injections[moduleName] || {};
      innerApps.forEach(function(innerApp) {
        injections[moduleName][innerApp] = injections[moduleName][innerApp] || {};
        injections[moduleName][innerApp].js = injections[moduleName][innerApp].js || [];
    Severity: Major
    Found in backend/webserver/index.js and 1 other location - About 5 hrs to fix
    backend/webserver/index.js on lines 186..193

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

    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 addJSAssetInjection(moduleName, files, innerApps) {
      injections[moduleName] = injections[moduleName] || {};
      innerApps.forEach(function(innerApp) {
        injections[moduleName][innerApp] = injections[moduleName][innerApp] || {};
        injections[moduleName][innerApp].jsasset = injections[moduleName][innerApp].jsasset || [];
    Severity: Major
    Found in backend/webserver/index.js and 1 other location - About 5 hrs to fix
    backend/webserver/index.js on lines 175..182

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

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

    module.exports = function(dependencies) {
      var logger = dependencies('logger');
      var errors = require('../errors')(dependencies);
      const denormalizer = require('../denormalizers/conference')(dependencies);
    
    
    Severity: Major
    Found in backend/webserver/controllers/conferences.js - About 5 hrs to fix

      Function 7 has 130 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        },{"../utils.js":13}],7:[function(require,module,exports){
        /*
         *  Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
         *
         *  Use of this source code is governed by a BSD-style license
      Severity: Major
      Found in frontend/js/thirdparty/adapter.js - About 5 hrs to fix

        File modernizr.js has 383 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /*!
         * modernizr v3.5.0
         * Build https://modernizr.com/download?-datachannel-getusermedia-peerconnection-websockets-domprefixes-setclasses-dontmin
         *
         * Copyright (c)
        Severity: Minor
        Found in frontend/js/thirdparty/modernizr.js - About 5 hrs to fix

          Function createOffer has 127 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              RTCPeerConnection.prototype.createOffer = function() {
                var pc = this;
          
                if (this._isClosed) {
                  return Promise.reject(makeError('InvalidStateError',
          Severity: Major
          Found in frontend/js/thirdparty/adapter.js - About 5 hrs to fix

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

                  function replaceExternalStreamId(pc, description) {
                    var sdp = description.sdp;
                    Object.keys(pc._reverseStreams || []).forEach(function(internalId) {
                      var externalStream = pc._reverseStreams[internalId];
                      var internalStream = pc._streams[externalStream.id];
            Severity: Major
            Found in frontend/js/thirdparty/adapter.js and 1 other location - About 4 hrs to fix
            frontend/js/thirdparty/adapter.js on lines 2886..2898

            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

                  function replaceInternalStreamId(pc, description) {
                    var sdp = description.sdp;
                    Object.keys(pc._reverseStreams || []).forEach(function(internalId) {
                      var externalStream = pc._reverseStreams[internalId];
                      var internalStream = pc._streams[externalStream.id];
            Severity: Major
            Found in frontend/js/thirdparty/adapter.js and 1 other location - About 4 hrs to fix
            frontend/js/thirdparty/adapter.js on lines 2899..2911

            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

                global.topic(LEAVER_TOPIC).subscribe(function(msg) {
                  logger.debug('Got a %s event', LEAVER_TOPIC, msg);
                  if (!msg.user) {
                    return logger.debug('Can not find user from notification', msg);
                  }
            Severity: Major
            Found in backend/wsserver/notification/conference.js and 1 other location - About 4 hrs to fix
            backend/wsserver/notification/conference.js on lines 39..51

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

            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

                global.topic(JOINER_TOPIC).subscribe(function(msg) {
                  logger.debug('Got a %s event', JOINER_TOPIC, msg);
                  if (!msg.user) {
                    return logger.debug('Can not find user from notification', msg);
                  }
            Severity: Major
            Found in backend/wsserver/notification/conference.js and 1 other location - About 4 hrs to fix
            backend/wsserver/notification/conference.js on lines 53..65

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

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

              function ConferenceState($rootScope, LOCAL_VIDEO_ID, REMOTE_VIDEO_IDS, newImage) {
                /*
                * Store a snapshot of current conference status and an array of attendees describing
                * current visible attendees of the conference by their index as position.
                * attendees : [{
            Severity: Major
            Found in frontend/js/modules/conference/conference-state.service.js - About 4 hrs to fix

              Function shimPeerConnection has 111 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  shimPeerConnection: function(window) {
                    var browserDetails = utils.detectBrowser(window);
              
                    if (typeof window !== 'object' || !(window.RTCPeerConnection ||
                        window.mozRTCPeerConnection)) {
              Severity: Major
              Found in frontend/js/thirdparty/adapter.js - About 4 hrs to fix

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

                module.exports = function(dependencies) {
                  var logger = dependencies('logger');
                  var errors = require('../errors')(dependencies);
                  const denormalizer = require('../denormalizers/conference')(dependencies);
                
                
                Severity: Minor
                Found in backend/webserver/controllers/conferences.js - About 4 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 start has 105 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function start(callback) {
                  function listenCallback(server, err) {
                    if (server === webserver.server) { states.http4 = STARTED; }
                    if (server === webserver.sslserver) { states.ssl4 = STARTED; }
                    if (server === webserver.server6) { states.http6 = STARTED; }
                Severity: Major
                Found in backend/webserver/index.js - About 4 hrs to fix

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

                        ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate']
                            .forEach(function(method) {
                              var nativeMethod = window.RTCPeerConnection.prototype[method];
                              window.RTCPeerConnection.prototype[method] = function() {
                                arguments[0] = new ((method === 'addIceCandidate') ?
                  Severity: Major
                  Found in frontend/js/thirdparty/adapter.js and 1 other location - About 4 hrs to fix
                  frontend/js/thirdparty/adapter.js on lines 3179..3188

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

                  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

                        ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate']
                            .forEach(function(method) {
                              var nativeMethod = window.RTCPeerConnection.prototype[method];
                              window.RTCPeerConnection.prototype[method] = function() {
                                arguments[0] = new ((method === 'addIceCandidate') ?
                  Severity: Major
                  Found in frontend/js/thirdparty/adapter.js and 1 other location - About 4 hrs to fix
                  frontend/js/thirdparty/adapter.js on lines 3857..3866

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

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

                    },{"./adapter_factory.js":4}],4:[function(require,module,exports){
                    /*
                     *  Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
                     *
                     *  Use of this source code is governed by a BSD-style license
                  Severity: Major
                  Found in frontend/js/thirdparty/adapter.js - About 3 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language