Showing 181 of 329 total issues
Method split_bin
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def split_bin(new_table, i, node, node_hash)
bit = new_table.size >> 1 # bit to split on
run_bit = node_hash & bit
last_run = nil
low = nil
Method splitTreeBin
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private static void splitTreeBin(AtomicReferenceArray<Node> nextTab, int i, TreeBin t) {
int bit = nextTab.length() >>> 1;
TreeBin lt = new TreeBin();
TreeBin ht = new TreeBin();
int lc = 0, hc = 0;
- 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 splitTreeBin
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private static void splitTreeBin(Node[] nextTab, int i, TreeBin t) {
int bit = nextTab.length >>> 1;
TreeBin lt = new TreeBin();
TreeBin ht = new TreeBin();
int lc = 0, hc = 0;
- 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 split_bin
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def split_bin(new_table, i, node, node_hash)
bit = new_table.size >> 1 # bit to split on
run_bit = node_hash & bit
last_run = nil
low = nil
- 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 initialize_table
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def initialize_table
until current_table ||= table
if (size_ctrl = size_control) == NOW_RESIZING
Thread.pass # lost initialization race; just spin
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 toArray
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked") public final <T> T[] toArray(T[] a) {
long sz = map.mappingCount();
if (sz > (long)(MAX_ARRAY_SIZE))
throw new OutOfMemoryError(oomeMsg);
int m = (int)sz;
Method toArray
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked") public final <T> T[] toArray(T[] a) {
long sz = map.mappingCount();
if (sz > (long)(MAX_ARRAY_SIZE))
throw new OutOfMemoryError(oomeMsg);
int m = (int)sz;
Method attempt_compute
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def attempt_compute(key, hash, current_table, i, node, node_hash)
added = false
current_table.try_lock_via_hash(i, node, node_hash) do
predecessor_node = nil
while true
Method getTreeNode
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked") final TreeNode getTreeNode
(int h, RubyObject k, TreeNode p) {
RubyClass c = k.getMetaClass(); boolean kNotComparable = !k.respondsTo("<=>");
while (p != null) {
int dir, ph; RubyObject pk; RubyClass pc;
Method tryAwaitLock
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
final void tryAwaitLock(AtomicReferenceArray<Node> tab, int i) {
if (tab != null && i >= 0 && i < tab.length()) { // sanity check
int r = ThreadLocalRandom.current().nextInt(); // randomize spins
int spins = MAX_SPINS, h;
while (tabAt(tab, i) == this && ((h = hash) & LOCKED) != 0) {
Method tryAwaitLock
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
final void tryAwaitLock(Node[] tab, int i) {
if (tab != null && i >= 0 && i < tab.length) { // sanity check
int r = ThreadLocalRandom.current().nextInt(); // randomize spins
int spins = MAX_SPINS, h;
while (tabAt(tab, i) == this && ((h = hash) & LOCKED) != 0) {
Method getTreeNode
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked") final TreeNode getTreeNode
(int h, RubyObject k, TreeNode p) {
RubyClass c = k.getMetaClass(); boolean kNotComparable = !k.respondsTo("<=>");
while (p != null) {
int dir, ph; RubyObject pk; RubyClass pc;
Method clear
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def clear
return self unless current_table = table
current_table_size = current_table.size
deleted_count = i = 0
while i < current_table_size
Method get_or_default
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_or_default(key, else_value = nil)
hash = key_hash(key)
current_table = table
while current_table
node = current_table.volatile_get_by_hash(hash)
- 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 attempt_internal_replace
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def attempt_internal_replace(key, expected_old_value, hash, current_table, i, node, node_hash)
Method attempt_get_and_set
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def attempt_get_and_set(key, value, hash, current_table, i, node, node_hash)
Avoid deeply nested control flow statements. Open
if ((pr = p.right) != null && h >= pr.hash && (r = getTreeNode(h, k, pr)) != null)
return r;
// try to continue iterating on the left side
else if ((pl = p.left) != null && h <= pl.hash)
dir = -1;
Method compare_and_set
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def compare_and_set(old_value, new_value)
return false unless @___mutex.try_lock
begin
return false unless @___value.equal? old_value
@___value = new_value
- 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 writeObject
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@SuppressWarnings("unchecked") private void writeObject(java.io.ObjectOutputStream s)
throws java.io.IOException {
if (segments == null) { // for serialization compatibility
segments = (Segment<K,V>[])
new Segment<?,?>[DEFAULT_CONCURRENCY_LEVEL];
- 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
if (count >= TREE_THRESHOLD)
replaceWithTreeBin(tab, i, k);