Method validates_configuration
has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring. Open
def validates_configuration
format_triggers_on(:scope_filter) if scope_filter.present?
unless requires(:name, :translator)
if event.present?
unless translator.type == :Import || requires(:data_type_scope)
- 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
File flow.rb
has 537 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'nokogiri'
module Setup
class Flow
# = Flow
Method translate_export
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
def translate_export(message, &block)
limit = translator.try(:bulk_source) ? lot_size || 1000 : 1
source_scope = sources(message)
max = source_scope.count - 1
translation_options = 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 simple_translate
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def simple_translate(message, &block)
unless (options = message[:options]).is_a?(Hash)
options = {}
end
task = message[:task]
- 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 source_ids_from
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def source_ids_from(message)
if (object_ids = message[:object_ids])
object_ids
elsif (id = message[:source_id])
[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"
Further reading
Class Flow
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Flow
# = Flow
#
# Defines how data is processed by the execution of one or more actions.
Method validates_configuration
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validates_configuration
format_triggers_on(:scope_filter) if scope_filter.present?
unless requires(:name, :translator)
if event.present?
unless translator.type == :Import || requires(:data_type_scope)
Method translate_export
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
def translate_export(message, &block)
limit = translator.try(:bulk_source) ? lot_size || 1000 : 1
source_scope = sources(message)
max = source_scope.count - 1
translation_options = nil
Method translate_import
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def translate_import(message, &block)
options =
{
headers: message['headers'] || {},
parameters: message['parameters'] || {},
- 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 simple_translate
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def simple_translate(message, &block)
unless (options = message[:options]).is_a?(Hash)
options = {}
end
task = message[:task]
Method translate_import
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def translate_import(message, &block)
options =
{
headers: message['headers'] || {},
parameters: message['parameters'] || {},
Method source_ids_from
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def source_ids_from(message)
if (object_ids = message[:object_ids])
object_ids
elsif (id = message[:source_id])
[id]
Method selector_from
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def selector_from(message)
if (selector = message[:selector])
if selector.is_a?(Hash) || selector.is_a?(Array)
selector
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 translate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def translate(message, &block)
if translator.present?
begin
flow_execution = current_thread_cache
flow_execution << (message[:execution_graph] || {}).merge('trigger_flow_id' => id.to_s)
- 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 deeply nested control flow statements. Open
unless scope_evaluator.parameters.first.name == 'scope'
errors.add(:scope_evaluator, "argument name should be 'scope'")
end
Avoid deeply nested control flow statements. Open
if response_translator.data_type
rejects(:response_data_type)
else
requires(:response_data_type)
end
Method process
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def process(message = {}, &block)
execution_graph = current_thread_cache.last || {}
if (trigger_flow_id = execution_graph['trigger_flow_id'])
execution_graph[trigger_flow_id] ||= []
adjacency_list = execution_graph[trigger_flow_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"
Further reading
Method scope_symbol
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def scope_symbol
if data_type_scope.present?
if data_type_scope.start_with?('Event')
:event_source
elsif data_type_scope.start_with?('Filter')
- 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"