livingsocial/rearview-engine

View on GitHub

Showing 133 of 133 total issues

Method validate_graphite_connection has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_graphite_connection
      if graphite_connection.present?
        if !graphite_connection[:url].present?
          self.errors.add(:graphite_connection, "graphite URL can't be blank")
        else
Severity: Minor
Found in lib/rearview/configuration.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

Function _initCodeMirror has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        _initCodeMirror : function() {
            var $expressions            = this.$el.find('#inputExpressions')[0],
                expressionsCodeSelector = '.add-monitor .expressions .CodeMirror',
                $metrics                = this.$el.find('#inputMetrics')[0],
                metricsCodeSelector     = '.add-monitor .metrics .CodeMirror',
Severity: Minor
Found in public/rearview-src/js/view/addmonitor.js - About 1 hr to fix

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

            updateGraph : function(model, cb, graphData) {
                var self = this;
    
                if(graphData) {
                    self.renderGraphData(self.chart, graphData);
    Severity: Minor
    Found in public/rearview-src/js/view/expandedmonitor.js - About 1 hr to fix

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

              auth : function() {
                  // set reference to router in our dashboard
                  this.indexRouter = ( !this.indexRouter )
                                   ? new IndexRouter({
                                       'app' : this
      Severity: Minor
      Found in public/rearview-src/js/app.js - About 1 hr to fix

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

                            success : function(result) {
                                if (result.status === 'error') {
                                    this.hideOverlay();
                                    if(_.isEmpty(result.graph_data)) {
                                        this.showOverlay(this.$graph, 'Monitor Error - No Data', 'small-monitor-error-overlay');
        Severity: Minor
        Found in public/rearview-src/js/view/smallmonitor.js - About 1 hr to fix

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

                      if ( $metricsEditor.data('beforeFullscreen') ) {
                          $metricsEditor.height($metricsEditor.data('beforeFullscreen').height);
                          $metricsEditor.width($metricsEditor.data('beforeFullscreen').width);
                      }
          Severity: Major
          Found in public/rearview-src/js/view/addmonitor.js and 1 other location - About 1 hr to fix
          public/rearview-src/js/view/addmonitor.js on lines 185..188

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

          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 ( $expressionsEditor.data('beforeFullscreen') ) {
                          $expressionsEditor.height($expressionsEditor.data('beforeFullscreen').height);
                          $expressionsEditor.width($expressionsEditor.data('beforeFullscreen').width);
                      }
          Severity: Major
          Found in public/rearview-src/js/view/addmonitor.js and 1 other location - About 1 hr to fix
          public/rearview-src/js/view/addmonitor.js on lines 178..181

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

          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

                      this.$el.find('#namePagerForm .pager-duty .help.label').tooltip({
                          trigger   : 'click',
                          html      : true,
                          placement : 'left',
                          delay     : { show : 100, hide : 200 },
          Severity: Major
          Found in public/rearview-src/js/view/addmonitor.js and 1 other location - About 1 hr to fix
          public/rearview-src/js/view/addmonitor.js on lines 239..245

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 60.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

                      this.$el.find('#cronScheduleForm .set-schedule .help.label').tooltip({
                          trigger   : 'click',
                          html      : true,
                          placement : 'left',
                          delay     : { show : 100, hide : 200 },
          Severity: Major
          Found in public/rearview-src/js/view/addmonitor.js and 1 other location - About 1 hr to fix
          public/rearview-src/js/view/addmonitor.js on lines 247..253

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 60.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Method boot! has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

            def boot!
              Celluloid.logger = @logger = config.logger if(config.logger.present?)
              logger.info "booting..."
              logger.info "using configuration: \n#{config.dump}"
              if config.verify?
          Severity: Minor
          Found in lib/rearview.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

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

                      self.$el.find('#viewSchedule .help.label').tooltip({
                          trigger   : 'click',
                          html      : true,
                          placement : 'left',
                          delay     : { show : 100, hide : 200 },
          Severity: Major
          Found in public/rearview-src/js/view/expandedmonitor.js and 2 other locations - About 1 hr to fix
          public/rearview-src/js/view/expandedmonitor.js on lines 288..294
          public/rearview-src/js/view/expandedmonitor.js on lines 296..302

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 60.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

                      self.$el.find('.help:nth-child(2)').tooltip({
                          trigger   : 'click',
                          html      : true,
                          placement : 'right',
                          delay     : { show : 100, hide : 200 },
          Severity: Major
          Found in public/rearview-src/js/view/expandedmonitor.js and 2 other locations - About 1 hr to fix
          public/rearview-src/js/view/expandedmonitor.js on lines 280..286
          public/rearview-src/js/view/expandedmonitor.js on lines 296..302

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 60.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

                      self.$el.find('#viewSettings .monitor-meta .pager-duty .help.label').tooltip({
                          trigger   : 'click',
                          html      : true,
                          placement : 'left',
                          delay     : { show : 100, hide : 200 },
          Severity: Major
          Found in public/rearview-src/js/view/expandedmonitor.js and 2 other locations - About 1 hr to fix
          public/rearview-src/js/view/expandedmonitor.js on lines 280..286
          public/rearview-src/js/view/expandedmonitor.js on lines 288..294

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 60.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

                  updateMonitor : function(e) {
                      var self        = this,
                          monitor     = e.data.model,
                          test        = e.data.test,
                          toDate      = e.data.toDate,
          Severity: Minor
          Found in public/rearview-src/js/view/expandedmonitor.js - About 1 hr to fix

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

                    _setupMetricsView : function() {
                        var modalContainerEl = $('.add-monitor');
            
                        if ( !this.metricsViewInitialized ) {
                            this.scheduleMonitorBody   = $('.add-monitor .modal-body').detach();
            Severity: Minor
            Found in public/rearview-src/js/view/addmonitor.js - About 1 hr to fix

              Method scoped_eval has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def scoped_eval(namespace)
                  # Copy instance variables from top-level class into current scope
                  namespace.keys.each do |v|
                    instance_variable_set "#{v}".to_sym, namespace[v]
                  end
              Severity: Minor
              Found in lib/rearview/templates/monitor.rb - About 1 hr to fix

                Function setNameScheduleHelp has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        setNameScheduleHelp : function() {
                            $cronHelpContent = '';
                            $alertHelpContent = '';
                            $.ajax({
                                url     : rearview.path + '/help/cron.html',
                Severity: Minor
                Found in public/rearview-src/js/view/addmonitor.js - About 1 hr to fix

                  Function _initializeCodeMirror has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          _initializeCodeMirror : function() {
                              var self          = this,
                                  $expressions  = self.$el.find('#inputExpressions')[0],
                                  $metrics      = self.$el.find('#inputMetrics')[0];
                  
                  
                  Severity: Minor
                  Found in public/rearview-src/js/view/expandedmonitor.js - About 1 hr to fix

                    Method eval has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          def eval(data, expr = nil, initial_ns = {}, verbose = false, immediate = false)
                            logger.debug "#{self} eval"
                            # prepare variable map for the monitor process
                            namespace = create_namespace(data, initial_ns)
                    
                    
                    Severity: Minor
                    Found in lib/rearview/monitor_runner.rb - About 1 hr to fix

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

                              _moveAllCurrentMonitorsToCategory : function() {
                                  this.model.save({
                                      userId      : this.user.get('id'),
                                      name        : this.$el.find('#categoryName').val(),
                                      description : this.$el.find('#categoryDescription').val()
                      Severity: Minor
                      Found in public/rearview-src/js/view/addcategory.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language