Showing 157 of 338 total issues
Method check_hidden
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_hidden(liquid_layout, field)
if field == :liquid_layout_id
return 'hidden' unless liquid_layout.primary_layout
elsif field == :follow_up_liquid_layout_id
return 'hidden' unless liquid_layout.post_action_layout
- 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 build
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.build(bt_result, page_id, member_id, existing_customer, save_customer = true, store_in_vault = false)
Method create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create
recaptcha_resp = verify_recaptcha(secret_key: Settings.recaptcha2.secret_key)
unless recaptcha_resp
error = { base: [I18n.t('call_tool.errors.recaptcha_fail')] }
- 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 ensure_required_fields
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ensure_required_fields
ensure_has_a_form
REQUIRED_FIELDS.each do |field|
next unless fields_with_name(field).empty?
- 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 payment_options
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def payment_options
{
nonce: params.require(:payment_method_nonce),
amount: params.require(:amount).to_f,
user: user_params,
- 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 run
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def run
sanitize_params!
@page = Page.find(@params[:page_id])
build_call_record
validate_target if errors.blank?
- 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 clone
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.clone(page, title = nil, language_id = nil, override_forms = false, exclude_shares = false)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(bt_result, page_id, member_id, existing_customer, save_customer = true, store_in_vault: false)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(page, title = nil, language_id = nil, override_forms = false, exclude_shares = false)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(params, variant_type, page, url = nil, id = nil)
Method write_transaction
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def write_transaction(bt_result, page_id, member_id, existing_customer, save_customer = true, store_in_vault: false)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(plan, page_slug, follow_up_liquid_layout_id, follow_up_page_slug, extra_params = nil)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(bt_customer, bt_payment_method, member_id, existing_customer, store_in_vault)
Method create_action
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_action
action_params = {
page: page
}.merge(@extra_attrs)
- 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 csv
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def csv
rows = @actions.map do |action|
keys.map do |k|
value = val(k, action)
value.is_a?(String) && value.index(COMMA).present? ? "\"#{value}\"" : value
- 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
Function targets
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const targets = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(id => {
const country = id < 5 ? 'United States' : 'Canada';
let state;
if (country === 'United States') {
state = id < 3 ? 'California' : 'New York';
- 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 parse_interpolation
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_interpolation(query)
params = {}
depth = 0
_, translation_key, string_params = /([^,]+)(.*)/.match(query).to_a
while string_params.present? && !string_params.empty?
- 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 all_params
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def all_params
# this method flattens a lot of nested data from one object per form element
# to one object per entity (page, share variant, etc) to modify
#
# this is pretty janky but it's the best I can do moving quickly
- 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
Function exports
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function(api) {
var validEnv = ['development', 'test', 'production'];
var currentEnv = api.env();
var isDevelopmentEnv = api.env('development');
var isProductionEnv = api.env('production');
- 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 round
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def round(values)
values.map do |value|
value = value.to_f
if value < 20
- 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"