Class Stream
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Stream < Socket
include Enumerable
# The "sync mode" of the stream
#
Method read
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def read(size=nil, buf=nil)
if size == 0
if buf
buf.clear
return buf
- 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 stream.rb
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Celluloid
module IO
# Base class of all streams in Celluloid::IO
class Stream < Socket
include Enumerable
Method gets
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def gets(eol=$/, limit=nil)
idx = @read_buffer.index(eol)
until @eof
break if idx
- 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 do_write
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def do_write(s)
@write_buffer << s
@write_buffer.force_encoding(Encoding::BINARY)
if @sync or @write_buffer.size > BLOCK_SIZE or idx = @write_buffer.rindex($/)
- 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 readpartial
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def readpartial(maxlen, buf=nil)
if maxlen == 0
if buf
buf.clear
return buf
- 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 syswrite
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def syswrite(string)
length = string.length
total_written = 0
remaining = string
- 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"