livingsocial/rearview-engine

View on GitHub

Showing 133 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

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

                  this.templar.render({
                      path   : 'smallmonitor',
                      el     : this.$el,
                      append : true,
                      data   : {
      Severity: Major
      Found in public/rearview-src/js/view/smallmonitor.js and 1 other location - About 1 hr to fix
      public/rearview-src/js/view/dashboardtile.js on lines 25..32

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

      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.templar.render({
                      path   : 'dashboardtile',
                      el     : this.$el,
                      append : true,
                      data   : {
      Severity: Major
      Found in public/rearview-src/js/view/dashboardtile.js and 1 other location - About 1 hr to fix
      public/rearview-src/js/view/smallmonitor.js on lines 48..55

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

      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 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 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 _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

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

                              Backbone.Mediator.pub('view:expandedmonitor:delete', {
                                  'model'     : self.model,
                                  'message'   : "The monitor '" + model.get('name') + "' produced an error during the process of deletion.",
                                  'attention' : 'Monitor Delete Error!',
                                  'status'    : 'error'
          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 457..462

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

          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

                                Backbone.Mediator.pub('view:expandedmonitor:save', {
                                    'model'     : self.model,
                                    'message'   : "The monitor '" + model.get('name') + "' was saved.",
                                    'attention' : 'Monitor Saved!',
                                    'status'    : 'success'
          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 497..502

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

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

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

                        cronWeekdayButtonClicked : function(event) {
                          $(event.target).button('toggle');
                          this.setCronScheduleWeekdaysSelected();
                          this.setCronScheduleDaysDisabled(this.cronScheduleWeekdaysSelected);
                        },
                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/expandedmonitor.js on lines 164..168

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

                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

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

                        cronWeekdayButtonClicked : function(event) {
                            $(event.target).button('toggle');
                            this.setCronScheduleWeekdaysSelected();
                            this.setCronScheduleDaysDisabled(this.cronScheduleWeekdaysSelected);
                        },
                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/addmonitor.js on lines 214..218

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

                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

                      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 and 1 other location - About 1 hr to fix
                lib/graphite/target_grammer.rb on lines 35..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 47.

                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

                      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 and 1 other location - About 1 hr to fix
                lib/graphite/target_grammer.rb on lines 23..33

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

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

                Severity
                Category
                Status
                Source
                Language