lib/opal/source_map/file.rb
Method fragments_by_line
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Wontfix
Wontfix
def fragments_by_line
raw_mappings = [[]]
fragments.flat_map do |fragment|
fragment_code = fragment.code
splitter = /\r/.match?(fragment_code) ? /\r?\n/ : "\n"
- 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 segment_from_fragment
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def segment_from_fragment(fragment, generated_column)
source_index = 0 # always 0, we're dealing with a single file
original_line = (fragment.line || 0) - 1 # fragments have 1-based lines
original_line = 0 if original_line < 0 # line 0 (-1) for fragments in source maps will crash
# browsers devtools and the webpack build process
- 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"