livingsocial/rearview-engine

View on GitHub

Showing 64 of 133 total issues

File expandedmonitor.js has 573 lines of code (exceeds 250 allowed). Consider refactoring.
Open

define([
    'view/base',
    'view/deletemonitor',
    'model/monitor',
    'util/cron',
Severity: Major
Found in public/rearview-src/js/view/expandedmonitor.js - About 1 day to fix

    File addmonitor.js has 553 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    define([
        'view/base',
        'model/monitor',
        'codemirror',
        'util/cron',
    Severity: Major
    Found in public/rearview-src/js/view/addmonitor.js - About 1 day to fix

      File base.js has 382 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      define([
          'jquery',     
          'underscore', 
          'backbone',
          'handlebars',
      Severity: Minor
      Found in public/rearview-src/js/view/base.js - About 5 hrs to fix

        File dashboard.js has 380 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        define([
            'view/base',
            'model/monitor',
            'collection/monitor',
            'view/smallmonitor',
        Severity: Minor
        Found in public/rearview-src/js/view/dashboard.js - About 5 hrs to fix

          Function Templar has 118 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              Backbone.Templar = function( templatePaths, options ) {
                  // if no options are passed
                  var options           = ( typeof options === 'undefined' ) ? {} : options,
                      templateExtension = ( options.ext ) ? options.ext : config.ext,
                      baseUrlPath       = ( options.url ) ? options.url : config.url,
          Severity: Major
          Found in public/rearview-src/js/util/templar.js - About 4 hrs to fix

            File smallmonitor.js has 298 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            define([
                'view/base'
            ], function(
                BaseView
            ){
            Severity: Minor
            Found in public/rearview-src/js/view/smallmonitor.js - About 3 hrs to fix

              Function renderGraphData has 77 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      renderGraphData : function(chart, graphData) {
                          var self       = this,
                              renderData = graphData,
                              times      = [],
                              colors     = [      // creating an array to a series color scheme to stay consistant between updates from the server
              Severity: Major
              Found in public/rearview-src/js/view/base.js - About 3 hrs to fix

                Function setMetricsValidation has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        setMetricsValidation : function() {
                            $.validator.addMethod('code', function(value, element) {
                                var mirror  = $(element).data('CodeMirror'),
                                    wrapper = $( mirror.getWrapperElement() );
                                return this._validateMirror(mirror);
                Severity: Major
                Found in public/rearview-src/js/view/addmonitor.js - About 2 hrs to fix

                  Function addPopover has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          addPopover : function() {
                              var self = this;
                              jobAlertIdList = _.uniq(self.jobAlertList);
                  
                              for (var i = jobAlertIdList.length - 1; i >= 0; i--) {
                  Severity: Major
                  Found in public/rearview-src/js/view/alerttimeline.js - About 2 hrs to fix

                    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

                              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

                                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

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

                                          def valid_alert_keys
                                            if alert_keys.present?
                                              schemes = Rearview::Alerts.registry.keys
                                              alert_keys.each do |key|
                                                begin
                                      Severity: Minor
                                      Found in app/models/rearview/job.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

                                      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