Showing 3 of 3 total issues
Method convert_hash
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def convert_hash(answer)
answer.each_pair do |key, value|
case value
when String
if INT_FIELDS.include?(key.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"
Further reading
Method try_lo_load_defaults
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def try_lo_load_defaults
filename = "#{ENV['HOME']}/.regapi2"
props = %w[ username password lang pem pem_password ca_cert_path ]
if File.readable?(filename)
- 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_presence_of_required_fields
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def validate_presence_of_required_fields form, fields
absent_fields = []
fields.each_pair do |key, opts|
next unless opts[:required]
if !form.has_key?(key) || form[key].nil?
- 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"