Showing 583 of 2,698 total issues
Method create
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def create
message = ServiceBrokerCreateMessage.new(hashed_params[:body])
unprocessable!(message.errors.full_messages) unless message.valid?
if message.space_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
Class Updater
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Updater
attr_reader :deployment, :logger
def initialize(deployment, logger)
@deployment = deployment
File application_controller_spec.rb
has 284 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
require 'rails_helper'
## NOTICE: Prefer request specs over controller specs as per ADR #0003 ##
Method validate
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def validate(record)
unless record.rules.is_a?(Array)
record.errors.add :rules, 'must be an array'
return
end
- 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 20 (exceeds 5 allowed). Consider refactoring. Open
def destroy
service_broker = VCAP::CloudController::ServiceBroker.find(guid: hashed_params[:guid])
broker_not_found! unless service_broker
if service_broker.space.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"
Further reading
Method sync
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def sync
logger.info('run-task-sync')
@bump_freshness = true
diego_tasks = bbs_task_client.fetch_tasks.index_by(&:task_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 define_message
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def define_message(type)
attrs = Array(attributes)
to_one = @to_one_relationships ||= []
to_many = @to_many_relationships ||= []
- 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 extract_table_of_contents
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def extract_table_of_contents(html)
page = Nokogiri::HTML(html)
headings = []
page.css('h1,h2,h3').each do |heading|
- 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
Class DropletModel
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class DropletModel < Sequel::Model(:droplets)
include Serializer
DROPLET_STATES = [
STAGING_STATE = 'STAGING'.freeze,
File buildpack_installer_factory_spec.rb
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
module VCAP::CloudController
module Jobs::Runtime
RSpec.describe BuildpackInstallerFactory do
File app_create_message_spec.rb
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
require 'messages/app_create_message'
module VCAP::CloudController
RSpec.describe AppCreateMessage do
Method scale
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def scale
raise InvalidProcess.new('Cannot scale this process while a deployment is in flight.') if @process.web? && @process.app.deploying?
@process.db.transaction do
@process.app.lock!
- 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 valid?
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def valid?
attributes.each do |attribute_name, details|
field = fields[attribute_name]
if field
@attributes_with_bad_default << [attribute_name, details[:default], field.default] unless details[:default] == field.default
- 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
File list_message_spec.rb
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
require 'messages/list_message'
class VCAP::CloudController::ListMessage
register_allowed_keys []
File staging_action_builder_spec.rb
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
require 'cloud_controller/diego/cnb/staging_action_builder'
module VCAP::CloudController
module Diego
File service_binding_create_message_spec.rb
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
require 'messages/service_binding_create_message'
module VCAP::CloudController
RSpec.describe ServiceBindingCreateMessage do
File organization.rb
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'models/helpers/process_types'
module VCAP::CloudController
class Organization < Sequel::Model
ORG_NAME_REGEX = /\A[[:alnum:][:punct:][:print:]]+\Z/
Method update
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def update(service_instance, message)
logger = Steno.logger('cc.action.user_provided_service_instance_update')
updates = {}
updates[:name] = message.name if message.requested?(:name)
- 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 perform
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def perform
logger = Steno.logger('cc-background')
service_binding = ServiceBinding.first(guid: service_binding_guid)
return if service_binding.nil? # assume the binding has been purged
- 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_destination_contents
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def validate_destination_contents
app_to_ports_hash = {}
destinations.each_with_index do |dst, index|
unless dst.is_a?(Hash)
- 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"