Method resolve_weak_types
has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring. Open
def resolve_weak_types
run_count = @runs.size
previous_level = @base_embedding
run_count.times do |run_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 compute_explicit_levels
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def compute_explicit_levels
current_embedding = @base_embedding
# The directional override is a Character directionality
# constant. -1 means there is no override.
- 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 resolve_neutral_types
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
def resolve_neutral_types
# This implements rules N1 and N2.
run_count = get_run_count
previous_level = @base_embedding
- 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 bidi.rb
has 345 lines of code (exceeds 250 allowed). Consider refactoring. Open
module TwitterCldr
module Shared
class Bidi
attr_reader :types, :levels, :string_arr
Method compute_explicit_levels
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
def compute_explicit_levels
current_embedding = @base_embedding
# The directional override is a Character directionality
# constant. -1 means there is no override.
Method resolve_weak_types
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def resolve_weak_types
run_count = @runs.size
previous_level = @base_embedding
run_count.times do |run_idx|
Method reorder_visually!
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def reorder_visually!
raise "No string given!" unless @string_arr
# Do this explicitly so we can also find the maximum depth at the
# same time.
- 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 compute_paragraph_embedding_level
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def compute_paragraph_embedding_level
# First check to see if the user supplied a directionality override.
if [:LTR, :RTL].include?(@direction)
@direction == :LTR ? 0 : 1
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 reinsert_formatting_codes
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def reinsert_formatting_codes
if @formatter_indices
input = @length
output = @levels.size
- 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 resolve_neutral_types
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def resolve_neutral_types
# This implements rules N1 and N2.
run_count = get_run_count
previous_level = @base_embedding
Method reorder_visually!
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def reorder_visually!
raise "No string given!" unless @string_arr
# Do this explicitly so we can also find the maximum depth at the
# same time.
Method resolve_implicit_levels
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def resolve_implicit_levels
# This implements rules I1 and I2.
@length.times do |i|
if (@levels[i] & 1) == 0
if @types[i] == :R
- 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 arraycopy
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def arraycopy(orig, orig_index, dest, dest_index, length)