src/main/org/bson_ruby/ByteBuf.java
File ByteBuf.java
has 422 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*
* Copyright (C) 2015-2020 MongoDB Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
ByteBuf
has 36 methods (exceeds 20 allowed). Consider refactoring. Open
Open
public class ByteBuf extends RubyObject {
/**
* Constant for a null byte.
*/
Method writeCharacters
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private int writeCharacters(final String string) {
int len = string.length();
int total = 0;
for (int i = 0; i < len;) {
Method putCString
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
@JRubyMethod(name = "put_cstring")
public ByteBuf putCString(ThreadContext context, final IRubyObject value) throws UnsupportedEncodingException {
if (value instanceof RubyFixnum) {
RubyString str = ((RubyFixnum) value).to_s();
- 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 writeCharacters
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
private int writeCharacters(final String string) {
int len = string.length();
int total = 0;
for (int i = 0; i < len;) {
- 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"