Showing 13 of 48 total issues
Class IncomingPhoneNumberSerializer
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class IncomingPhoneNumberSerializer < ResourceSerializer
def attributes
super.merge(
account_sid: nil,
address_requirements: nil,
File smart_encoding.rb
has 285 lines of code (exceeds 250 allowed). Consider refactoring. Open
class SmartEncoding
CHARACTERS = {
"\u00ab" => '"', # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
"\u00bb" => '"', # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
"\u201c" => '"', # LEFT DOUBLE QUOTATION MARK
Function exports
has 66 lines of code (exceeds 25 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')
Method valid?
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def valid?(value)
return true if value.blank? && options[:allow_blank]
return false unless format.match?(value)
uri = URI.parse(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 connect
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
connect() {
const picker = new AirDatepicker(
this.dateRangePickerTarget,
{
container: "#filters",
Method attributes
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def attributes
super.merge(
account_sid: nil,
address_requirements: nil,
address_sid: nil,
Method output
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def output
params = super
result = {}
result[:account] = account
- 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 display
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def display(resource, given_options = {})
serializer_class = options.delete(:serializer_class) || resource.jsonapi_serializer_class
decorator_class = options.delete(:decorator_class) || resource.decorator_class
serializer_options = options.delete(:serializer_options) || {}
if request.query_parameters.key?(:include)
- 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 set_defaults
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def set_defaults
return if carrier.blank?
return if number.blank?
self.currency ||= carrier.billing_currency
- 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 create_phone_number!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_phone_number!
phone_number = PhoneNumber.find_or_initialize_by(
number: data[:number],
carrier: import.carrier
)
- 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 cast
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def cast(value)
return if value.blank?
value.is_a?(Money::Currency) ? value : Money::Currency.new(value)
rescue Money::Currency::UnknownCurrency
- 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_each
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_each(record, attribute, value)
return record.errors.add(attribute, :blank) if value.blank?
return if record.number.blank?
return if value.to_sym.in?(record.number.e164? ? PhoneNumber::E164_TYPES : PhoneNumber::SHORT_CODE_TYPES)
- 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 manage_record?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def manage_record?
return false if record.blank?
return false if record.accepted_or_not_invited?
return carrier_account_users.exists?(record.id) || carrier_users.exists?(record.id) if carrier_owner?
return carrier_account_users.exists?(record.id) if carrier_admin?
- 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"