Showing 4 of 4 total issues
Class Segmenter
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Segmenter
include Constants::Abbreviations
include Core::Serviceable
uses_logger { Logger.new('Segmenter', default: :debug) }
Method scan_through_string
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def scan_through_string(scanner, sentences = [])
while scanner.rest?
loop_guard = scanner.pos
sentence = scan_until_next_sentence(scanner, sentences)
- 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 scan_until_next_sentence
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def scan_until_next_sentence(scanner, sentences)
sentence = do_scan(scanner, sentences)
if @xml
while has_open_chevron?(sentence) do
next_step = do_scan(scanner, sentences)
- 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 rescue_no_delimiters
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def rescue_no_delimiters(sentences, scanner)
if sentences.any?
# broken off texts
scanner.scan_until(/\Z/)
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"