Showing 4 of 4 total issues
Method get_object_value
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.get_object_value(yaml, key_addr)
if !key_addr.index('.').nil? && key_addr.index('.') >= 0
key1, key2 = key_addr.split('.', 2)
return get_object_value(yaml[key1], key2) if !yaml[key1].nil? && yaml[key1].instance_of?(Hash)
return 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"
Further reading
Method check_and_requires
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def check_and_requires
yaml_key = ParseBot.get_object_value(yaml_file, key['key'])
return if yaml_key.nil? || key['and_requires'].nil?
key['and_requires'].each do |k|
next unless ParseBot.get_object_value(yaml_file, k).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"
Further reading
Method load_yaml
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def load_yaml
raise StandardError, 'No YAML file specified' if @options[:file].nil?
raise IOError unless File.exist?(@options[:file])
@validation_bot.yaml_file = YAML.load_file(@options[:file])
rescue IOError
- 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_rules
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_rules
raise ValidationError, '.yamlbot rules file is not set.' if @rules.nil?
raise ValidationError, 'rules section not defined in .yamlbot file' if @rules['rules'].nil?
validate_rules_keys(@rules['defaults']) unless @rules['defaults'].nil?
if @rules['rules'].instance_of?(Array)
- 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"