Showing 13 of 44 total issues
File bootstrap.js
has 1190 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*!
* Bootstrap v3.0.3 (http://getbootstrap.com)
* Copyright 2013 Twitter, Inc.
* Licensed under http://www.apache.org/licenses/LICENSE-2.0
*/
Method acts_as_flaggable
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def acts_as_flaggable(options = {})
Detour::Feature.class_eval <<-EOF
has_one :#{table_name}_percentage_flag,
class_name: "Detour::PercentageFlag",
inverse_of: :feature,
Function slide
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
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'
Method change
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def change
create_table :detour_features do |t|
t.string :name
t.text :flag_in_counts, default: "{}"
t.text :opt_out_counts, default: "{}"
Function show
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Tooltip.prototype.show = function () {
var e = $.Event('show.bs.'+ this.type)
if (this.hasContent() && this.enabled) {
this.$element.trigger(e)
Function applyPlacement
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Tooltip.prototype.applyPlacement = function(offset, placement) {
var replace
var $tip = this.tip()
var width = $tip[0].offsetWidth
var height = $tip[0].offsetHeight
Method update_attributes
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def update_attributes(params)
Detour::Feature.transaction do |transaction|
features.map do |feature|
feature_params = params[:features][feature.name]
next unless feature_params
- Read upRead up
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
Open
Collapse.prototype.show = function () {
if (this.transitioning || this.$element.hasClass('in')) return
var startEvent = $.Event('show.bs.collapse')
this.$element.trigger(startEvent)
Function backdrop
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Modal.prototype.backdrop = function (callback) {
var that = this
var animate = this.$element.hasClass('fade') ? 'fade' : ''
if (this.isShown && this.options.backdrop) {
Function show
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Modal.prototype.show = function (_relatedTarget) {
var that = this
var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
this.$element.trigger(e)
Function activate
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Tab.prototype.activate = function (element, container, callback) {
var $active = container.find('> .active')
var transition = callback
&& $.support.transition
&& $active.hasClass('fade')
Consider simplifying this complex logical expression. Open
Open
if (autoPlace) {
var $parent = this.$element.parent()
var orgPlacement = placement
var docScroll = document.documentElement.scrollTop || document.body.scrollTop
Avoid too many return
statements within this function. Open
Open
return this