Method ParseOptions
has a Cognitive Complexity of 91 (exceeds 5 allowed). Consider refactoring. Open
def ParseOptions(options, parameters)
parameters ||= {}
ret = []
# parsing options
- 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 String.rb
has 461 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "yast"
module Yast
class StringClass < Module
include Yast::Logger
Class StringClass
has 43 methods (exceeds 20 allowed). Consider refactoring. Open
class StringClass < Module
include Yast::Logger
# @note it is ascii chars only
UPPER_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".freeze
Method ParseOptions
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ParseOptions(options, parameters)
parameters ||= {}
ret = []
# parsing options
Method FormatFilename
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def FormatFilename(file_path, len)
return nil unless file_path
return file_path if len && len > file_path.size
dir = file_path.split("/", -1)
- 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 find_longest_records
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def find_longest_records(items)
return [] unless items
# searching all rows
items.each_with_object([]) do |row, 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"
Further reading
Method CutRegexMatch
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def CutRegexMatch(input, regex, glob)
return "" if input.nil? || input.empty?
output = input
if Builtins.regexpmatch(output, regex)
- 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 FormatSizeWithPrecision
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def FormatSizeWithPrecision(bytes, precision, omit_zeroes)
return "" if bytes.nil?
units = [
# Byte abbreviated
- 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 deeply nested control flow statements. Open
elsif character == "\\\""
str << "\""
else
str << character
Avoid deeply nested control flow statements. Open
elsif character == "\\\""
str << "\""
else
str << character
Avoid deeply nested control flow statements. Open
str = CutBlanks(str) if remove_whitespace
Avoid deeply nested control flow statements. Open
ret << str if !unique || !Builtins.contains(ret, str)
Avoid deeply nested control flow statements. Open
str = (character == "\\\"") ? "\"" : character
Method Replace
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def Replace(input, source, target)
return nil if input.nil?
if source.nil? || source == ""
Builtins.y2warning("invalid parameter source: %1", source)
- 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 deeply nested control flow statements. Open
ret << str if !unique || !ret.include?(str)