Showing 175 of 209 total issues
File range_set.rb
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'set'
module TwitterCldr
module Utils
Class TailoringImporter
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class TailoringImporter < Importer
requirement :icu, '49.1'
requirement :cldr, '21'
output_path 'collation/tailoring'
Method rule_index_for
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def rule_index_for(base_value)
if rule_index = special_rule_index_for(base_value)
return rule_index
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 partition
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def partition(rules)
[].tap do |result|
until rules.empty?
filter_rule = nil
inverse_filter_rule = nil
- 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_string
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def emit_string(str, level)
if @options[:quote_all_strings] && !str.is_a?(Symbol)
emit_quoted_string(str, level)
else
str = str.to_s
- 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 Calendar
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Calendar
DEFAULT_FORMAT = :format
NAMES_FORMS = [:wide, :narrow, :short, :abbreviated]
Method hour
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def hour(time, pattern, length, options = {})
hour = time.hour
hour = case pattern[0, 1]
when 'h' # [1-12]
hour > 12 ? (hour - 12) : (hour == 0 ? 12 : hour)
- 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 a Cognitive Complexity of 16 (exceeds 5 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
- 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 identify_subtag
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def identify_subtag(subtag)
[].tap do |types|
types << :language if language?(subtag)
types << :script if script?(subtag)
types << :region if region?(subtag)
- 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 import_dictionary
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def import_dictionary(path, locale)
options = {}
rules = []
File.foreach(path).with_index do |line, 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 lcm
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def lcm(x, y)
# binary gcd algorithm from Knuth, "The Art of Computer Programming,"
# vol. 2, 1st ed., pp. 298-299
x1 = x
y1 = y
- 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 explicit_collation_elements
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def explicit_collation_elements(code_points)
# find the longest prefix in the trie
collation_elements, prefix_size, suffixes = @trie.find_prefix(code_points)
return unless collation_elements
- 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 divide_up_dictionary_range
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def divide_up_dictionary_range(cursor, end_pos)
return to_enum(__method__, cursor, end_pos) unless block_given?
return if (end_pos - cursor.position) < min_word_span
state = EngineState.new(
Method handle_next
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_next(cursor)
result = initial_position = cursor.position
state = START_STATE
row = state * (metadata.category_count + NEXT_STATES)
category = 3
Method evaluate
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def evaluate(node)
case node
when UnaryOperator, BinaryOperator
case node.operator
when :negate
- 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_name_value_candidates
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def resolve_name_value_candidates(property_name_candidates, value_candidates)
property_name_candidates.each do |name_candidate|
value_candidates.each do |value_candidate|
if cased_property_name = resolve_property_name_case(name_candidate)
if value_candidate
- 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 normal_rule_for
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def normal_rule_for(number)
if rule = master_rule
rule
elsif number < 0 && rule = negative_rule
rule
- 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