Showing 3 of 5 total issues
Method play_level
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def play_level
solve = true
if profile.level.nil?
UI.puts("Welcome to Githug!")
solve = false
- 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 load_level
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def load_level(path = nil)
return load_level_from_profile unless path
return load_level_from_number(path.to_i) if path.to_i.to_s == path
return load_level_from_name(path) if Level.list.include?(path)
Level.load_from_file(path)
- 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 show_hint
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def show_hint
UI.word_box("Githug")
profile = Profile.load
current_hint_index = profile.current_hint_index
if @hints
- 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"