livingsocial/rearview-engine

View on GitHub

Showing 133 of 133 total issues

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

                onKeyEvent   : function(i, e) {
                    if (( e.keyCode == 70 && e.ctrlKey ) && e.type == 'keydown') {
                        e.stop();
                        return this._toggleFullscreen(metricsCodeSelector, this.metricsMirror, $closeButton, $backButton);
                    }
Severity: Major
Found in public/rearview-src/js/view/addmonitor.js and 1 other location - About 2 hrs to fix
public/rearview-src/js/view/addmonitor.js on lines 573..578

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

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

        initGraph : function(el) {
            var self = this;

            self.chart = new Highcharts.Chart({
                exporting : {
Severity: Major
Found in public/rearview-src/js/view/base.js - About 2 hrs to fix

    Function updateMonitorList has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            updateMonitorList : function() {
                // to store current list in current order
                var monitorCollection = [],
                    renderCategories  = [];
    
    
    Severity: Major
    Found in public/rearview-src/js/view/dashboard.js - About 2 hrs to fix

      Function initPopover has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                      var initPopover = function(jobId) {
      
                          var $content   = $("<div class='timeline-monitor'>"),
                              $closeBtn  = $('<button/>', {
                                  'text'  : 'Troubleshoot Monitor',
      Severity: Major
      Found in public/rearview-src/js/view/alerttimeline.js - About 2 hrs to fix

        Function setupDrag has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                setupDrag : function() {
                    // drag-n-drop
                    this.$monitor.draggable({
                        handle        : this.$el.find('.drag-handle'),
                        containment   : 'body',
        Severity: Major
        Found in public/rearview-src/js/view/smallmonitor.js - About 2 hrs to fix

          Function updateGraph has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  updateGraph : function(period) {
                      var runUpdate = false;
          
                      if ( !period ) {
                          runUpdate = true;
          Severity: Major
          Found in public/rearview-src/js/view/smallmonitor.js - About 2 hrs to fix

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

                    destructor : function() {
                        var $prevSibling = this.$el.prev();
            
                        this.remove();
                        this.off();
            Severity: Major
            Found in public/rearview-src/js/view/addcategory.js and 2 other locations - About 2 hrs to fix
            public/rearview-src/js/view/adddashboard.js on lines 102..111
            public/rearview-src/js/view/settings.js on lines 59..68

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

            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

                    destructor : function() {
                        var $prevSibling = this.$el.prev();
            
                        this.remove();
                        this.off();
            Severity: Major
            Found in public/rearview-src/js/view/adddashboard.js and 2 other locations - About 2 hrs to fix
            public/rearview-src/js/view/addcategory.js on lines 126..135
            public/rearview-src/js/view/settings.js on lines 59..68

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

            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

                    destructor : function() {
                        var $prevSibling = this.$el.prev();
            
                        this.remove();
                        this.off();
            Severity: Major
            Found in public/rearview-src/js/view/settings.js and 2 other locations - About 2 hrs to fix
            public/rearview-src/js/view/addcategory.js on lines 126..135
            public/rearview-src/js/view/adddashboard.js on lines 102..111

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

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

                    initMonitor : function() {
                        var self = this;
            
                        // retrieve monitor model & graph data
                        self.getMonitor(self.monitorId, function(result) {
            Severity: Major
            Found in public/rearview-src/js/view/expandedmonitor.js - About 2 hrs to fix

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

                              success : function(response) {
                                  Backbone.Mediator.pub('view:dashboard:save', {
                                      'model'     : this.model,
                                      'message'   : "Your changes to '" + this.model.get('name') + "' dashboard were saved.",
                                      'attention' : 'Dashboard Saved!'
              Severity: Major
              Found in public/rearview-src/js/view/dashboardtile.js and 1 other location - About 2 hrs to fix
              public/rearview-src/js/view/resetmonitor.js on lines 54..60

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

              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

                              success : function(result) {
                                  Backbone.Mediator.pub('view:resetmonitor:reset', {
                                      'model'     : this.model,
                                      'message'   : "The '" + this.model.get('name') + "' monitor's history and data were reset.",
                                      'attention' : 'Monitor Reset Successful!'
              Severity: Major
              Found in public/rearview-src/js/view/resetmonitor.js and 1 other location - About 2 hrs to fix
              public/rearview-src/js/view/dashboardtile.js on lines 114..120

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

              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

                              onKeyEvent   : function(i, e) {
                                  if (( e.keyCode == 70 && e.ctrlKey ) && e.type == 'keydown') {
                                      e.stop();
                                      return self._toggleFullscreen('.expanded-monitor .metrics .CodeMirror', self.metricsMirror);
                                  }
              Severity: Major
              Found in public/rearview-src/js/view/expandedmonitor.js and 1 other location - About 1 hr to fix
              public/rearview-src/js/view/expandedmonitor.js on lines 665..670

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

              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

                              onKeyEvent   : function(i, e) {
                                  if (( e.keyCode == 70 && e.ctrlKey ) && e.type == 'keydown') {
                                      e.stop();
                                      return self._toggleFullscreen('.expanded-monitor .expressions .CodeMirror', self.expressionsMirror);
                                  }
              Severity: Major
              Found in public/rearview-src/js/view/expandedmonitor.js and 1 other location - About 1 hr to fix
              public/rearview-src/js/view/expandedmonitor.js on lines 679..684

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

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

                      setupAlertTimeline : function() {
                          var self            = this,
                              jobAlertIdList  = [];
              
                          $.ajax('/dashboards/' + self.dashboardId + '/errors', {
              Severity: Minor
              Found in public/rearview-src/js/view/alerttimeline.js - About 1 hr to fix

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

                                    if (categoryMonitorOrder.length !== 0) {
                                        // instantiate views that don't have order yet...
                                        var unorderedMonitors = _.difference(monitorCollection.pluck('id'), categoryMonitorOrder);
                                        // add them to the order array
                                        categoryMonitorOrder = _.union(categoryMonitorOrder, unorderedMonitors); 
                Severity: Major
                Found in public/rearview-src/js/view/dashboard.js and 1 other location - About 1 hr to fix
                public/rearview-src/js/view/dashboard.js on lines 421..427

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

                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 (dashboardMonitorOrder.length !== 0) {
                                    // instantiate views that don't have order yet...
                                    var unorderedMonitors = _.difference(monitorCollection.pluck('id'), dashboardMonitorOrder);
                                    // add them to the order array
                                    dashboardMonitorOrder = _.union(dashboardMonitorOrder, unorderedMonitors); 
                Severity: Major
                Found in public/rearview-src/js/view/dashboard.js and 1 other location - About 1 hr to fix
                public/rearview-src/js/view/dashboard.js on lines 401..407

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

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

                        setHelp : function() {
                            var self     = this,
                            $quickContent = '';
                            $alertContent = '';
                            $cronHelpContent = '';
                Severity: Minor
                Found in public/rearview-src/js/view/expandedmonitor.js - About 1 hr to fix

                  Method make_constants_module has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def make_constants_module(*args)
                          mod_name = args[0]
                          mod_opts = args[1]
                          m = Module.new
                          constant_values = []
                  Severity: Minor
                  Found in lib/rearview/constants_module_maker.rb - About 1 hr to fix

                    Method metric_valid? has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def metric_valid?(metric)
                          valid = false
                          metric_key = nil
                          target_parser.parse(metric)
                          if target_parser.error?
                    Severity: Minor
                    Found in lib/rearview/metrics_validator.rb - About 1 hr to fix

                    Cognitive Complexity

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

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

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

                    Further reading

                    Severity
                    Category
                    Status
                    Source
                    Language