Showing 3 of 3 total issues
Method start_driver
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def start_driver
@previous_read = 0
@upper = additional_params[:upper].nil? ? 1023 : additional_params[:upper]
@lower = additional_params[:lower].nil? ? 0 : additional_params[:lower]
- 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 start_driver
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def start_driver
@pressed_val = 0
every(0.1) do
new_value = connection.digital_read(pin)
- 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 change_state
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def change_state(state)
@current_state = state
@current_speed = state.zero? ? 0 : 255
if state == :high
direction(@current_direction)
- 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"