app/screens/five_colors_screen.rb
Method pushed_button_of_color
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def pushed_button_of_color(color_sym)
puts "+ 「#{str_of_color(color_sym)}グループ」ボタンが押された!" if BW2.debug?
alert = UIAlertController.alertControllerWithTitle(
"#{str_of_color(color_sym)}色の20首をどうしますか?",
message: nil,
Method selected_status_of_color
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def selected_status_of_color(color_sym)
raise "Invalid argument type #{color_sym}" unless color_sym.is_a? Symbol
numbers = numbers_of_color(color_sym)
raise "Couldn't get Numbers for Color [#{color_sym}]" if numbers.empty?
if numbers.inject(true){|result, num| result &&= status100.of_number(num)}
- 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 pushed_button_of_color
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def pushed_button_of_color(color_sym)
puts "+ 「#{str_of_color(color_sym)}グループ」ボタンが押された!" if BW2.debug?
alert = UIAlertController.alertControllerWithTitle(
"#{str_of_color(color_sym)}色の20首をどうしますか?",
message: nil,
- 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"