Showing 24 of 35 total issues
File model.rb
has 421 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ArtirixDataModels
module Model
extend ActiveSupport::Concern
included do
File data_gateway.rb
has 367 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ArtirixDataModels::DataGateway
attr_reader :connection, :post_as_json
def initialize(connection: nil,
post_as_json: true,
Method connect
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def connect(method,
path:,
body: nil,
json_body: true,
timeout: 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
Class ADMRegistry
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class ArtirixDataModels::ADMRegistry
@instance_mutex = Mutex.new
def self.instance_mutex
ArtirixDataModels::ADMRegistry.instance_variable_get :@instance_mutex
Class BasicModelDAO
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class ArtirixDataModels::BasicModelDAO
include ArtirixDataModels::DAOConcerns::WithResponseAdaptors
include ArtirixDataModels::WithADMRegistry
attr_reader :model_name, :model_class, :paths_factory, :fake_mode_factory, :gateway_factory
Method build
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build
model = self.model
null = Naught.build do |config|
config.impersonate model
config.predicates_return false
File basic_model_dao.rb
has 280 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ArtirixDataModels::BasicModelDAO
include ArtirixDataModels::DAOConcerns::WithResponseAdaptors
include ArtirixDataModels::WithADMRegistry
attr_reader :model_name, :model_class, :paths_factory, :fake_mode_factory, :gateway_factory
Class DataGateway
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class ArtirixDataModels::DataGateway
attr_reader :connection, :post_as_json
def initialize(connection: nil,
post_as_json: true,
Class EsCollection
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class EsCollection
DEFAULT_SIZE = 10
CACHE_KEY_SECTION_SEPARATOR = '/'.freeze
CACHE_KEY_RESULT_SEPARATOR = '\\'.freeze
Method connection
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def connection(config: {},
url: nil,
login: nil,
password: nil,
bearer_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 call
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def call(method,
path,
authorization_bearer: nil,
authorization_token_hash: nil,
body: 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 call
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call(method,
path,
authorization_bearer: nil,
authorization_token_hash: nil,
body: nil,
Method mock_gateway_response
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def mock_gateway_response(response:,
method:,
path:,
body: nil,
json_body: 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 locate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.locate(comparator, object, result = [])
if object.is_a?(::Enumerable)
if object.any? { |value| match_comparator?(value, comparator, object) }
result.push object
else # DO NOT LOOK DEEPER ONCE FOUND IF THE VALUE FOUND IS A HASH (this will prevent us from properly recognising nested aggregations)!
- 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 connect
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def connect(method,
path:,
body: nil,
json_body: true,
timeout: nil,
Method get_cached_result
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_cached_result
return nil unless enabled?
c = cache_read
return nil unless c.present?
- 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 parse_response
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_response(result:, response_adaptor:, path:, method:, json_parse_response: true)
if result.blank?
parsed_response = nil
elsif json_parse_response
parsed_response = Oj.load result, symbol_keys: 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 initialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize(*args)
case args.size
when 0
message = nil
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 normalise_element
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def normalise_element(name, value)
return unless Hash === value
if value.key?(:buckets)
add_normalised_buckets_element_to_list(name, value)
- 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_options_from_config
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.set_options_from_config(service)
options = ArtirixDataModels.configuration.try(:cache_options)
if options
options = options.to_hash if options.respond_to?(:to_hash) && !options.respond_to?(:each)
options.each do |name, opts|
- 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"