lib/spiceweasel/extract_local.rb
Method resolve_cookbooks
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.resolve_cookbooks(berkshelf_cookbooks = {})
require "solve"
loader = Chef::CookbookLoader.new(Spiceweasel::Config[:cookbook_dir])
loader.load_cookbooks
books = loader.cookbooks_by_name
Method parse_objects
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def self.parse_objects # rubocop:disable CyclomaticComplexity
objects = {}
# BERKSHELF
berksfile = parse_berkshelf(objects)
- 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_data_bags
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def self.parse_data_bags
data_bags = []
Dir.glob("data_bags/*").each do |data_bag_full_path|
next unless File.directory?(data_bag_full_path)
data_bag = data_bag_full_path.split("/").last
- 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"