Showing 4 of 4 total issues
Method transform
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def transform(match_data, match, line, translation_key)
return line if line.match /\bt\(/
leading_whitespace = line[/^(\s+)/, 1]
no_leading_whitespace = if leading_whitespace
line[leading_whitespace.size..-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 run
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def run(text)
lines = text.split("\n")
new_lines = lines.map do |line|
new_line = line
if line !~ /[[:alpha:]]/
- 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 transform
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def transform(match_data, match, line, translation_key)
return line if line.match /\bt\(/
leading_whitespace = line[/^(\s+)/, 1]
no_leading_whitespace = if leading_whitespace
line[leading_whitespace.size..-1]
Method i18n_string
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def i18n_string(key, original)
@locale_creator.add(key, original)
if @add_default
if original.to_s[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"