Showing 81 of 180 total issues
Method handle_create_with_match
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def handle_create_with_match()
regex = resource[:match] ? Regexp.new(resource[:match]) : nil
match_count = lines.select { |l| regex.match(l) }.size
if match_count > 1 && resource[:multiple].to_s != 'true'
raise Puppet::Error, "More than one line in file '#{resource[:path]}' matches pattern '#{resource[:match]}'"
- 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 14 (exceeds 5 allowed). Consider refactoring. Open
def create
if !@resource.value(:source)
init_repository(@resource.value(:path))
else
clone_repository(@resource.value(:source), @resource.value(:path))
- 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 general_args
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def general_args
debug "Current resource: %s" % resource.class
args = []
resource_list = self.class.instance_variable_get('@resource_list')
Method command
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def command()
if ((! resource[:unless]) or (resource[:unless].empty?))
if (resource.refreshonly?)
# So, if there's no 'unless', and we're in "refreshonly" mode,
# we need to return the target command here. If we don't,
- 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
Function constructOrderProperty
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function constructOrderProperty() {
// Make default sort order(s) more flexible!
if (is_array($this->order)) {
foreach ($this->order as $field => $fieldOrDir) {
if (is_numeric($field)) { // Format is: $this->order = array('Model.field ASC', 'Model.second DESC');
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
def create
allvalidchains do |t, chain, table, protocol|
if chain =~ InternalChains
# can't create internal chains
warning "Attempting to create internal chain #{@resource[: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 cache_lookup
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def cache_lookup(file)
cache = load_cache
return nil if cache.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 testEditPostRequestInvalidData
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testEditPostRequestInvalidData() {
$blogId = '53c69fd8-5840-45d9-add0-7cb374524da5';
$blogTitle = 'This is an edited blog record';
Method icmp_name_to_number
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def icmp_name_to_number(value_icmp, protocol)
if value_icmp =~ /\d{1,2}$/
value_icmp
elsif protocol == 'inet'
case value_icmp
Method testEditPostRequestInvalidData
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testEditPostRequestInvalidData() {
$tagId = '53bccb61-6244-4799-a9ce-5ef974524da5';
$tagTitle = 'This is an edited tag record';
Method get_revision
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_revision(rev)
if !working_copy_exists?
create
end
at_path do
- 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 init_repository
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def init_repository(path)
check_force
if @resource.value(:ensure) == :bare && working_copy_exists?
convert_working_copy_to_bare
elsif @resource.value(:ensure) == :present && bare_exists?
- 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 privileges=
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def privileges=(privs)
unless row_exists?
create_row
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 users
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.users(name, vhost)
@users = {} unless @users
unless @users[name]
@users[name] = {}
rabbitmqctl('list_user_permissions', name).split(/\n/)[1..-2].each do |line|
- 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 testSendExample
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testSendExample() {
$recipients = array();
$vars = array();
$this->Email->expects($this->once())
->method('send')
Method provideEnumListArgs
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function provideEnumListArgs() {
$properties = array(
'field1' => array(
'f1-opt1' => 'Field 1, Option 1',
'f1-opt2' => 'Field 1, Option 2',
Method testBalance
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
public function testBalance($basePrice, $couponBool, $couponValue, $couponType, $cancelationInsuranceBool, $cancelationInsurancePercent, $internationalFeeBool, $internationalFee, $expectedOutput) {
Method testEditPostRequestValidData
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function testEditPostRequestValidData() {
$blogId = '53c69fd8-5840-45d9-add0-7cb374524da5';
$blogTitle = 'This is an edited blog record';
$Blogs = $this->generate('Blogs', array(
Method insert_order
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def insert_order
debug("[insert_order]")
rules = []
# Find list of current rules based on chain and table
Method script_parser
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def script_parser(file)
result = cache_lookup(file)
ttl = cache_time(file)
unless result
- 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"