linagora/hublin

View on GitHub

Showing 306 of 306 total issues

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

  if (states.ssl4 === STOPPED) {
    webserver.sslserver = https.createServer(sslopts, webserver.application).listen(webserver.ssl_port, webserver.ssl_ip);
    setupEventListeners(webserver.sslserver);
  }
Severity: Major
Found in backend/webserver/index.js and 1 other location - About 1 hr to fix
backend/webserver/index.js on lines 165..168

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

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

      if (!isActionAllowedInSignalingState('setLocalDescription',
          description.type, this.signalingState) || this._isClosed) {
        return Promise.reject(makeError('InvalidStateError',
            'Can not set local ' + description.type +
            ' in state ' + pc.signalingState));
Severity: Major
Found in frontend/js/thirdparty/adapter.js and 1 other location - About 1 hr to fix
frontend/js/thirdparty/adapter.js on lines 824..829

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

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 a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function(dependencies) {

  var logger = dependencies('logger'),
      errors = require('../errors')(dependencies),
      config = dependencies('config')('default');
Severity: Minor
Found in backend/webserver/controllers/home.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 fileWatcher has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

function fileWatcher(logger, file, onChange) {
  var watchingConfig = false;
  var lastHash = null;

  return function fileWatcherInstance() {
Severity: Minor
Found in backend/core/db/mongo/file-watcher.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 exports has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function(dependencies) {

  var logger = dependencies('logger');
  var errors = require('../errors')(dependencies);

Severity: Minor
Found in backend/webserver/middlewares/user.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 webRTCService has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function webRTCService($log, webRTCAdapterRegistry, WEBRTC_CONNECTOR) {
    var adapter = webRTCAdapterRegistry.get(WEBRTC_CONNECTOR);

    if (!adapter) {
      $log.warn(WEBRTC_CONNECTOR, 'webrtc connector has not been found, things will not work as expected');
Severity: Minor
Found in frontend/js/modules/webrtc/webrtc.service.js - About 1 hr to fix

    Function setRemoteDescription has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            window.RTCPeerConnection.prototype.setRemoteDescription = function() {
              var pc = this;
              if (!pc._ontrackpoly) {
                pc._ontrackpoly = function(e) {
                  // onaddstream does not fire when a track is added to an existing
    Severity: Minor
    Found in frontend/js/thirdparty/adapter.js - About 1 hr to fix

      Function conferenceUserControlBar has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function conferenceUserControlBar($log, webRTCService) {
          return {
            restrict: 'E',
            replace: true,
            templateUrl: '/views/modules/conference/conference-user-control-bar.html',

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

          if (states.http6 === STOPPED) {
            webserver.server6 = http.createServer(webserver.application).listen(webserver.port, webserver.ipv6);
            setupEventListeners(webserver.server6);
          }
        Severity: Major
        Found in backend/webserver/index.js and 1 other location - About 1 hr to fix
        backend/webserver/index.js on lines 150..153

        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

          if (states.http4 === STOPPED) {
            webserver.server = http.createServer(webserver.application).listen(webserver.port, webserver.ip);
            setupEventListeners(webserver.server);
          }
        Severity: Major
        Found in backend/webserver/index.js and 1 other location - About 1 hr to fix
        backend/webserver/index.js on lines 155..158

        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

        Function AutoVideoSwitcher has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function AutoVideoSwitcher($rootScope, $timeout, AUTO_VIDEO_SWITCH_TIMEOUT, LOCAL_VIDEO_ID) {
        
            function AutoVideoSwitcher(conferenceState) {
              this.conferenceState = conferenceState;
              this.timeouts = {};
        Severity: Minor
        Found in frontend/js/modules/utils/auto-video-switcher.service.js - About 1 hr to fix

          Function writeMediaSection has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function writeMediaSection(transceiver, caps, type, stream, dtlsRole) {
              var sdp = SDPUtils.writeRtpDescription(transceiver.kind, caps);
          
              // Map ICE parameters (ufrag, pwd) to SDP.
              sdp += SDPUtils.writeIceParameters(
          Severity: Minor
          Found in frontend/js/thirdparty/adapter.js - About 1 hr to fix

            Function ioInterface has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function ioInterface(callback) {
            
                  var ioAction = new IoAction();
                  var terminate = {
                    emit: emit,
            Severity: Minor
            Found in frontend/js/modules/websocket/services.js - About 1 hr to fix

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

                  var planB = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')
                  .map(function(line) {
                    return SDPUtils.parseSsrcMedia(line);
                  })
                  .filter(function(parts) {
              Severity: Major
              Found in frontend/js/thirdparty/adapter.js and 1 other location - About 1 hr to fix
              frontend/js/thirdparty/adapter.js on lines 2057..2063

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

              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

                  ConferenceState.prototype.getAttendeeByRtcid = function(rtcid) {
                    return this.attendees.filter(function(attendee) {
                        return attendee && attendee.rtcid === rtcid;
                      })[0] || null;
                  };
              Severity: Major
              Found in frontend/js/modules/conference/conference-state.service.js and 1 other location - About 1 hr to fix
              frontend/js/modules/conference/conference-state.service.js on lines 34..38

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

              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

                  ConferenceState.prototype.getAttendeeByVideoId = function(videoId) {
                    return this.attendees.filter(function(attendee) {
                        return attendee && attendee.videoId === videoId;
                      })[0] || null;
                  };
              Severity: Major
              Found in frontend/js/modules/conference/conference-state.service.js and 1 other location - About 1 hr to fix
              frontend/js/modules/conference/conference-state.service.js on lines 28..32

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

              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 ssrcs = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:')
                  .map(function(line) {
                    return SDPUtils.parseSsrcMedia(line);
                  })
                  .filter(function(parts) {
              Severity: Major
              Found in frontend/js/thirdparty/adapter.js and 1 other location - About 1 hr to fix
              frontend/js/thirdparty/adapter.js on lines 2166..2172

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

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

                function userTime(attendeeColorsService, $interval, currentConferenceState, LOCAL_VIDEO_ID, moment) {
                  return {
                    restrict: 'A',
                    link: link
                  };
              Severity: Minor
              Found in frontend/js/modules/utils/user-time.directive.js - About 1 hr to fix

                Function parseCandidate has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  SDPUtils.parseCandidate = function(line) {
                    var parts;
                    // Parse both variants.
                    if (line.indexOf('a=candidate:') === 0) {
                      parts = line.substring(12).split(' ');
                Severity: Minor
                Found in frontend/js/thirdparty/adapter.js - About 1 hr to fix

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

                          link: function(scope) {
                            function buildUrl(room) {
                              return URI('/')
                                .query('')
                                .fragment('')
                  Severity: Minor
                  Found in frontend/js/modules/conference/conference.js - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language