Showing 57 of 114 total issues
Method set_odd
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def set_odd(client, team, data, user, v = nil)
Method set_timezone
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def set_timezone(client, team, data, user, v = nil)
Method set_message
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def set_message(client, team, data, user, v = nil)
if user.team_admin? && v
team.update_attributes!(sup_message: v.to_s)
client.say(channel: data.channel, text: "Now using a custom S'Up message. _#{team.sup_message}_")
elsif v && team.sup_message
- 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_api_token
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def unset_api_token(client, team, data, user)
if !team.api?
set_api(client, team, data, user)
elsif user.team_admin? && team.api_token
team.update_attributes!(api_token: nil)
- 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_timezone
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def set_timezone(client, team, data, user, v = nil)
if user.team_admin? && v
timezone = ActiveSupport::TimeZone.new(v)
raise SlackSup::Error, "TimeZone _#{v}_ is invalid, see https://github.com/rails/rails/blob/v#{ActiveSupport.gem_version}/activesupport/lib/active_support/values/time_zone.rb#L30 for a list. Team S'Up timezone is currently #{team.sup_tzone}." unless timezone
- 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
Avoid too many return
statements within this function. Open
return false
Avoid too many return
statements within this function. Open
if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'
Method sort
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def sort(coll, options = {})
sort_order = sort_order(options)
unless sort_order.empty?
if coll.respond_to?(:asc) && coll.respond_to?(:desc)
sort_order.each do |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_day
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_day(client, team, data, user, v = nil)
if user.team_admin? && v
team.update_attributes(sup_wday: Date.parse(v).wday)
client.say(channel: data.channel, text: "Team S'Up is now on #{team.sup_day}.")
elsif v
- 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_custom_profile_team_field
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_custom_profile_team_field(client, team, data, user, v = nil)
if user.team_admin? && v
team.update_attributes!(team_field_label: v)
client.say(channel: data.channel, text: "Custom profile team field is now _#{team.team_field_label}_.")
elsif v
- 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_sync
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_sync(client, team, data, user, v = nil)
if user.team_admin? && v
case v
when 'now' then
team.update_attributes!(sync: true)
- 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_size
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_size(client, team, data, user, v = nil)
if user.team_admin? && v
team.update_attributes!(sup_size: v.to_i)
client.say(channel: data.channel, text: "Team S'Up now connects groups of #{team.sup_size} people.")
elsif v
- 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_opt_in
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_opt_in(client, team, data, user, v = nil)
raise ArgumentError, "Invalid value: #{v}." unless ['in', 'out', nil].include?(v)
if user.team_admin? && v
team.update_attributes!(opt_in: v == 'in')
- 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_recency
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_recency(client, team, data, user, v = nil)
if user.team_admin? && v
team.update_attributes!(sup_recency: v.to_i)
client.say(channel: data.channel, text: "Now taking special care to not pair the same people more than every #{team.sup_recency_s}.")
elsif v
- 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 remind!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def remind!
return unless channel_id
messages = slack_client.conversations_history(channel: channel_id, limit: 3).messages
return unless messages.size <= 1
- 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_followup_day
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_followup_day(client, team, data, user, v = nil)
if user.team_admin? && v
team.update_attributes(sup_followup_wday: Date.parse(v).wday)
client.say(channel: data.channel, text: "Team S'Up followup day is now on #{team.sup_followup_day}.")
elsif v
- 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_weeks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_weeks(client, team, data, user, v = nil)
if user.team_admin? && v
team.update_attributes!(sup_every_n_weeks: v.to_i)
client.say(channel: data.channel, text: "Team S'Up is now every #{team.sup_every_n_weeks_s}.")
elsif v
- 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"