File bootstrapper.rb
has 598 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative 'schema_file_updater'
require_relative 'version'
module ForestLiana
class Bootstrapper
Method setup_stripe_integration
has 169 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setup_stripe_integration(collection_name_and_field)
collection_name = collection_name_and_field.split('.')[0]
model_name = ForestLiana.name_for(collection_name.constantize)
# TODO: Remove once lianas prior to 2.0.0 are not supported anymore.
model_name_old = ForestLiana.name_old_for(collection_name.constantize)
Method send_apimap
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def send_apimap(with_feedback=false)
if ForestLiana.env_secret && ForestLiana.env_secret.length != 64
FOREST_LOGGER.error "Your env_secret does not seem to be correct. " \
"Can you check on Forest that you copied it properly in the " \
"forest_liana initializer?"
- 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 Bootstrapper
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class Bootstrapper
SCHEMA_FILENAME = File.join(Dir.pwd, '.forestadmin-schema.json')
def initialize(reset_api_map = false)
if reset_api_map
Method send_apimap
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def send_apimap(with_feedback=false)
if ForestLiana.env_secret && ForestLiana.env_secret.length != 64
FOREST_LOGGER.error "Your env_secret does not seem to be correct. " \
"Can you check on Forest that you copied it properly in the " \
"forest_liana initializer?"
Method setup_intercom_integration
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setup_intercom_integration(collection_name)
model_name = ForestLiana.name_for(collection_name.constantize)
# TODO: Remove once lianas prior to 2.0.0 are not supported anymore.
model_name_old = ForestLiana.name_old_for(collection_name.constantize)
Method check_integrations_setup
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def check_integrations_setup
if stripe_integration?
if stripe_integration_valid? || stripe_integration_deprecated?
ForestLiana.integrations[:stripe][:mapping] =
cast_to_array(ForestLiana.integrations[:stripe][:mapping])
- 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 setup_mixpanel_integration
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setup_mixpanel_integration(collection_name_and_field)
collection_name = collection_name_and_field.split('.')[0]
model_name = ForestLiana.name_for(collection_name.constantize)
field_attributes = { is_filterable: false , is_virtual: true, is_sortable: false }
Method initialize
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Wontfix
def initialize(reset_api_map = false)
if reset_api_map
ForestLiana.apimap = []
ForestLiana.models = []
end
Method check_integrations_setup
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_integrations_setup
if stripe_integration?
if stripe_integration_valid? || stripe_integration_deprecated?
ForestLiana.integrations[:stripe][:mapping] =
cast_to_array(ForestLiana.integrations[:stripe][:mapping])
Method generate_action_hooks
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def generate_action_hooks()
@collections_sent.each do |collection|
collection['actions'].each do |action|
c = get_collection(collection['name'])
unless c.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 initialize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize(reset_api_map = false)
if reset_api_map
ForestLiana.apimap = []
ForestLiana.models = []
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 fetch_model
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def fetch_model(model)
return if model.abstract_class?
return if ForestLiana.models.include?(model)
return unless analyze_model?(model)
- 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"