Showing 583 of 2,698 total issues
Method encode
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def encode(value)
v = if value.is_a?(VCAP::CloudController::Presenters::V3::BasePresenter)
value.to_hash
else
value.as_json(options.dup)
- 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 create_uaa_changeset
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_uaa_changeset(requested_clients, existing_uaa_clients)
requested_ids = requested_clients.map { |client| client.fetch('id') }
create_and_update_commands = requested_clients.map do |requested_client|
existing_uaa_client = existing_uaa_clients.detect { |client| client == requested_client.fetch('id') }
- 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 make_preflight_request_with_origin
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def make_preflight_request_with_origin(origin, method=nil, extra_headers={})
headers = {}
headers = headers.merge({ 'Origin' => origin })
headers = headers.merge({ 'Access-Control-Request-Method' => method }) unless method.nil?
headers = headers.merge(extra_headers)
- 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"