Showing 28 of 32 total issues
Method gen_encode
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.gen_encode(w, i, primary, secondary, code)
Method encode_word
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.encode_word(word, options = {})
return '' if word.empty?
w = word.upcase
res = w[0]
pg = CODE[w[0].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 encode_word
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.encode_word(word, options = { trim: true })
return if !word or word.empty?
trim = options[:trim]
w = word.upcase
w.gsub!(/[^A-Z]/, '')
- 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 encode_w
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.encode_w(w, i, len, code)
last = len - 1
r = 1
# can also be in middle of word
if w[i, 2] == 'WR'
- 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 encode_cc
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.encode_cc(w, i, code)
r = 0
# 'bellocchio' but not 'bacchus'
if w[i + 2, 1] =~ /[IEH]/ && w[i + 2, 2] != 'HU'
# 'accident', 'accede' 'succeed'
- 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 ch_germanic_or_greek?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.ch_germanic_or_greek?(w, i, len)
# germanic, greek, or otherwise 'ch' for 'kh' sound
w[0, 4] =~ /^(V[AO]N\s|SCH)/ ||
# 'architect but not 'arch', 'orchestra', 'orchid'
i > 1 && w[i - 2, 6] =~ /ORCHES|ARCHIT|ORCHID/ ||
- 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 encode_t
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.encode_t(w, n)
metaph = ''
if w[n + 1, 2] =~ /I[OA]/
metaph = 'X'
elsif w[n + 1] == 'H'
- 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 encode_word
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.encode_word(word, options = { size: 4 })
code_size = options[:size] || 4
w = word.strip.upcase
code = Code.new
i = 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"