lib/klarna/checkout/client.rb
Cyclomatic complexity for handle_status_code is too high. [11/6] Open
Open
def handle_status_code(code, msg = nil)
case Integer(code)
when 200, 201
yield if block_given?
when 400
- Read upRead up
- Exclude checks
This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.
An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.
Method Klarna::Checkout::Client#environment
is defined at both lib/klarna/checkout/client.rb:10 and lib/klarna/checkout/client.rb:21. Open
Open
def environment
- Read upRead up
- Exclude checks
This cop checks for duplicated instance (or singleton) method definitions.
Example:
# bad
def duplicated
1
end
def duplicated
2
end
Example:
# bad
def duplicated
1
end
alias duplicated other_duplicated
Example:
# good
def duplicated
1
end
def other_duplicated
2
end
Method Klarna::Checkout::Client#environment=
is defined at both lib/klarna/checkout/client.rb:10 and lib/klarna/checkout/client.rb:25. Open
Open
def environment=(new_env)
- Read upRead up
- Exclude checks
This cop checks for duplicated instance (or singleton) method definitions.
Example:
# bad
def duplicated
1
end
def duplicated
2
end
Example:
# bad
def duplicated
1
end
alias duplicated other_duplicated
Example:
# good
def duplicated
1
end
def other_duplicated
2
end