Showing 175 of 209 total issues
Method parse
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def parse(number_text, options = {})
options[:strict] = true unless options.include?(:strict)
group, decimal = separators(options[:strict])
tokens = tokenize(number_text, group, decimal)
- 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
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def format(number, options = {})
rule_group_name, rule_set_name = *if options[:rule_group].nil? && options[:rule_set].nil?
[DEFAULT_SPELLOUT_OPTIONS[:rule_group], DEFAULT_SPELLOUT_OPTIONS[:rule_set]]
else
[options[:rule_group], options[:rule_set]]
- 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 traverse_finding_best_fit
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def traverse_finding_best_fit(path_pattern, path, hash = resource)
if path_pattern.empty?
result = traverse_following_aliases(path, hash)
return result if result.is_a?(String)
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 evaluate
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def evaluate(node)
case node
when UnaryOperator, BinaryOperator
case node.operator
when :negate
Method run_conformance_tests_with_icu
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_conformance_tests_with_icu(conformance_file, test_lines)
boundary_type = case File.basename(conformance_file)
when 'WordBreakTest.txt'
:word
when 'SentenceBreakTest.txt'
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 import_dictionary
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import_dictionary(path, locale)
options = {}
rules = []
File.foreach(path).with_index do |line, idx|
Method preprocess
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def preprocess(tokens)
result = []
i = 0
while i < tokens.size
Method fractional_rule_for
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def fractional_rule_for(number)
# the obvious way to do this (multiply the value being formatted
# by each rule's base value until you get an integral result)
# doesn't work because of rounding error. This method is more
# accurate
Method generate_replacement
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def generate_replacement(number, rule, token)
if rule_set_name = token.rule_set_reference
RuleFormatter.format(
number,
rule_group.rule_set_for(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
Method string_type
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def string_type(str)
if str.respond_to?(:encoding) && (!str.valid_encoding? || str.encoding == Encoding::ASCII_8BIT)
return false, false, false, false
end
(ucs_codes = str.unpack('U*')) rescue (
- 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 a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def generate_test
run_hash = {}
File.open(source_file, 'r').each_line do |ln|
cur_line = ln.strip
- 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 lookup_code_point
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def lookup_code_point(code_point)
{}.tap do |properties|
each_property_pair do |property_name, property_value|
code_points = code_points_for_property(
property_name, property_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 flatten
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def flatten
return if ranges.size <= 1
sorted_ranges = ranges.sort do |a, b|
if is_numeric_range?(a) && is_numeric_range?(b)
- 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
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def format(tokens, number, options = {})
options[:currency] ||= "USD"
options[:locale] ||= :en
currency = TwitterCldr::Shared::Currencies.for_code(options[:currency], options[:locale])
currency ||= {
- 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_matching_rule_at
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def find_matching_rule_at(cursor)
indexed_match = find_matching_indexed_rule_at(cursor)
blank_key_match = find_matching_blank_key_rule_at(cursor)
if indexed_match
- 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 is_printable?
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def is_printable?(ucs_code)
# YAML 1.1 / 4.1.1.
(
[0x09, 0x0a, 0x0d, 0x85].include?(ucs_code) ||
(ucs_code <= 0x7e && ucs_code >= 0x20) ||
- 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 yaml_escape
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def yaml_escape(str)
# YAML 1.1 / 4.1.6.
str.gsub(/[^a-zA-Z0-9]/u) do |c|
ucs_code, = (c.unpack('U') rescue [??])
case
- 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 preprocess
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def preprocess(tokens)
result = []
i = 0
while i < tokens.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 metadata
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def metadata
{ aliases: {}, short_names: {} }.tap do |result|
doc.xpath("//ldmlBCP47/keyword/key[@name='tz']/type").each do |node|
alias_node = node.attribute('alias')
next unless alias_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"