Showing 175 of 209 total issues
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 emit
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
def emit(obj, level)
case obj
when Array
if (obj.length == 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 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
Class Locale
has 42 methods (exceeds 20 allowed). Consider refactoring. Open
class Locale
class << self
# http://unicode.org/reports/tr35/tr35-9.html#Likely_Subtags
#
Method divide_up_dictionary_range
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def divide_up_dictionary_range(cursor, end_pos, &block)
return to_enum(__method__, cursor, end_pos) unless block_given?
input_length = end_pos - cursor.position
best_snlp = Array.new(input_length + 1) { LARGE_NUMBER }
- 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 mark_best_candidate
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def mark_best_candidate(cursor, end_pos, state)
# if there was more than one, see which one can take us forward the most words
found_best = false
# if we're already at the end of the range, we're done
- 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 format_display_name
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def format_display_name(date, type, fmt, dst = TZInfo::Timezone.default_dst, &block)
date_int = date.strftime('%s').to_i
period = tz.period_for_local(date, dst, &block)
flavor = if type == :generic
- 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 process
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def process(str, rule_set)
# markers depend on what rule set we are using
buf = str.unpack("U*")
name = rule_set.name
- 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
Class RangeSet
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class RangeSet
include Enumerable
attr_reader :ranges
Method format_tokens
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def format_tokens(tokens, format, hour, min, sec)
''.tap do |result|
tokens.each do |token|
case token.type
when :plaintext
- 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 generate_test_data
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def generate_test_data(transforms)
transforms.each_with_object([]) do |transform_id_str, ret|
forward_id = transform_id.parse(transform_id_str)
[forward_id, forward_id.reverse].each do |id|
- 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
Class CodePoint
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class CodePoint
DECOMPOSITION_REGEX = /^(?:<(.+)>\s+)?(.+)?$/
MAX_CODE_POINT = 1_112_111
attr_reader :fields
File yaml.rb
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
module TwitterCldr
module Utils
class YAML
Class LocalizedString
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class LocalizedString < LocalizedObject
include Enumerable
# Uses wrapped string object as a format specification and returns the result of applying it to +args+ (see
# standard String#% method documentation for interpolation syntax).
File date_time_formatter.rb
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'tzinfo'
module TwitterCldr
module Formatters
class DateTimeFormatter < Formatter
Method emit
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
def emit(obj, level)
case obj
when Array
if (obj.length == 0)
'[]'
Class UnicodeRegexParser
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class UnicodeRegexParser < Parser
autoload :Component, "twitter_cldr/parsers/unicode_regex/component"
autoload :CharacterClass, "twitter_cldr/parsers/unicode_regex/character_class"
autoload :CharacterRange, "twitter_cldr/parsers/unicode_regex/character_range"
Method advance_past_suffix
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def advance_past_suffix(cursor, end_pos, state)
suffix_length = 0
if cursor.position < end_pos && state.word_length > 0
uc = cursor.codepoint
- 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"