Showing 52 of 54 total issues
Method initialize
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def initialize(berksfile, source, **options)
@options = { timeout: api_timeout, open_timeout: [(api_timeout / 10), 3].max, ssl: {} }
@options.update(options)
case source
when String
- 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 initialize
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def initialize(**opts)
opts = opts.dup
opts[:ssl] ||= {}
chef_opts = {}
chef_opts[:rest_timeout] = opts[:timeout] if opts[:timeout] # opts[:open_timeout] is ignored on purpose
- 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 trusted?
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def trusted?
Berkshelf.log.info "Checking if lockfile is trusted"
checked = {}
Method upload
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upload(cookbooks)
Berkshelf.log.info "Starting upload"
Berkshelf.ridley_connection(options) do |connection|
# this is a hack to work around a bug in chef 13.0-13.2 protocol negotiation on POST requests, its only
Method apply
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def apply(name, options = {})
locks = graph.locks.inject({}) do |hash, (dep_name, dependency)|
hash[dep_name] = "= #{dependency.locked_version}"
hash
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 initialize
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(berksfile, source, **options)
@options = { timeout: api_timeout, open_timeout: [(api_timeout / 10), 3].max, ssl: {} }
@options.update(options)
case source
when String
Method cookbooks
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cookbooks(filter = nil)
skipped_cookbooks = []
cookbooks = storage_path.children.collect do |path|
begin
Semverse::Version.split(File.basename(path).slice(CachedCookbook::DIRNAME_REGEXP, 2))
Method ridley_connection
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ridley_connection(options = {}, &block)
ssl_options = {}
ssl_options[:verify] = if options[:ssl_verify].nil?
Berkshelf.config.ssl.verify
else
Method satisfies_transitive?
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def satisfies_transitive?(graph_item, checked, level = 0)
indent = " " * (level + 2)
Berkshelf.log.debug "#{indent}Checking transitive dependencies for #{graph_item}"
- 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 universe
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def universe
Dir.entries(cookbooks_path).sort.each_with_object([]) do |entry, cookbooks|
next if entry[0] == "." # Skip hidden folders.
entry_path = "#{cookbooks_path}/#{entry}"
- 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 sync
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def sync(source, destination, options = {})
unless File.directory?(source)
raise ArgumentError, "`source' must be a directory, but was a " \
"`#{File.ftype(source)}'! If you just want to sync a file, use " \
"the `copy' method instead."
- 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 dispatch
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def dispatch(meth, given_args, given_opts, config)
if given_args.length > 1 && !(given_args & Thor::HELP_MAPPINGS).empty?
command = given_args.first
if subcommands.include?(command)
- 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 cookbooks
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def cookbooks(filter = nil)
skipped_cookbooks = []
cookbooks = storage_path.children.collect do |path|
begin
Semverse::Version.split(File.basename(path).slice(CachedCookbook::DIRNAME_REGEXP, 2))
- 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 add_dependency
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_dependency(name, constraint = nil, options = {})
if @dependencies[name]
# Only raise an exception if the dependency is a true duplicate
groups = (options[:group].nil? || options[:group].empty?) ? [:default] : options[:group]
unless (@dependencies[name].groups & groups).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"
Further reading
Method uninstall_cookbook
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def uninstall_cookbook(cookbook, force = false)
unless options[:force] || (contingent = contingencies(cookbook)).empty?
contingent = contingent.map { |c| "#{c.cookbook_name} (#{c.version})" }.join(", ")
confirm = Berkshelf.ui.ask("[#{contingent}] depend on #{cookbook.cookbook_name}.\n\nAre you sure you want to continue? (y/N)")
- 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 add
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add(severity, message = nil, progname = nil, &block)
severity ||= Logger::UNKNOWN
if @logdev.nil? || severity < (@level)
return true
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 initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel)
Method outdated
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def outdated(*names, include_non_satisfying: false)
validate_lockfile_present!
validate_lockfile_trusted!
validate_dependencies_installed!
validate_cookbook_names!(names)
- 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 outdated
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def outdated(hash)
if hash.empty?
Berkshelf.ui.info("All cookbooks up to date!")
else
Berkshelf.ui.info("The following cookbooks have newer versions:")
- 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_cached!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_cached!(path)
unless File.cookbook?(path)
raise NotACookbook.new(path)
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"