Showing 7 of 55 total issues
File portsng.rb
has 373 lines of code (exceeds 250 allowed). Consider refactoring. Open
%w(vash portsutil backports).each do |p|
dir = File.join(File.dirname(__FILE__), "../../../../../#{p}/lib")
dir = File.expand_path(dir)
$LOAD_PATH.unshift(dir) if !$LOAD_PATH.include?(dir) && File.directory?(dir)
end
Method prepare_options
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def prepare_options(options, defaults, extra = [], deny = [])
return defaults.dup unless options
# handle {option => value} hashes and flatten nested arrays
options = options.collect do |x|
- 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 latest
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def latest
# If there's no "latest" version, we just return a placeholder
result = :latest
oldversion = properties[:ensure]
case portstatus
Method instances_from_package_records
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.instances_from_package_records(records, options)
packages = []
with_unique('installed ports', records) do |pkgname, rec|
unless rec[:portorigin] && ['<', '=', '>'].include?(rec[:portstatus])
rec.delete(:portorigin) if rec[:portorigin]
- 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 package_settings_validate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def package_settings_validate(opts)
return true unless opts # options not defined
options_class = Puppet::Util::PTomulik::Package::Ports::Options
unless opts.is_a?(Hash) || opts.is_a?(options_class)
raise ArgumentError, "#{opts.inspect} of type #{opts.class} is not an " \
- 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_package_setting
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_package_setting(key, value)
options_class = Puppet::Util::PTomulik::Package::Ports::Options
unless options_class.option_name?(key)
raise ArgumentError, "#{key.inspect} is not a valid option name (for" \
' $package_settings)'
- 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 latest
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def latest
# If there's no "latest" version, we just return a placeholder
result = :latest
oldversion = properties[:ensure]
case portstatus
- 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"