Class MailChimp
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class MailChimp < BaseOAuth
# Required for all datasources
DATASOURCE_NAME = 'mailchimp'
Method validate_callback
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def validate_callback(params)
code = params.fetch('code')
if code.nil? || code == ''
raise "Empty callback code"
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 get_resources_list
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_resources_list(filter=[])
raise UninitializedError.new('No API client instantiated', DATASOURCE_NAME) unless @api_client.present?
all_results = []
offset = 0
- 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_callback
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate_callback(params)
code = params.fetch('code')
if code.nil? || code == ''
raise "Empty callback code"
end
Method get_resource_metadata
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_resource_metadata(id)
raise UninitializedError.new('No API client instantiated', DATASOURCE_NAME) unless @api_client.present?
item_data = {}
- 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 get_resources_list
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_resources_list(filter=[])
raise UninitializedError.new('No API client instantiated', DATASOURCE_NAME) unless @api_client.present?
all_results = []
offset = 0
Method store_subscriber_if_opened
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def store_subscriber_if_opened(input_fields='[]', subscribers)
contents = ::JSON.parse(input_fields)
contents.each { |subject, actions|
unless actions.length == 0
actions.each { |action|
- 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"