livingsocial/rearview-engine

View on GitHub

Showing 64 of 133 total issues

Function parsleyValidator has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      parsleyValidator : function(cb) {
        var validator = function() {};
        _.extend(validator, {
          validationMinlength: 1,
          validators : {
Severity: Minor
Found in public/rearview-src/js/util/cron.js - About 1 hr to fix

    Function _saveCategory has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            _saveCategory : function(cb) {
                this._checkFirstCategoryCondition(function(currentDashboardModel) {
                    this.model = new DashboardModel({
                        category    : true,
                        dashboardId : this.dashboard.id
    Severity: Minor
    Found in public/rearview-src/js/view/addcategory.js - About 1 hr to fix

      Method make_constants_module has a Cognitive Complexity of 10 (exceeds 5 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

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

              _saveMonitor : function(cb) {
                  this._setMetrics();
      
                  this.model.save({
                      'id'          : null,
      Severity: Minor
      Found in public/rearview-src/js/view/addmonitor.js - About 1 hr to fix

        Function stop has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                        stop : function( e, ui ) {
                            var $el    = ui.helper,
                                offset = ui.offset,
                                match  = [],
                                thisId = $el.attr('id'),
        Severity: Minor
        Found in public/rearview-src/js/view/smallmonitor.js - About 1 hr to fix

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

                  testMetrics : function() {
                      this._setMetrics();
          
                      $.post('/monitor.json', this.model.toJSON(), function(result) {
                          if (result.graph_data) {
          Severity: Minor
          Found in public/rearview-src/js/view/addmonitor.js - About 1 hr to fix

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

                    _toggleFullscreen : function(selector, mirrorRef, closeButton, backButton) {
                        var self     = this,
                            editorEl = $(selector);
            
                        if (!editorEl.hasClass('fullscreen')) {
            Severity: Minor
            Found in public/rearview-src/js/view/base.js - About 1 hr to fix

              Method boot! has 26 lines of code (exceeds 25 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

                Method metric has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                      def metric
                        unless @metric
                          @metric = if path?
                            self.elements[0].text
                          else
                Severity: Minor
                Found in lib/graphite/target_grammer.rb - 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

                Method alias has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                      def alias
                        unless @alias
                          e = self.expressions.detect {|e| e.identifier.try(:text) == "alias" }
                          if e && e.args && e.args.elements
                            alias_val = e.args.elements.last.detect { |e| e.kind_of?(Graphite::TargetGrammer::StringLiteral) }
                Severity: Minor
                Found in lib/graphite/target_grammer.rb - 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

                Method calculate_durations has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def self.calculate_durations(errors)
                      last_with_error = nil         # most recently found error
                      (errors.each do |e|
                        if e.status == Status::SUCCESS
                          unless last_with_error.nil?
                Severity: Minor
                Found in app/models/rearview/job_error.rb - 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

                Method validate_each has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                      def validate_each(record, attribute, value)
                        passed = true
                        if value.present?
                          uri = URI.parse(value) rescue nil
                          unless uri.present? && uri.scheme.present? && (uri.scheme.downcase=="http" || uri.scheme.downcase=="https")
                Severity: Minor
                Found in lib/rearview/configuration.rb - 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

                Method color has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                      def color
                        unless @color
                          e = self.expressions.detect {|e| e.identifier.try(:text) == "color" }
                          if e && e.args && e.args.elements
                            color_val = e.args.elements.last.detect { |e| e.kind_of?(Graphite::TargetGrammer::StringLiteral)  }
                Severity: Minor
                Found in lib/graphite/target_grammer.rb - 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

                Method eval has a Cognitive Complexity of 9 (exceeds 5 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 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

                Method run has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                      def run(metrics,
                              monitor_expr = nil,
                              minutes      = nil,
                              namespace    = {},
                              verbose      = false,
                Severity: Major
                Found in lib/rearview/monitor_runner.rb - About 50 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                              if (!_.isNull(timeIndex)) { 
                                                  chart.xAxis[0].addPlotLine({
                                                      id        : 'plotLine',
                                                      value     : timeIndex,
                                                      color     : 'green',
                  Severity: Major
                  Found in public/rearview-src/js/view/base.js - About 45 mins to fix

                    Method create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def create
                          @errors = if params[:metrics].empty?
                                      [ "No metrics were provided" ]
                                    else
                                      metrics_validator = Rearview::MetricsValidator.new({attributes: [:metrics]})
                    Severity: Minor
                    Found in app/controllers/rearview/monitor_controller.rb - About 45 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

                    Method percentage_errors has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      def percentage_errors(metric, comparison_metrics, limit_value, limit_type, minutes = @minutes)
                    Severity: Minor
                    Found in lib/rearview/templates/utilities.rb - About 35 mins to fix

                      Function _compile has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                                  _compile : function(content, el, append, data, cb) {
                      Severity: Minor
                      Found in public/rearview-src/js/util/templar.js - About 35 mins to fix

                        Method eval has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                              def eval(data, expr = nil, initial_ns = {}, verbose = false, immediate = false)
                        Severity: Minor
                        Found in lib/rearview/monitor_runner.rb - About 35 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language