jclem/active_record_rollout

View on GitHub

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

    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

        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

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

                  Modal.prototype.backdrop = function (callback) {
                    var that    = this
                    var animate = this.$element.hasClass('fade') ? 'fade' : ''
                
                    if (this.isShown && this.options.backdrop) {
                Severity: Minor
                Found in app/assets/javascripts/detour/bootstrap.js - About 1 hr to fix

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

                    Modal.prototype.show = function (_relatedTarget) {
                      var that = this
                      var e    = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
                  
                      this.$element.trigger(e)
                  Severity: Minor
                  Found in app/assets/javascripts/detour/bootstrap.js - About 1 hr to fix

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

                      Tab.prototype.activate = function (element, container, callback) {
                        var $active    = container.find('> .active')
                        var transition = callback
                          && $.support.transition
                          && $active.hasClass('fade')
                    Severity: Minor
                    Found in app/assets/javascripts/detour/bootstrap.js - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                            if (autoPlace) {
                              var $parent = this.$element.parent()
                      
                              var orgPlacement = placement
                              var docScroll    = document.documentElement.scrollTop || document.body.scrollTop
                      Severity: Major
                      Found in app/assets/javascripts/detour/bootstrap.js - About 40 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            return this
                        Severity: Major
                        Found in app/assets/javascripts/detour/bootstrap.js - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language