Showing 8 of 30 total issues
Method valid_value
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def self.valid_value(subject, valid_values, opt={})
raise ArgumentError, "valid_values must not be nil!" if valid_values.nil?
if valid_values.kind_of? Regexp
return true if subject =~ valid_values
end
- 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_csv_command_line_options
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.parse_csv_command_line_options(
executable, args, opt={ csv_options: { headers: :first_row,
header_converters: :symbol,
skip_blanks: true,
col_sep: ",",
Method validate_hr_xml
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.validate_hr_xml(xml_filename)
ret_val = false
# validate the resulting XML file against the official XSD schema
uri = URI 'https://raw.githubusercontent.com/KualiCo/ce-tech-docs/master/v2_0/hrmanifest.xsd'
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
Method parse_string
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.parse_string(str, opt={ strict: true, required: false })
opt[:strict] = true if opt[:strict].nil?
retval = encode str.to_s.strip
if opt[:required] && retval.empty?
raise KualiCo::ETL::error TextParseError.new "Required data element '#{opt[:name]}' not found: '#{str}'"
- 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_csv_command_line_options
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.parse_csv_command_line_options(
executable, args, opt={ csv_options: { headers: :first_row,
header_converters: :symbol,
skip_blanks: true,
col_sep: ",",
- 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_boolean
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.parse_boolean(str, opt={})
return true if str == true
return false if str == false
b = parse_string str, opt
return true if b =~ /^(active|a|true|t|yes|y|1)$/i
- 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 opt[:default]
Avoid too many return
statements within this method. Open
return nil