Showing 16 of 26 total issues
ByteBuffer
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
public class ByteBuffer extends RubyObject {
private static final long serialVersionUID = -6903439483039149324L;
private java.nio.ByteBuffer byteBuffer;
public static RaiseException newOverflowError(ThreadContext context, String message) {
Method select
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def select(timeout = nil)
selected_monitors = Set.new
@lock.synchronize do
readers = [@wakeup]
- 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 symbolToInterestOps
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static int symbolToInterestOps(Ruby ruby, SelectableChannel channel, IRubyObject interest) {
if(interest == ruby.newSymbol("r")) {
if((channel.validOps() & SelectionKey.OP_ACCEPT) != 0) {
return SelectionKey.OP_ACCEPT;
} else {
- 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 select
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def select(timeout = nil)
selected_monitors = Set.new
@lock.synchronize do
readers = [@wakeup]
Method register
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
@JRubyMethod
public IRubyObject register(ThreadContext context, IRubyObject io, IRubyObject interests) {
Ruby runtime = context.getRuntime();
Channel rawChannel = RubyIO.convertToIO(context, io).getChannel();
Method doSelect
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private int doSelect(Ruby runtime, ThreadContext context, IRubyObject timeout) {
int result;
cancelKeys();
try {
- 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 select
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
@JRubyMethod
public synchronized IRubyObject select(ThreadContext context, IRubyObject timeout, Block block) {
Ruby runtime = context.getRuntime();
if(!this.selector.isOpen()) {
Method initialize
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def initialize(io, interests, selector)
unless defined?(::OpenSSL) && io.is_a?(::OpenSSL::SSL::SSLSocket)
unless io.is_a?(IO)
if IO.respond_to? :try_convert
io = IO.try_convert(io)
- 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 register
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
@JRubyMethod
public IRubyObject register(ThreadContext context, IRubyObject io, IRubyObject interests) {
Ruby runtime = context.getRuntime();
Channel rawChannel = RubyIO.convertToIO(context, io).getChannel();
- 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 select
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
@JRubyMethod
public synchronized IRubyObject select(ThreadContext context, IRubyObject timeout, Block block) {
Ruby runtime = context.getRuntime();
if(!this.selector.isOpen()) {
- 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 doSelect
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private int doSelect(Ruby runtime, ThreadContext context, IRubyObject timeout) {
int result;
cancelKeys();
try {
Method readFrom
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@JRubyMethod(name = "read_from")
public IRubyObject readFrom(ThreadContext context, IRubyObject io) {
Ruby runtime = context.runtime;
Channel channel = RubyIO.convertToIO(context, io).getChannel();
- 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 writeTo
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@JRubyMethod(name = "write_to")
public IRubyObject writeTo(ThreadContext context, IRubyObject io) {
Ruby runtime = context.runtime;
Channel channel = RubyIO.convertToIO(context, io).getChannel();
- 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 register
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def register(io, interest)
unless defined?(::OpenSSL) && io.is_a?(::OpenSSL::SSL::SSLSocket)
io = IO.try_convert(io)
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
Avoid too many return
statements within this method. Open
return SelectionKey.OP_ACCEPT;
Method close
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def close
@lock.synchronize do
return if @closed
begin
- 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"