Showing 96 of 136 total issues
Method render_csv
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render_csv getter, model
set_headers_file
set_headers_streaming
response.status = 200
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 get_previous_interval_condition
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def get_previous_interval_condition
current_previous_interval = nil
# NOTICE: Leaf condition at root
unless @filters['aggregator']
return @filters if @operator_date_parser.has_previous_interval?(@filters['operator'])
- 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 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform
begin
query = {
limit: limit,
starting_after: starting_after,
Method get_serializer_name
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.get_serializer_name(active_record_class)
if defined?(::Intercom::Conversation) &&
active_record_class == ::Intercom::Conversation
"ForestLiana::IntercomConversationSerializer"
elsif defined?(::Intercom::User) &&
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
def perform
add_columns
add_associations
collection.fields.sort_by!.with_index { |k, idx| [k[:field].to_s, idx] }
- 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 authenticate_user_from_jwt
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def authenticate_user_from_jwt
begin
if request.headers
if request.headers['Authorization']
token = request.headers['Authorization'].split.second
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
def perform
begin
@apimap = reorder_keys_basic(@apimap)
sort_array_of_objects(@apimap['data'])
@apimap['data'].map! do |collection|
- 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 add_associations
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def add_associations
SchemaUtils.associations(@model).each do |association|
begin
if SchemaUtils.polymorphic?(association) &&
collection.fields << {
- 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 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform
begin
@apimap = reorder_keys_basic(@apimap)
sort_array_of_objects(@apimap['data'])
@apimap['data'].map! do |collection|
Method perform
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform
begin
query = {
limit: limit,
starting_after: starting_after,
Method perform
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform(field_name, field_value)
result = @mixpanel.request(
'jql',
script: "function main() {
return People().filter(function (user) {
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 get_date_filter_for_previous_interval
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_date_filter_for_previous_interval(operator, value)
return nil unless has_previous_interval? operator
case operator
when OPERATOR_TODAY
Method serialize_collection
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def serialize_collection collection
collection_serialized = {
id: collection['name'],
type: 'collections',
attributes: {},
Method perform
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform
begin
query = {
limit: limit,
starting_after: starting_after,
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 fields_per_model
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def fields_per_model(params_fields, model)
if params_fields
if Rails::VERSION::MAJOR > 4
params_fields_hash = params_fields.to_unsafe_h
else
Method get_serializer_name
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.get_serializer_name(active_record_class)
if defined?(::Intercom::Conversation) &&
active_record_class == ::Intercom::Conversation
"ForestLiana::IntercomConversationSerializer"
elsif defined?(::Intercom::User) &&
Method get_ids_from_request
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.get_ids_from_request(params, user)
attributes = params.dig('data', 'attributes')
has_body_attributes = attributes != nil
is_select_all_records_query = has_body_attributes && attributes[:all_records] == true