Showing 175 of 209 total issues
Method week_fields_for
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def week_fields_for(date)
week_data_cache[date] ||= begin
eyear = date.year
day_of_week = date.wday + 1
day_of_year = date.yday
Method normalize
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def normalize(locale_text)
Locale.new(nil).tap do |locale|
subtags = identify_subtags(locale_text)
until subtags.empty?
- 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 apply_to
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def apply_to(cursor)
until cursor.eos?
if filter_rule.matches?(cursor)
rule_match = find_matching_rule_at(cursor)
- 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 consume_until_balanced
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def consume_until_balanced
open_brackets = 0
consumed_tokens = []
if is_opening?(current_token) || is_closing?(current_token)
- 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
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_test
run_hash = {}
File.open(source_file, 'r').each_line do |ln|
cur_line = ln.strip
Method standard_importer_classes
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def standard_importer_classes
@standard_importer_classes ||= [
AliasesImporter,
Bcp47TimezoneMetadataImporter,
BidiTestImporter,
Method format_display_name
has 32 lines of code (exceeds 25 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
Method formats_for_type
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def formats_for_type(type)
doc.xpath("//ldml/numbers/#{type}Formats").each_with_object({}) do |formats_node, ret|
number_system = if ns_node = formats_node.attribute('numberSystem')
ns_node.value
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 advance_to_plausible_word_boundary
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def advance_to_plausible_word_boundary(cursor, end_pos, state)
remaining = end_pos - (state.current + state.word_length)
pc = cursor.codepoint
chars = 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 update_break_weights
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def update_break_weights(pattern, break_weights, start_idx)
pattern_idx = 0
pattern.each_char do |segment|
if segment =~ /\d/
- 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 each_boundary_helper
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def each_boundary_helper(str, &block)
# Set up two independent cursors so the algorithm can iterate
# over those portions of the input string that require a
# dictionary-based break iterator independently from those that
# only need the normal, rule-based break iterator. Cursors
Method format_offset
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def format_offset(offset, is_basic, use_utc_indicator, is_short, ignore_seconds)
abs_offset = offset.abs
return UTC if use_utc_indicator && abs_offset == 0
min_fields_idx = is_short ? 0 : 1
Method init_tertiary_constants
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def init_tertiary_constants
@case_switch = @case_first == :upper ? CASE_SWITCH : NO_CASE_SWITCH
if @case_first
@tertiary_mask = KEEP_CASE_MASK
Method advance_past_suffix
has 29 lines of code (exceeds 25 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
Method side
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def side
prev_cluster = next_token_cluster
before_context = nil
after_context = nil
key = nil
Method import_components
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import_components
locales = Set.new
finish = -> (locale, *) do
locales.add(locale)
Method parse_tailorings
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_tailorings(data, locale)
rules = data && data.at_xpath('rules')
return '' unless rules
Method traverse
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def traverse(key)
current_path = path_root
key.inject(@root) do |node, key_element|
next unless node
- 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 symbols
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def symbols
doc.xpath('//ldml/numbers/symbols').each_with_object({}) do |symbols_node, symbols_result|
number_system = if ns_node = symbols_node.attribute('numberSystem')
ns_node.value
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 calculate_unit
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def calculate_unit(seconds, options = {})
approximate = options[:approximate]
approximate = false if approximate.nil?
multiplier = approximate ? APPROXIMATE_MULTIPLIER : 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"