Showing 8 of 8 total issues
Class ReadmeModel
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class ReadmeModel
DEFAULT_CONSTRAINT = ">= 0.0.0".freeze
attr_reader :libraries
Method initialize
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(cookbook_dir, config)
@metadata = Chef::Cookbook::Metadata.new
@metadata.from_file("#{cookbook_dir}/#{config[:metadata]}")
Method initialize
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def initialize(cookbook_dir, config)
@metadata = Chef::Cookbook::Metadata.new
@metadata.from_file("#{cookbook_dir}/#{config[:metadata]}")
- 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_properties
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def load_properties
code = IO.read(@filename)
code.gsub(/^ *define (.*?) (?=do)/m) do
all = $1.split(' ', 2)
@name = all.shift.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 load_descriptions
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load_descriptions
resource_data = IO.read(@filename)
# find all attributes
resource_data.gsub(/#{ATTRIBUTE_REGEX}/) do
Method load_descriptions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def load_descriptions
current_section = 'main'
@native_resource.description.each_line do |line|
if /^ *\@action *([^ ]*) (.*)$/ =~ line
action_descriptions[$1] = $2.strip
- 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_descriptions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def load_descriptions
current_section = 'main'
description = extract_description
description.each_line do |line|
if /^ *\@section (.*)$/ =~ line
- 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 actions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def actions
return @actions unless @actions.nil?
if default_action.is_a?(Array)
@actions = @native_resource.actions
- 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"