Showing 97 of 163 total issues
Method image_field
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def image_field(key, **options)
options = {
type: Types::Image,
null: true
}.merge(options)
- 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 parameter
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def parameter(key, cast: nil, load: nil, required: false)
# Set up the accessor
attr_accessor(key)
# Track all the attributes we've set up so far
- 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 apply_order_to
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def apply_order_to(scope)
return scope unless orders
# Replace _text_match with _text_match(buckets: 6),user_count in the same direction
# This generally gives significantly better results for media searches
- 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_unenriched
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def strip_unenriched(activities, includes)
activities.map do |act|
if act['activities'] # Recurse into activity groups
act['activities'] = strip_unenriched(act['activities'], includes)
else
- 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 apply_order_to
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def apply_order_to(scope)
return scope unless orders
# Replace _text_match with _text_match(buckets: 6),user_count in the same direction
# This generally gives significantly better results for media searches
- 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_average_ratings
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_average_ratings
#
# Bayesian rating:
#
# (total + (MIN * global_average)) / (count + MIN)
Method create?
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def create?
return false unless user
return false if user.unregistered?
return false if user&.blocked?(record.post.user)
return false if user&.has_role?(:banned)
- 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 decrement
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def decrement(user, library_entry)
record = user.stats.find_by(type: "Stat::#{media_type}FavoriteYear")
return unless record
return if record.stats_data['total_media'].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 auto_query_for
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def auto_query_for(field, value)
case value
when String, Numeric, Date
{ match: { field => 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 apply!
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def apply!
data.each do |item|
item = item.deep_symbolize_keys
puts item[:titles][:canonical].titleize
- 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 detailed_users
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.detailed_users
Zorro::DB::User.find.batch_size(2000).aggregate([
{
'$addFields': {
detailsId: {
Method apply_status_filter_for
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def apply_status_filter_for(scope)
return scope if filters[:status].blank?
statuses = filters[:status].map do |status|
case status
Method apply_status_filter_for
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def apply_status_filter_for(scope)
return scope if filters[:status].blank?
statuses = filters[:status].map do |status|
case status
Method to_a
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def to_a
return @data if @termination_reason
@termination_reason = loop do
break :iterations if @pages >= 10
- 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 query
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def query(field, opts = {})
field = field.to_sym
# For some reason, #filter(verify:) is supposed to return the values to
# use. I cannot honestly figure out why this is the case, so we provide
- 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_in_batches
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def update_in_batches(updates = {}, of: 10000, **kwargs)
updates = updates.merge(kwargs) if updates.is_a?(Hash)
relation = self
relation = relation.reorder(batch_order).limit(of)
batch_relation = relation
- 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 query
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def query(field, opts = {})
field = field.to_sym
# For some reason, #filter(verify:) is supposed to return the values to
# use. I cannot honestly figure out why this is the case, so we provide
- 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 load_query_records
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def load_query_records(query, opts = {})
include_directives = opts[:include_directives]
unless include_directives
return _search_service ? query.to_a : query.load.to_a
end
- 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 load_query_records
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def load_query_records(query, opts = {})
include_directives = opts[:include_directives]
unless include_directives
return @_search_service ? query.to_a : query.load.to_a
end
- 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 index
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index(ids)
Manga.where(id: ids).includes(:media_categories, :genres).find_each do |manga|
titles = manga.titles_list
yield({