Showing 3 of 3 total issues
Method set_label
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def set_label
label_parts = []
@name_parts.each_with_index do |attribute_name_part, index|
if attribute_name_part == "and" || attribute_name_part == "or"
- 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_max_length
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_max_length
column = @class.columns.find { |column_i| column_i.name == attribute_name }
return unless column
return unless column.sql_type.include?("int")
- 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 calculate_as
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def calculate_as
column = @class.columns_hash[@attribute_name]
if @opts[:as].present?
@as = @opts.fetch(:as).to_s
- 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"