Showing 18 of 32 total issues
File datasource.rb
has 409 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative '../configuration'
# A class for JBoss datasource provider
module PuppetX::Coi::Jboss::Provider::Datasource
include PuppetX::Coi::Jboss::Constants
Class AbstractJbossCli
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class PuppetX::Coi::Jboss::Provider::AbstractJbossCli < Puppet::Provider
include PuppetX::Coi::Jboss::Checks
DEFAULT_SHELL_EXECUTOR = PuppetX::Coi::Jboss::Internal::Executor::ShellExecutor.new
# Default constructor that will also initialize 3 external object, system_runner, compilator and command executor
Method ensure
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ensure
trace 'ensure'
exists?
if @data.nil?
Method exists?
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def exists?
trace 'exists?'
if @clean
return (not @data.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
Method ensure
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def ensure
trace 'ensure'
exists?
if @data.nil?
- 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 exists?
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exists?
trace 'exists?'
if @clean
return (not @data.nil?)
end
Method fetch_securtydomain_state
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def fetch_securtydomain_state
data = @state
fetched_state = PuppetX::Coi::Jboss::Internal::State::SecurityDomainState.new
if data['security-domain'][(@resource[:name]).to_s]
if data['security-domain'][(@resource[:name]).to_s]['cache-type'].nil?
- 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 resolve_state
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def resolve_state(actual_data, resource)
@state = actual_data
unless actual_data.key? 'security-domain'
Puppet.debug('There is no securitydomain at all')
return false
Method read
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def read
map = nil
cfgfile = configfile
unless cfgfile.nil?
is_bool = lambda { |value| !/^(true|false)$/.match(value).nil? }
- 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 properties=
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def properties= newprops
trace 'properties=(%s)' % newprops.inspect
# Sorting by value to process `nil` values first
sorted = newprops.sort do |a, b|
- 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 properties
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def properties
trace 'properties()'
if @data.nil?
traceout 'properties()', {}
- 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
Avoid too many return
statements within this method. Open
return :enabled
Avoid too many return
statements within this method. Open
return :disabled
Avoid too many return
statements within this method. Open
return :present
Method build_main_command
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def build_main_command
res = @resource
correct_cmd = correct_command_template_begining(res)
options = []
res[:moduleoptions].keys.sort.each do |key|
- 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 prepare_resource
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def prepare_resource
@resource = {} if @resource.nil?
@resource[:name] = @property_hash[:name] if @resource[:name].nil?
@resource[:controller] = controller if @resource[:controller].nil?
@resource[:runasdomain] = runasdomain if @resource[:runasdomain].nil?
- 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 to_bool
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_bool
str = if @target.respond_to?(:empty?)
@target
else
@target.to_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 servergroups
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def servergroups
return @resource[:servergroups] unless @resource[:runasdomain]
return @servergroups unless @servergroups.nil?
state = execute("deployment-info --name=#{@resource[:name]}")
return [] unless state.success?
- 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"