Method cover?
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def cover?(value)
compare = ->(a, b) {
a <=> b || 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 step
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def step(n = undefined)
%x{
function coerceStepSize() {
if (n == null) {
n = 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 step
has 79 lines of code (exceeds 30 allowed). Consider refactoring. Open
def step(n = undefined)
%x{
function coerceStepSize() {
if (n == null) {
n = 1;
Method include?
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def include?(val)
if `self.begin.$$is_number || self.end.$$is_number` ||
@begin.is_a?(::Time) || @end.is_a?(::Time) ||
::Integer.try_convert(@begin) || ::Integer.try_convert(@end)
return cover?(val)
- 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 each
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def each(&block)
return enum_for(:each) { size } unless block_given?
%x{
var i, limit;
- 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 size
has 31 lines of code (exceeds 30 allowed). Consider refactoring. Open
def size
%x{
var b = this.begin, e = this.end;
// If begin is Numeric
Method min
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Wontfix
def min
if @begin.nil?
::Kernel.raise ::RangeError, 'cannot get the minimum of beginless range'
elsif block_given?
super
- 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 max
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Wontfix
def max
if @end.nil?
::Kernel.raise ::RangeError, 'cannot get the maximum of endless range'
elsif block_given?
super
- 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 true if @end.nil?
Avoid too many return
statements within this method. Open
return !val_max.nil? && compare.call(val_max, @end) <= 0
Avoid too many return
statements within this method. Open
return false if @begin && compare.call(@begin, value) > 0