jclem/active_record_rollout

View on GitHub

Showing 44 of 44 total issues

File bootstrap.js has 1190 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * Bootstrap v3.0.3 (http://getbootstrap.com)
 * Copyright 2013 Twitter, Inc.
 * Licensed under http://www.apache.org/licenses/LICENSE-2.0
 */
Severity: Major
Found in app/assets/javascripts/detour/bootstrap.js - About 3 days to fix

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

      Tooltip.prototype.enter = function (obj) {
        var self = obj instanceof this.constructor ?
          obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
    
        clearTimeout(self.timeout)
    Severity: Major
    Found in app/assets/javascripts/detour/bootstrap.js and 1 other location - About 1 day to fix
    app/assets/javascripts/detour/bootstrap.js on lines 1200..1213

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

    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

      Tooltip.prototype.leave = function (obj) {
        var self = obj instanceof this.constructor ?
          obj : $(obj.currentTarget)[this.type](this.getDelegateOptions()).data('bs.' + this.type)
    
        clearTimeout(self.timeout)
    Severity: Major
    Found in app/assets/javascripts/detour/bootstrap.js and 1 other location - About 1 day to fix
    app/assets/javascripts/detour/bootstrap.js on lines 1185..1198

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

    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

    $(document).on('click', '.delete-feature', function (e) {
      var href    = $(e.currentTarget).data('path'),
          feature = $(e.currentTarget).closest('td').next().text(),
          $modal  = $('#delete-feature'),
          $name   = $modal.find('.feature-name'),
    Severity: Major
    Found in app/assets/javascripts/detour/delete_feature.js and 1 other location - About 6 hrs to fix
    app/assets/javascripts/detour/delete_flag.js on lines 1..11

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

    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

    $(document).on('click', '.delete-flag', function (e) {
      var href    = $(e.currentTarget).data('path'),
          id      = $(e.currentTarget).closest('td').next().text(),
          $modal  = $('#delete-flag'),
          $id     = $modal.find('.flaggable-identifier'),
    Severity: Major
    Found in app/assets/javascripts/detour/delete_flag.js and 1 other location - About 6 hrs to fix
    app/assets/javascripts/detour/delete_feature.js on lines 1..11

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

    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 4 locations. Consider refactoring.
    Open

      $.fn.scrollspy = function (option) {
        return this.each(function () {
          var $this   = $(this)
          var data    = $this.data('bs.scrollspy')
          var options = typeof option == 'object' && option
    Severity: Major
    Found in app/assets/javascripts/detour/bootstrap.js and 3 other locations - About 4 hrs to fix
    app/assets/javascripts/detour/bootstrap.js on lines 1444..1453
    app/assets/javascripts/detour/bootstrap.js on lines 1562..1571
    app/assets/javascripts/detour/bootstrap.js on lines 1966..1975

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

    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 4 locations. Consider refactoring.
    Open

      $.fn.affix = function (option) {
        return this.each(function () {
          var $this   = $(this)
          var data    = $this.data('bs.affix')
          var options = typeof option == 'object' && option
    Severity: Major
    Found in app/assets/javascripts/detour/bootstrap.js and 3 other locations - About 4 hrs to fix
    app/assets/javascripts/detour/bootstrap.js on lines 1444..1453
    app/assets/javascripts/detour/bootstrap.js on lines 1562..1571
    app/assets/javascripts/detour/bootstrap.js on lines 1710..1719

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

    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 4 locations. Consider refactoring.
    Open

      $.fn.tooltip = function (option) {
        return this.each(function () {
          var $this   = $(this)
          var data    = $this.data('bs.tooltip')
          var options = typeof option == 'object' && option
    Severity: Major
    Found in app/assets/javascripts/detour/bootstrap.js and 3 other locations - About 4 hrs to fix
    app/assets/javascripts/detour/bootstrap.js on lines 1562..1571
    app/assets/javascripts/detour/bootstrap.js on lines 1710..1719
    app/assets/javascripts/detour/bootstrap.js on lines 1966..1975

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

    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 4 locations. Consider refactoring.
    Open

      $.fn.popover = function (option) {
        return this.each(function () {
          var $this   = $(this)
          var data    = $this.data('bs.popover')
          var options = typeof option == 'object' && option
    Severity: Major
    Found in app/assets/javascripts/detour/bootstrap.js and 3 other locations - About 4 hrs to fix
    app/assets/javascripts/detour/bootstrap.js on lines 1444..1453
    app/assets/javascripts/detour/bootstrap.js on lines 1710..1719
    app/assets/javascripts/detour/bootstrap.js on lines 1966..1975

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

    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

      $.fn.alert = function (option) {
        return this.each(function () {
          var $this = $(this)
          var data  = $this.data('bs.alert')
    
    
    Severity: Major
    Found in app/assets/javascripts/detour/bootstrap.js and 1 other location - About 3 hrs to fix
    app/assets/javascripts/detour/bootstrap.js on lines 801..809

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

    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

      $.fn.dropdown = function (option) {
        return this.each(function () {
          var $this = $(this)
          var data  = $this.data('bs.dropdown')
    
    
    Severity: Major
    Found in app/assets/javascripts/detour/bootstrap.js and 1 other location - About 3 hrs to fix
    app/assets/javascripts/detour/bootstrap.js on lines 136..144

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

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

      def acts_as_flaggable(options = {})
        Detour::Feature.class_eval <<-EOF
          has_one :#{table_name}_percentage_flag,
            class_name: "Detour::PercentageFlag",
            inverse_of: :feature,
    Severity: Major
    Found in lib/detour/acts_as_flaggable.rb - About 3 hrs to fix

      Function slide has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        Carousel.prototype.slide = function (type, next) {
          var $active   = this.$element.find('.item.active')
          var $next     = next || $active[type]()
          var isCycling = this.interval
          var direction = type == 'next' ? 'left' : 'right'
      Severity: Minor
      Found in app/assets/javascripts/detour/bootstrap.js - About 1 hr to fix

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

          $(window).on('load', function () {
            $('[data-spy="scroll"]').each(function () {
              var $spy = $(this)
              $spy.scrollspy($spy.data())
            })
        Severity: Major
        Found in app/assets/javascripts/detour/bootstrap.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/detour/bootstrap.js on lines 490..495

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

        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

          $(window).on('load', function () {
            $('[data-ride="carousel"]').each(function () {
              var $carousel = $(this)
              $carousel.carousel($carousel.data())
            })
        Severity: Major
        Found in app/assets/javascripts/detour/bootstrap.js and 1 other location - About 1 hr to fix
        app/assets/javascripts/detour/bootstrap.js on lines 1736..1741

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

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

          def change
            create_table :detour_features do |t|
              t.string :name
              t.text    :flag_in_counts, default: "{}"
              t.text    :opt_out_counts, default: "{}"
        Severity: Minor
        Found in lib/generators/templates/migration.rb - About 1 hr to fix

          Function show has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            Tooltip.prototype.show = function () {
              var e = $.Event('show.bs.'+ this.type)
          
              if (this.hasContent() && this.enabled) {
                this.$element.trigger(e)
          Severity: Minor
          Found in app/assets/javascripts/detour/bootstrap.js - About 1 hr to fix

            Function applyPlacement has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              Tooltip.prototype.applyPlacement = function(offset, placement) {
                var replace
                var $tip   = this.tip()
                var width  = $tip[0].offsetWidth
                var height = $tip[0].offsetHeight
            Severity: Minor
            Found in app/assets/javascripts/detour/bootstrap.js - About 1 hr to fix

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

                def update_attributes(params)
                  Detour::Feature.transaction do |transaction|
                    features.map do |feature|
                      feature_params = params[:features][feature.name]
                      next unless feature_params
              Severity: Minor
              Found in lib/detour/flag_form.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 show has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                Collapse.prototype.show = function () {
                  if (this.transitioning || this.$element.hasClass('in')) return
              
                  var startEvent = $.Event('show.bs.collapse')
                  this.$element.trigger(startEvent)
              Severity: Minor
              Found in app/assets/javascripts/detour/bootstrap.js - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language