Showing 52 of 56 total issues
Method puppet_environments
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def puppet_environments
Initializer.load
conf = Puppet.settings.instance_variable_get(:@values)
env = { }
- 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 a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def self.run!(options={})
set options
handler = detect_rack_handler
handler_name = handler.name.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 ast_to_value
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def ast_to_value value
unless value.class.name.start_with? "Puppet::Parser::AST::"
# Native Ruby types
case value
# Supported with exact JSON equivalent
- 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 loadSubnetData
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def loadSubnetData subnet
super
conf = format((@config+@leases).split("\n"))
# scan for host statements
conf.scan(/host\s+(\S+\s*\{[^}]+\})/) do |host|
- 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
Class Subnet
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Subnet
attr_reader :network, :netmask, :server, :timestamp
attr_accessor :options
include Proxy::DHCP
Method bmc_setup
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def bmc_setup
raise "Smart Proxy is not configured to support BMC control" unless SETTINGS.bmc
# Either use the default provider or allow user to specify provider in request
- 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 report
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def report msg, response, error_only
if response.grep(/completed successfully/).empty?
if response.grep /class name being used is unknown/
logger.info "Vendor class not found"
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
Class IPMI
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class IPMI < Base
include Proxy::Log
def self.installed?(provider)
# check with the lib to see if at least one provider is installed
Class Base
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Base
# This is the base class for bmc control. Treat this class as an interface
def initialize(args)
@host = connect(args)
Method dhcp_setup
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def dhcp_setup
raise "Smart Proxy is not configured to support DHCP" unless SETTINGS.dhcp
case SETTINGS.dhcp_vendor.downcase
when "isc"
require 'proxy/dhcp/server/isc'
- 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_response
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def validate_response cmd, operand, response
unless response[-3..-2].join=~/Command completed successfully/
logger.error "Invoke failed:\n" + response.join("\n")
scopeIpAddress, ip = cmd.match(/ScopeIpAddress=([^&]+)&ReservedIP=([^&]+)/)[1..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 create
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def create
nsupdate "connect"
@resolver = Resolv::DNS.new(:nameserver => @server)
case @type
- 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 puppet_environments
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
def puppet_environments
Initializer.load
conf = Puppet.settings.instance_variable_get(:@values)
env = { }
Method scan_manifest
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def scan_manifest manifest, filename = '', parser = nil
klasses = []
# Get a Puppet Parser to parse the manifest source
unless parser
Initializer.load
- 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 ast_to_value
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ast_to_value value
unless value.class.name.start_with? "Puppet::Parser::AST::"
# Native Ruby types
case value
# Supported with exact JSON equivalent
Method report
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def report msg, response=""
if response.nil? or (!response.empty? and !response.grep(/can't|no more|not connected|Syntax error/).empty?)
logger.error "Omshell failed:\n" + (response.nil? ? "No response from DHCP server" : response.join(", "))
msg.sub! /Removed/, "remove"
msg.sub! /Added/, "add"
- 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 tcp_pingable?
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def tcp_pingable? ip
# This code is from net-ping, and stripped down for use here
# We don't need all the ldap dependencies net-ping brings in
@service_check = true
- 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 loadSubnetData
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def loadSubnetData subnet
super
cmd = "scope #{subnet.network} show reservedip"
msg = "Enumerated hosts on #{subnet.network}"
- 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 loadSubnetData
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def loadSubnetData subnet
raise "invalid Subnet" unless subnet.is_a? Proxy::DHCP::Subnet
cmd = "ListReservation" + "&ScopeIpAddress=#{subnet.network}"
operand = "enumerate #{subnet.network} on #{@name}"
- 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 log_halt
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def log_halt code=nil, exception=nil
message = exception.is_a?(String) ? exception : exception.to_s
begin
if block_given?
return yield
- 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"