Showing 54 of 54 total issues
Method try_download
has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring. Open
def try_download(source, name, version)
unless ( remote_cookbook = source.cookbook(name, version) )
return nil
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
File lockfile.rb
has 449 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative "dependency"
require "chef/environment"
module Berkshelf
class Lockfile
File errors.rb
has 420 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Berkshelf
class BerkshelfError < StandardError
class << self
# @param [Integer] code
def set_status_code(code)
File cli.rb
has 384 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative "../berkshelf"
require_relative "config"
require_relative "commands/shelf"
module Berkshelf
Method try_download
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
def try_download(source, name, version)
unless ( remote_cookbook = source.cookbook(name, version) )
return nil
end
Class Berksfile
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class Berksfile
class << self
# Instantiate a Berksfile from the given options. This method is used
# heavily by the CLI to reduce duplication.
#
Method upload
has a Cognitive Complexity of 24 (exceeds 5 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
- 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
File berksfile.rb
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative "packager"
require "chef/cookbook/chefignore"
require "chef/util/path_helper"
Class Lockfile
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Lockfile
class << self
# Initialize a Lockfile from the given filepath
#
# @param [String] filepath
Method trusted?
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def trusted?
Berkshelf.log.info "Checking if lockfile is trusted"
checked = {}
- 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 pretty_print
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def pretty_print
[].tap do |a|
a.push " Name: #{cookbook_name}" if name && name =~ /\S/
a.push " Version: #{version}" if version && version =~ /\S/
a.push " Description: #{metadata.description}" if metadata.description && metadata.description =~ /\S/
- 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 pretty_hash
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def pretty_hash
{}.tap do |h|
h[:name] = cookbook_name if cookbook_name && cookbook_name =~ /\S/
h[:version] = version if version && version =~ /\S/
h[:description] = description if description && description =~ /\S/
- 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 reduce!
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def reduce!
Berkshelf.log.info "Reducing lockfile"
Berkshelf.log.debug "Current lockfile:"
Berkshelf.log.debug ""
- 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 reduce!
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def reduce!
Berkshelf.log.info "Reducing lockfile"
Berkshelf.log.debug "Current lockfile:"
Berkshelf.log.debug ""
Method run
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def run
@parsed_dependencies = {}
contents = File.read(@lockfile.filepath)
- 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 run
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
@parsed_dependencies = {}
contents = File.read(@lockfile.filepath)
Method ridley_connection
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def ridley_connection(options = {}, &block)
ssl_options = {}
ssl_options[:verify] = if options[:ssl_verify].nil?
Berkshelf.config.ssl.verify
else
- 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 15 (exceeds 5 allowed). Consider refactoring. Open
def initialize(path = self.class.path)
# this is a bit tricky, mixlib-config wants to extend a class and create effectively a global config object while
# what we want to do is use an instance, so we create an anonymous class and shove it into an instance variable.
# this is actually similar to what mixlib-config itself does to create config contexts.
@klass = Class.new
- 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 extended
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.extended(base)
base.class_exec do
config_strict_mode true
config_context :api do
default :timeout, "30"
Method sync
has 41 lines of code (exceeds 25 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."