Showing 4 of 4 total issues
Method extended
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.extended(base)
class << base
alias_method :search, :nazrin_search unless method_defined? :search
alias_method :searchable, :nazrin_searchable unless method_defined? :searchable
alias_method :batch_operation, :nazrin_batch_operation unless method_defined? :batch_operation
- 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 batch
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def batch(operations)
ActiveSupport::Deprecation.warn 'config.debug_mode is deprecated. Use config.mode = \'sandbox\' instead.' and return nil if Nazrin.config.debug_mode
return nil if Nazrin.config.mode == 'sandbox'
documents = operations.each_with_object([]) do |(type, tuple), arr|
Method deep_page?
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def deep_page?
if parameters[:start].present? && parameters[:size].present?
return true if parameters[:start] + parameters[:size] > CLOUD_SEARCH_MAX_LIMIT
elsif parameters[:start].present?
return true if parameters[:start] > CLOUD_SEARCH_MAX_LIMIT
- 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 accessor_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def accessor_for(clazz)
return nil if clazz.name.nil? || clazz.name.empty?
if clazz.respond_to?(:nazrin_searchable_config) && clazz.nazrin_searchable_config.domain_name
require 'nazrin/data_accessor/struct'
- 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"