Showing 58 of 126 total issues
File bootstrap.js
has 1587 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* Bootstrap v3.3.6 (http://getbootstrap.com)
* Copyright 2011-2015 Twitter, Inc.
* Licensed under the MIT license
*/
Class Team
has 36 methods (exceeds 20 allowed). Consider refactoring. Open
class Team
field :gifs, type: Boolean, default: true
field :api, type: Boolean, default: false
field :aliases, type: Array, default: []
field :dead_at, type: DateTime
Method find_by_slack_mention!
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def self.find_by_slack_mention!(client, user_name)
team = client.owner
slack_id = slack_mention?(user_name)
user = if slack_id
team.users.where(user_id: slack_id).first
- 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
Method sort_order
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def sort_order(options = {})
params[:sort] = options[:default_sort_order] unless params[:sort]
return [] unless params[:sort]
sort_order = params[:sort].to_s
- 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
Method set_nickname
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def set_nickname(client, data, user, v)
target_user = user
slack_mention = v.split.first if v
if v && User.slack_mention?(slack_mention)
raise SlackGamebot::Error, "You're not a captain, sorry." unless user.captain?
- 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
Class Challenge
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Challenge
include Mongoid::Document
include Mongoid::Timestamps
index(state: 1, channel: 1)
Function show
has 54 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)
Method find_create_or_update_by_slack_id!
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def self.find_create_or_update_by_slack_id!(client, slack_id)
instance = User.where(team: client.owner, user_id: slack_id).first
users_info = client.web_client.users_info(user: slack_id)
instance_info = Hashie::Mash.new(users_info).user if users_info
if users_info && instance
- 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
Method paginate_by_cursor
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def paginate_by_cursor(coll, &_block)
raise 'Both cursor and offset parameters are present, these are mutually exclusive.' if params.key?(:offset) && params.key?(:cursor)
results = { results: [], next: nil }
size = (params[:size] || 10).to_i
- 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 slide
has 44 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 || this.getItemForDirection(type, $active)
var isCycling = this.interval
var direction = type == 'next' ? 'left' : 'right'
Method check
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.check(pair)
pair_n = if pair.include?(':')
pair.split(':') if pair.include?(':')
elsif pair.include?('-')
pair.split('-')
- 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 backdrop
has 39 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) {
Function show
has 39 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)
Function activate
has 38 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.length && $active.hasClass('fade') || !!container.find('> .fade').length)
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')
Method check_subscribed_teams!
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def check_subscribed_teams!
Team.where(subscribed: true, :stripe_customer_id.ne => nil).each do |team|
if team.subscribed? && team.stripe_customer.subscriptions.none?
logger.info "No active subscriptions for #{team} (#{team.stripe_customer_id}), downgrading."
team.inform_admin! 'Your subscription was canceled and your team has been downgraded. Thank you for being a customer!'
- 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
Method stripe_customer_subscriptions_info
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def stripe_customer_subscriptions_info(with_unsubscribe = false)
stripe_customer.subscriptions.map do |subscription|
amount = ActiveSupport::NumberHelper.number_to_currency(subscription.plan.amount.to_f / 100)
current_period_end = Time.at(subscription.current_period_end).strftime('%B %d, %Y')
if subscription.status == 'active'
- 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
Method unset_nickname
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def unset_nickname(client, data, user, v)
target_user = user
slack_mention = v.split.first if v
if User.slack_mention?(slack_mention)
raise SlackGamebot::Error, "You're not a captain, sorry." unless user.captain?
- 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
Method to_s
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def to_s
wins_s = "#{wins} win#{wins == 1 ? '' : 's'}"
losses_s = "#{losses} loss#{losses == 1 ? '' : 'es'}"
ties_s = "#{ties} tie#{ties == 1 ? '' : 's'}" if ties && ties > 0
elo_s = "elo: #{team_elo}"
- 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 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