Showing 175 of 209 total issues
Method initialize
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(boundary_type, locale, metadata, ftable, rtable, status_table, category_table)
Method elements
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def elements(node, kind, context, width, options = {})
node.xpath(kind).each_with_object({}) do |node, result|
key = node.attribute('type').value
key = key =~ /^\d*$/ ? key.to_i : key.to_sym
- 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 compile_regexp
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def compile_regexp(regexp_str)
TwitterCldr::Shared::UnicodeRegex.compile(regexp_str).tap do |re|
re.elements.replace(
re.elements.flat_map do |element|
new_elem = case element.type
- 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 execute
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def execute
each_locale do |locale, doc|
BOUNDARY_TYPES.each do |kind, icu_kind|
seg = doc.xpath(
"//ldml/segmentations/segmentation[@type=\"#{TYPES_TO_ATTRS[kind]}\"]"
- 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 compose_list
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def compose_list(list, res)
result = compose(res[:end] || res[:middle] || "", [list[-2], list[-1]])
# Ruby ranges don't support subtraction for some reason (eg. -3..-5).
# Instead, we use a positive counter and negate it on array access.
- 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 deep_merge_hash
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def deep_merge_hash(first, second, &block)
target = first.dup
second.keys.each do |key|
if second[key].is_a?(Hash) && first[key].is_a?(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 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 matches
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def matches(cursor, max_search_length, limit)
return 0 if cursor.length == 0
count = 0
num_chars = 1
- 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_bcp_47_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def process_bcp_47_data(data, result)
if !data.empty? && %w[language extlang].include?(data['type']) && !data['names'].include?('Private use') && data['scope'] != 'collection'
existing_names = data['names'].select { |name| result.has_key?(name) }
prefered = data['preferred-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 pattern_for_sign
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def pattern_for_sign(pattern, sign)
if pattern.include?(";")
positive, negative = pattern.split(";")
sign == :positive ? positive : negative
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 find_fallback
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def find_fallback
locale_fallbacks.reverse_each do |fallback|
result = if fallback.is_a?(Proc)
begin
fallback.call
- 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 format_tokens
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def format_tokens(tokens, format, hour, min, sec)
Method format_display_name
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def format_display_name(date, type, fmt, dst = TZInfo::Timezone.default_dst, &block)
Method arraycopy
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def arraycopy(orig, orig_index, dest, dest_index, length)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(direction, left, right, original_rule_text, index)
Method elements
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def elements(node, kind, context, width, options = {})
Method format_offset
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def format_offset(offset, is_basic, use_utc_indicator, is_short, ignore_seconds)
Method load
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def load
results = Hash.new do |h, k|
h[k] = Hash.new { |h, k| h[k] = [] }
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
Method includes_range?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def includes_range?(range)
result = bsearch do |cur_range|
fo = front_overlap?(cur_range, range)
ro = rear_overlap?(cur_range, range)
- 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 formats_from_node
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def formats_from_node(formats_node, type, number_system)
formats_node.xpath("#{type}FormatLength").each_with_object({}) do |format_length_node, format_result|
format_nodes = format_length_node.xpath("#{type}Format")
format_key = format_length_node.attribute('type')
- 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"