aullman/opentok-meet

View on GitHub

Showing 40 of 40 total issues

Function updateStats has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    const updateStats = () => {
      Object.keys(subscribers).forEach((subscriberId) => {
        const subscriberStats = subscribers[subscriberId];
        const { subscriber, lastStats, lastLastStats } = subscriberStats;
        subscriber.getStats((err, stats) => {
Severity: Minor
Found in src/js/subscriber-stats.js - About 1 hr to fix

    Function NotificationService has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

      function NotificationService($window, OTSession, Push) {
        let focused = true;
    
        $window.addEventListener('blur', () => {
          focused = false;
    Severity: Minor
    Found in src/js/notifications.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 PublisherStatsDirective has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    function PublisherStatsDirective(OTSession, $interval) {
      function link(scope) {
        let currentPublisher;
        const allLastStats = {};
        let currentInterval;
    Severity: Minor
    Found in src/js/publisher-stats.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 NotificationService has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function NotificationService($window, OTSession, Push) {
        let focused = true;
    
        $window.addEventListener('blur', () => {
          focused = false;
    Severity: Minor
    Found in src/js/notifications.js - About 1 hr to fix

      Function RoomCtrl has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

        function RoomCtrl($scope, $http, $window, $document, $timeout, OTSession, RoomService, baseURL, NotificationService) {
          $scope.streams = OTSession.streams;
          $scope.connections = OTSession.connections;
          $scope.publishing = false;
          $scope.archiveId = null;
      Severity: Minor
      Found in src/js/controllers.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 link has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function link(scope, element) {
          let currentPublisher;
          scope.devices = [];
          scope.showDeviceList = false;
          scope.selectedLabel = '';
      Severity: Minor
      Found in src/js/microphone-picker.js - About 1 hr to fix

        Function MicrophonePickerDirective has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

        function MicrophonePickerDirective() {
          function link(scope, element) {
            let currentPublisher;
            scope.devices = [];
            scope.showDeviceList = false;
        Severity: Minor
        Found in src/js/microphone-picker.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 toggleFilterList has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            scope.toggleFilterList = () => {
              scope.showFilterList = !scope.showFilterList;
        
              setTimeout(() => {
                // Do it asynchronously so we don't block
        Severity: Minor
        Found in src/js/filter-picker.js - About 1 hr to fix

          Function mappedStats has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  const mappedStats = allStats.map((statsContainer) => {
                    const { stats } = statsContainer;
                    const key = statsContainer.subscriberId || 'Mantis';
          
                    if (!allLastStats[key]) {
          Severity: Minor
          Found in src/js/publisher-stats.js - About 1 hr to fix

            Function subscriberStats has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              '$timeout', function subscriberStats(OTSession, StatsService, $timeout) {
                return {
                  restrict: 'E',
                  scope: {
                    stream: '=',
            Severity: Minor
            Found in src/js/subscriber-stats.js - About 1 hr to fix

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

                .directive('mutePublisher', ['OTSession', function mutePublisher(OTSession) {
                  return {
                    restrict: 'A',
                    link(scope, element, attrs) {
                      const type = attrs.mutedType || 'Video';
              Severity: Minor
              Found in src/js/directives.js - About 1 hr to fix

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

                        if (winWidth - element.width() < parseInt(element.css('left'), 10)) {
                        // We're too narrow, switch to being right aligned
                          element.css({
                            left: 'auto',
                            right: '10px',
                Severity: Major
                Found in src/js/directives.js and 1 other location - About 1 hr to fix
                src/js/directives.js on lines 32..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 59.

                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 (winHeight - element.height() < parseInt(element.css('top'), 10)) {
                        // We're too short switch to being bottom aligned
                          element.css({
                            top: 'auto',
                            bottom: '10px',
                Severity: Major
                Found in src/js/directives.js and 1 other location - About 1 hr to fix
                src/js/directives.js on lines 39..45

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

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

                      link(scope, element, attrs) {
                        const type = attrs.mutedType || 'Video';
                        scope[`muted${type}`] = false;
                
                        const getPublisher = () =>
                Severity: Minor
                Found in src/js/directives.js - About 1 hr to fix

                  Function json has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        json() {
                          const goToRoom = (err, sessionId, pApiKey, pSecret) => {
                            if (err) {
                              console.error('Error getting room: ', err);
                              res.send({
                  Severity: Minor
                  Found in server/routes.js - About 1 hr to fix

                    Function mutePublisher has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      .directive('mutePublisher', ['OTSession', function mutePublisher(OTSession) {
                        return {
                          restrict: 'A',
                          link(scope, element, attrs) {
                            const type = attrs.mutedType || 'Video';
                    Severity: Minor
                    Found in src/js/directives.js - About 55 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

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

                      function filteredPublisher(OTSession, $rootScope) {
                        return {
                          restrict: 'E',
                          scope: {
                            props: '&',
                    Severity: Minor
                    Found in src/js/filtered-publisher.js - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function MainCtrl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      .controller('MainCtrl', ['$scope', '$window', function MainCtrl($scope, $window) {
                        $scope.room = '';
                        $scope.roomType = 'normal';
                        $scope.advanced = false;
                        $scope.joinRoom = () => {
                    Severity: Minor
                    Found in src/js/login/controller.js - About 25 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function restrictFrameRate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      .directive('restrictFramerate', ['OTSession', function restrictFrameRate(OTSession) {
                        return {
                          restrict: 'E',
                          template: '<button class="restrict-framerate-btn" ng-class="' +
                          '{\'ion-ios7-speedometer-outline\': restrictedFrameRate, ' +
                    Severity: Minor
                    Found in src/js/directives.js - About 25 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Function draggable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      function draggable($document, $window) {
                        const getEventProp = (event, prop) => {
                          if (event[prop] === 0) return 0;
                          return event[prop] || (event.touches && event.touches[0][prop]) ||
                          (event.originalEvent && event.originalEvent.touches &&
                    Severity: Minor
                    Found in src/js/directives.js - About 25 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Severity
                    Category
                    Status
                    Source
                    Language