Showing 446 of 1,255 total issues
Method update_state
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_state
if self.won? && !self.expired?
newstate = "passed"
elsif !self.won? && !self.expired?
newstate = "open"
- 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 mentioned_users
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def mentioned_users
users = []
TextFilters::UserMentionFilter.mentioned_usernames_in(self.body, self.wip.product) do |username, u|
if u
users << u if u && u != user
- 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 time_left_text
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def time_left_text
days = ((self.expiration - Time.now)/86400).to_i.abs
if days == 0
days = ((self.expiration - Time.now)/3600).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
Method add_backreferences
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_backreferences
TextFilters::UserMentionFilter.mentioned_usernames_in(body, wip.product) do |_, user, interest|
if interest && interest.slug != 'core'
interest.members_in_product(wip.product).each do |user|
wip.watch!(user)
- 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 toggle
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def toggle
interest = params[:interest]
return respond_with :nothing, status: 403 if !INTEREST_WHITELIST.include?(interest)
- 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 perform
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def perform(product_id)
product = Product.find_by(id: product_id)
if product
AssemblyCoin::MaintainBtcBalance.new.perform(product_id)
- 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"