lib/usmu/helpers/indexer.rb
Method indexer
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
def indexer(variable)
# An index accessor to directly access the configuration file. It should be noted that `['source']` and
# `#source_path` and other similar pairs will have different values. `['source']` is the raw value from the
# configuration file while the latter is a path on the system, potentially altered by the path from the current
# working directory to the configuration file and other factors. The accessor functions such as `#source_path`
- Read upRead up
- Create a ticketCreate a ticket
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"