seyhunak/twitter-bootstrap-rails

View on GitHub

Showing 59 of 59 total issues

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

  Collapse.prototype.show = function () {
    if (this.transitioning || this.$element.hasClass('in')) return

    var activesData
    var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')
Severity: Minor
Found in app/assets/javascripts/twitter/bootstrap/collapse.js - About 1 hr to fix

    Method uri_state has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      def uri_state(uri, options={})
        return options[:status] if options.key?(:status)
    
        root_url = request.host_with_port + '/'
        root = uri == '/' || uri == root_url
    Severity: Minor
    Found in app/helpers/navbar_helper.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 applyPlacement has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

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

        Tab.prototype.show = function () {
          var $this    = this.element
          var $ul      = $this.closest('ul:not(.dropdown-menu)')
          var selector = $this.data('target')
      
      
      Severity: Minor
      Found in app/assets/javascripts/twitter/bootstrap/tab.js - About 1 hr to fix

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

          Affix.prototype.checkPosition = function () {
            if (!this.$element.is(':visible')) return
        
            var height       = this.$element.height()
            var offset       = this.options.offset
        Severity: Minor
        Found in app/assets/javascripts/twitter/bootstrap/affix.js - About 1 hr to fix

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

              function next() {
                $active
                  .removeClass('active')
                  .find('> .dropdown-menu > .active')
                    .removeClass('active')
          Severity: Minor
          Found in app/assets/javascripts/twitter/bootstrap/tab.js - About 1 hr to fix

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

              ScrollSpy.prototype.refresh = function () {
                var that          = this
                var offsetMethod  = 'offset'
                var offsetBase    = 0
            
            
            Severity: Minor
            Found in app/assets/javascripts/twitter/bootstrap/scrollspy.js - About 1 hr to fix

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

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

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

                    self.timeout = setTimeout(function () {
                      if (self.hoverState == 'in') self.show()
                    }, self.options.delay.show)
                Severity: Major
                Found in app/assets/javascripts/twitter/bootstrap/tooltip.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/twitter/bootstrap/tooltip.js on lines 168..170

                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

                    self.timeout = setTimeout(function () {
                      if (self.hoverState == 'out') self.hide()
                    }, self.options.delay.hide)
                Severity: Major
                Found in app/assets/javascripts/twitter/bootstrap/tooltip.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/twitter/bootstrap/tooltip.js on lines 134..136

                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

                    $.support.transition && $parent.hasClass('fade') ?
                      $parent
                        .one('bsTransitionEnd', removeElement)
                        .emulateTransitionEnd(Alert.TRANSITION_DURATION) :
                      removeElement()
                Severity: Minor
                Found in app/assets/javascripts/twitter/bootstrap/alert.js and 1 other location - About 55 mins to fix
                app/assets/javascripts/twitter/bootstrap/tooltip.js on lines 332..336

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

                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

                  Popover.prototype.arrow = function () {
                    return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
                  }
                Severity: Minor
                Found in app/assets/javascripts/twitter/bootstrap/popover.js and 1 other location - About 55 mins to fix
                app/assets/javascripts/twitter/bootstrap/tooltip.js on lines 435..437

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

                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

                    $.support.transition && $tip.hasClass('fade') ?
                      $tip
                        .one('bsTransitionEnd', complete)
                        .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
                      complete()
                Severity: Minor
                Found in app/assets/javascripts/twitter/bootstrap/tooltip.js and 1 other location - About 55 mins to fix
                app/assets/javascripts/twitter/bootstrap/alert.js on lines 53..57

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

                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.arrow = function () {
                    return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
                  }
                Severity: Minor
                Found in app/assets/javascripts/twitter/bootstrap/tooltip.js and 1 other location - About 55 mins to fix
                app/assets/javascripts/twitter/bootstrap/popover.js on lines 74..76

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

                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.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
                Severity: Minor
                Found in app/assets/javascripts/twitter/bootstrap/tooltip.js and 1 other location - About 45 mins to fix
                app/assets/javascripts/twitter/bootstrap/tooltip.js on lines 72..72

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

                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 container_div has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def container_div(brand, brand_link, responsive, fluid, no_turbolink, &block)
                Severity: Minor
                Found in app/helpers/navbar_helper.rb - About 45 mins to fix

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

                          this.$element.on(eventIn  + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
                  Severity: Minor
                  Found in app/assets/javascripts/twitter/bootstrap/tooltip.js and 1 other location - About 45 mins to fix
                  app/assets/javascripts/twitter/bootstrap/tooltip.js on lines 73..73

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

                  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

                      title = $e.attr('data-original-title')
                        || (typeof o.title == 'function' ? o.title.call($e[0]) :  o.title)
                  Severity: Minor
                  Found in app/assets/javascripts/twitter/bootstrap/tooltip.js and 1 other location - About 40 mins to fix
                  app/assets/javascripts/twitter/bootstrap/popover.js on lines 68..71

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

                  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

                      return $e.attr('data-content')
                        || (typeof o.content == 'function' ?
                              o.content.call($e[0]) :
                              o.content)
                  Severity: Minor
                  Found in app/assets/javascripts/twitter/bootstrap/popover.js and 1 other location - About 40 mins to fix
                  app/assets/javascripts/twitter/bootstrap/tooltip.js on lines 413..414

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

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

                    $.fn.affix.noConflict = function () {
                      $.fn.affix = old
                      return this
                    }
                  Severity: Major
                  Found in app/assets/javascripts/twitter/bootstrap/affix.js and 8 other locations - About 40 mins to fix
                  app/assets/javascripts/twitter/bootstrap/alert.js on lines 83..86
                  app/assets/javascripts/twitter/bootstrap/button.js on lines 100..103
                  app/assets/javascripts/twitter/bootstrap/carousel.js on lines 199..202
                  app/assets/javascripts/twitter/bootstrap/collapse.js on lines 190..193
                  app/assets/javascripts/twitter/bootstrap/dropdown.js on lines 149..152
                  app/assets/javascripts/twitter/bootstrap/modal.js on lines 311..314
                  app/assets/javascripts/twitter/bootstrap/scrollspy.js on lines 156..159
                  app/assets/javascripts/twitter/bootstrap/tab.js on lines 137..140

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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language