Showing 98 of 164 total issues
Method aozora_user
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def aozora_user
return unless ao_importable?
return @aozora_user if @aozora_user
return Zorro::DB::User.find(_id: @user.ao_id).first if @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 annotate_with_reason
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def annotate_with_reason(act)
if act['target'].is_a?(Post)
user_id = act['target'].user_id
group_id = act['target'].target_group_id
act['reason'] = 'media'
- 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 validate_each
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_each(record, attribute, value)
ama = if value.respond_to?(:post)
AMA.for_original_post(value.post).first
elsif value.is_a?(Post)
AMA.for_original_post(value).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 strip_unused
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def strip_unused(activity_groups)
activity_groups.each do |group|
return activity_groups unless group['activities']
next unless STRIPPED_VERBS.include?(group['verb'])
group['activities'] = [group['activities'].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 ao_importable?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def ao_importable?
# No Conflict
return true if kitsu_user.blank?
# Post-conflict (chose Aozora)
return false if kitsu_user.ao_imported
- 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 sign_in
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def sign_in
return @signed_in unless @signed_in.nil?
@agent.get('https://myanimelist.net/login.php') do |login_page|
# Already logged 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 update?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update?
return false unless user
return false if user.has_role?(:banned)
return true if can_administrate?
return false if record.locked?
- 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 follow
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def follow(source, target)
return false unless ENV['STREAMLOG_REDIS_URL']
return unless log_follow?(source, target)
source = rewrite_feed(*source)
target = rewrite_feed(*target)
- 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 progress_limit
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def progress_limit
return unless progress
progress_cap = media&.progress_limit
default_cap = [media&.default_progress_limit, 50].compact.max
- 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 auto_query_for
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def auto_query_for(field, value)
value = value.first if value.is_a?(Array) && value&.count == 1
case value
when Range
- 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 is_owner?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def is_owner? # rubocop:disable Naming/PredicateName
return false unless user && record.respond_to?(:user)
return false unless record.user_id == user.id
return false if record.user_id_was && record.user_id_was != user.id
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 fill_defaults
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def fill_defaults(activity)
activity.tap do |act|
act.actor ||= user
act.object ||= library_entry
act.to ||= []
- 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 missing_engagement_ids
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def missing_engagement_ids
data = @entries.completed.joins(JOINS).group(GROUP).pluck(PLUCK)
data.each_with_object(
attributes: [],
- 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 validate_each
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_each(record, attr, value)
if value.respond_to?(:each)
value.each do |v|
error = validate_value(v)
record.errors.add(attr, message: error) if error
- 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 method. Open
return false if banned_from_group?
Avoid too many return
statements within this method. Open
return :unreleased if start_date&.future?
Avoid too many return
statements within this method. Open
return false if group.closed? && !member?
Avoid too many return
statements within this method. Open
return false if group.closed? && !member?
Avoid too many return
statements within this method. Open
return false if user.flags.banned?
Avoid too many return
statements within this method. Open
return false if banned_from_group?