Showing 583 of 2,698 total issues
Method data_content
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def data_content
return if data.nil?
errors.add(:data, 'can only accept one key') unless data.keys.length == 1
errors.add(:data, "can only accept key 'guid'") unless data.key?(:guid)
- 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 destroy
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def destroy
sidecar = SidecarModel.find(guid: hashed_params[:guid])
resource_not_found!(:sidecar) unless sidecar
space = sidecar.app.space
resource_not_found!(:sidecar) unless permission_queryer.can_read_from_space?(space.id, space.organization_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 entity_hash
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def entity_hash(controller, obj, opts, depth, parents, orphans=nil)
Method size_validator
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def size_validator(size)
unless size.is_a?(Integer)
errors.add(:resources, "#{RESOURCE_ERROR_PREAMBLE} a non-integer size_in_bytes") unless errors.added?(
:resources, "#{RESOURCE_ERROR_PREAMBLE} a non-integer size_in_bytes"
)
- 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 validate_icmp_protocol
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_icmp_protocol(rule, record, index)
add_rule_error('code is required for protocols of type ICMP', record, index) unless rule[:code]
add_rule_error('code must be an integer between -1 and 255 (inclusive)', record, index) unless valid_icmp_format(rule[:code])
add_rule_error('type is required for protocols of type ICMP', record, index) unless rule[:type]
- 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 validate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate(record)
return unless record.requested?(:include)
key_counts = Hash.new(0)
record.include.each do |include_candidate|
- 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 entity_hash
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def entity_hash(controller, route_mapping, opts, depth, parents, orphans=nil)
Method entity_hash
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def entity_hash(controller, plan, opts, depth, parents, orphans=nil)
Method entity_hash
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def entity_hash(controller, space, opts, depth, parents, orphans=nil)
Method summary
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def summary(guid)
org = find_guid_and_validate_access(:read, guid)
spaces = visible_spaces(org).map do |space|
# when we do the quota work, this and the service counts will be kept
# as a running total so that we don't have to compute them on the
- 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 entity_hash
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def entity_hash(controller, org, opts, depth, parents, orphans=nil)
Method entity_hash
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def entity_hash(controller, obj, opts, depth, parents, orphans=nil)
Method filter
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def filter(message, dataset)
dataset = dataset.where(name: message.names) if message.requested?(:names)
dataset = dataset.where(space_guid: message.space_guids) if message.requested?(:space_guids)
- 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 initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(config, staging_details, lifecycle_data, prefix, app_destination_path, cache_source)
Method define_to_many_routes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def define_to_many_routes
to_many_relationships.each do |name, attr|
route_for = Array(attr.route_for)
if route_for.include?(:get)
- 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 sync
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def sync
logger.info('run-process-sync')
@bump_freshness = true
diego_lrps = bbs_apps_client.fetch_scheduling_infos.index_by { |d| d.desired_lrp_key.process_guid }
logger.info('fetched-scheduling-infos')
- 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 add_relationship_url_to_response
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_relationship_url_to_response(response, controller, associated_controller, relationship_name, association, obj)
Method is_cnb_buildpack_uri?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.is_cnb_buildpack_uri?(candidate)
return false unless candidate.is_a?(String)
return is_uri?(candidate) if candidate.start_with?(%r{\Ahttp(s)?://}x)
return !!parse_docker_uri(candidate.split('://').last) if candidate.start_with?('docker://')
- 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 to_hash
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def to_hash(controller, obj, opts, depth, parents, orphans=nil)
Method traverse_secrets_hash
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def traverse_secrets_hash(secrets_hash)
secrets_hash.each do |k, v|
if v.is_a? Hash
traverse_secrets_hash(v)
else
- 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"