Showing 6 of 8 total issues
Method map
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
def map
{
cookbook_file: {
it: { create_if_missing: IT_CREATE_IF_MISSING },
expect: { create_if_missing: EXPECT_CREATE_IF_MISSING }
Method generate_test_cases
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_test_cases(resources)
test_cases = []
resources.each do |resource|
verbs = resource.instance_variable_get(:@performed_actions)
if verbs.empty?
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(recipe, template_file, spec_helper_file, output_file, cookbook_path)
Method setup
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def setup
unless File.exist?(@recipe)
abort "Unable to locate recipe file (#{@recipe})"
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 get_it_block
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_it_block(noun, verb, adjective)
verb = 'ignore' if verb == :nothing
it = '%{verb}s the %{adjective} %{noun}'
noun_readable = noun.to_s.gsub('_', ' ')
verb_readable = verb.to_s.gsub('_', ' ')
- 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 generate_test_cases
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def generate_test_cases(resources)
test_cases = []
resources.each do |resource|
verbs = resource.instance_variable_get(:@performed_actions)
if verbs.empty?
- 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"