Showing 569 of 2,678 total issues
File cors_spec.rb
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
require 'cors'
module CloudFoundry
module Middleware
File v3_error_hasher_spec.rb
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'lightweight_spec_helper'
require 'presenters/v3_error_hasher'
require 'cloud_controller/errors/api_error'
require 'cloud_controller/errors/not_authenticated'
require 'cloud_controller/errors/compound_error'
File buildpack_bits_controller_spec.rb
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
## NOTICE: Prefer request specs over controller specs as per ADR #0003 ##
module VCAP::CloudController
File organization.rb
has 262 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/
File base_message_spec.rb
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
require 'messages/base_message'
module VCAP::CloudController
RSpec.describe BaseMessage do
Method update
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def update(resource, labels, label_klass, destroy_nil: true)
starting_label_count_for_resource = label_klass.where(resource_guid: resource.guid).count
labels ||= {}
labels.each do |label_key, label_value|
- 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
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def create(app, service_instance, message, volume_mount_services_enabled, accepts_incomplete)
raise ServiceInstanceNotBindable unless service_instance.bindable?
raise VolumeMountServiceDisabled if service_instance.volume_service? && !volume_mount_services_enabled
raise SpaceMismatch unless bindable_in_space?(service_instance, app.space)
- 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 filter_manifest_app_hash
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
def filter_manifest_app_hash(manifest_app_hash)
if manifest_app_hash.key? 'sidecars'
manifest_app_hash['sidecars'] = manifest_app_hash['sidecars'].map do |hash|
hash.slice(
'name',
Method tables_for_model_controller_spec
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def tables_for_model_controller_spec
db.create_table :test_models do
primary_key :id
String :guid
String :unique_value
File schema_spec.rb
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'lightweight_spec_helper'
require 'services/service_brokers/v2/schema'
module VCAP::Services::ServiceBrokers::V2
RSpec.describe Schema do
Class DropletModel
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class DropletModel < Sequel::Model(:droplets)
include Serializer
DROPLET_STATES = [
STAGING_STATE = 'STAGING'.freeze,
Class CatalogService
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class CatalogService
include CatalogValidationHelper
SUPPORTED_REQUIRES_VALUES = %w[syslog_drain route_forwarding volume_mount].freeze
Method build
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build(config, request_metrics, request_logs)
token_decoder = VCAP::CloudController::UaaTokenDecoder.new(config.get(:uaa))
configurer = VCAP::CloudController::Security::SecurityContextConfigurer.new(token_decoder)
logger = access_log(config)
File resource_match_create_message_spec.rb
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
require 'messages/resource_match_create_message'
RSpec.describe VCAP::CloudController::ResourceMatchCreateMessage do
describe 'creation with v3' do
File routes.rb
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
Rails.application.routes.draw do
get '/', to: 'root#v3_root'
# admin actions
post '/admin/actions/clear_buildpack_cache', to: 'admin_actions#clear_buildpack_cache'
File stats_controller_spec.rb
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
## NOTICE: Prefer request specs over controller specs as per ADR #0003 ##
module VCAP::CloudController
File shared_domain_spec.rb
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
module VCAP::CloudController
RSpec.describe SharedDomain, type: :model do
subject { SharedDomain.make name: 'test.example.com', router_group_guid: router_group_guid, router_group_type: 'tcp' }
Method perform
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def perform
return finish if binding.nil?
compute_maximum_duration
- 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 filter_manifest_app_hash
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def filter_manifest_app_hash(manifest_app_hash)
if manifest_app_hash.key? 'sidecars'
manifest_app_hash['sidecars'] = manifest_app_hash['sidecars'].map do |hash|
hash.slice(
'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 enabled?
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def self.enabled?(feature_flag_name, raise_unless_enabled: false)
return true if ADMIN_SKIPPABLE.include?(feature_flag_name) && admin?
return true if ADMIN_READ_ONLY_SKIPPABLE.include?(feature_flag_name) && admin_read_only?
feature_flag = FeatureFlag.find(name: feature_flag_name.to_s)
- 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"