Showing 96 of 136 total issues
Method search_param
has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring. Open
def search_param
if @search
conditions = []
@resource.columns.each_with_index do |column, index|
- 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 serializer_for
has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring. Open
def serializer_for(active_record_class)
serializer = Class.new {
include ForestAdmin::JSONAPI::Serializer
def self_link
- 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 67 (exceeds 5 allowed). Consider refactoring. Open
def initialize filename, collections, meta
@filename = filename
@meta = meta
# NOTICE: Remove unecessary keys
- 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 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 serializer_for
has 224 lines of code (exceeds 25 allowed). Consider refactoring. Open
def serializer_for(active_record_class)
serializer = Class.new {
include ForestAdmin::JSONAPI::Serializer
def self_link
Method init_properties_with_default
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
def init_properties_with_default
@name_old ||= @name
@is_virtual ||= false
@icon ||= nil
@is_read_only ||= false
- 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 schema_adapter.rb
has 481 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ForestLiana
class SchemaAdapter
def initialize(model)
@model = model
end
Method initialize
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
def initialize(attributes = {})
if attributes.key?(:global)
FOREST_LOGGER.error "REMOVED OPTION: The support for Smart Action \"global\" option is now " \
"removed. Please set \"type: 'global'\" instead of \"global: true\" for the " \
"\"#{attributes[:name]}\" Smart 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"
Further reading
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 add_validations
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def add_validations(column_schema, column)
# NOTICE: Do not consider validations if a before_validation Active Records
# Callback is detected.
if @model._validation_callbacks.map(&:kind).include? :before
return column_schema
- 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 perform
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
def perform
raw_query = @params['query'].strip
LiveQueryChecker.new(raw_query, 'Live Query Chart').validate()
- 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 field
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def field(name, opts, &block)
# TODO: Handle empty name
if opts.key?(:isRequired)
FOREST_LOGGER.warn "DEPRECATION WARNING: isRequired on field \"#{name}\" is deprecated. Please use is_required."
- 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 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
File serializer_factory.rb
has 363 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'jsonapi-serializers'
module ForestLiana
class SerializerFactory
Method add_columns
has 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_columns
@model.columns.each do |column|
unless is_sti_column_of_child_model?(column)
field_schema = get_schema_for_column(column)
collection.fields << field_schema unless field_schema.nil?
Method relationship_related_link
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def relationship_related_link(attribute_name)
ret = {}
# Has many smart field
current = self.has_many_relationships[attribute_name]
- 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 pretty_print
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def pretty_print json, indentation = ""
result = ""
if json.kind_of? Array
result << "["
- 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 search_param
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
def search_param
if @search
conditions = []
@resource.columns.each_with_index do |column, index|
Method add_validations
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_validations(column_schema, column)
# NOTICE: Do not consider validations if a before_validation Active Records
# Callback is detected.
if @model._validation_callbacks.map(&:kind).include? :before
return column_schema