Showing 7 of 7 total issues
Method quote
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def quote(value, column = nil) #:nodoc:
return super unless column
sql_type = type_to_sql(column.type, column.limit, column.precision, column.scale)
- 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 type_cast
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def type_cast(value, column, array_member = false)
return super(value, column) unless column
case value
when Range
- 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 quote
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
def quote(value, column = nil) #:nodoc:
return super unless column
sql_type = type_to_sql(column.type, column.limit, column.precision, column.scale)
Method type_cast
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def type_cast(value, column, array_member = false)
return super(value, column) unless column
case value
when Range
Method it_acts_as_create_command
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def it_acts_as_create_command
let(:response) { subject.class.run(params) }
let(:resource_plural) { subject.Serializer.plural_key }
let(:resource_singular) { subject.Serializer.singular_key }
Method run
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def run
@response = RestPack::Service::Response.new
begin
init
- 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
Avoid too many return
statements within this method. Open
return super(value, column) unless ['inet','cidr'].include? column.sql_type