Showing 583 of 2,698 total issues
Method update
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def self.update(quota, message)
if log_rate_limit(message) != QuotaDefinition::UNLIMITED
spaces = spaces_with_unlimited_processes(quota)
unlimited_processes_exist_error!(spaces) if spaces.any?
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
File _jquery_ui.js
has 427 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*! jQuery UI - v1.11.3 - 2015-02-12
* http://jqueryui.com
* Includes: widget.js
* Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
File app_bits_upload_controller_spec.rb
has 414 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
Method update
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def update(process, message, strategy_class)
raise InvalidProcess.new('Cannot update this process while a deployment is in flight.') if process.web? && process.app.deploying?
strategy = strategy_class.new(message, process)
process.db.transaction do
- 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 feature_flags_api_spec.rb
has 398 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
require 'rspec_api_documentation/dsl'
RSpec.resource 'Feature Flags', type: %i[api legacy_api] do
let(:admin_auth_header) { admin_headers['HTTP_AUTHORIZATION'] }
File buildpack_lifecycle_data_model_spec.rb
has 398 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
module VCAP::CloudController
RSpec.describe BuildpackLifecycleDataModel do
subject(:lifecycle_data) { BuildpackLifecycleDataModel.new }
Class Permissions
has 40 methods (exceeds 20 allowed). Consider refactoring. Open
class VCAP::CloudController::Permissions
ROLES_FOR_ORG_READING ||= [
VCAP::CloudController::Membership::ORG_MANAGER,
VCAP::CloudController::Membership::ORG_AUDITOR,
VCAP::CloudController::Membership::ORG_USER,
File domain_create_message_spec.rb
has 384 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
require 'messages/domain_create_message'
module VCAP::CloudController
RSpec.describe DomainCreateMessage do
Class Organization
has 39 methods (exceeds 20 allowed). Consider refactoring. Open
class Organization < Sequel::Model
ORG_NAME_REGEX = /\A[[:alnum:][:punct:][:print:]]+\Z/
ACTIVE = 'active'.freeze
SUSPENDED = 'suspended'.freeze
ORG_STATUS_VALUES = [ACTIVE, SUSPENDED].freeze
Method update
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def update
message = ServiceBrokerUpdateMessage.new(hashed_params[:body])
unprocessable!(message.errors.full_messages) unless message.valid?
service_broker = VCAP::CloudController::ServiceBroker.find(guid: hashed_params[: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
File security_group_create_message_spec.rb
has 378 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
require 'messages/security_group_create_message'
module VCAP::CloudController
RSpec.describe SecurityGroupCreateMessage do
File 20160914165525_migrate_v2_app_data_to_v3.rb
has 377 lines of code (exceeds 250 allowed). Consider refactoring. Open
Sequel.migration do
up do
collate_opts = {}
dbtype = if self.class.name.match?(/mysql/i)
collate_opts[:collate] = :utf8_bin
File statsd_updater_spec.rb
has 371 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
require 'cloud_controller/metrics/statsd_updater'
module VCAP::CloudController::Metrics
RSpec.describe StatsdUpdater do
File catalog_spec.rb
has 365 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
module VCAP::Services::ServiceBrokers::V2
RSpec.describe Catalog do
let(:broker) { VCAP::CloudController::ServiceBroker.make }
Class ServiceInstanceUpdateManaged
has 36 methods (exceeds 20 allowed). Consider refactoring. Open
class ServiceInstanceUpdateManaged
class UnprocessableUpdate < CloudController::Errors::ApiError; end
class InvalidServiceInstance < StandardError
end
class LastOperationFailedState < StandardError; end
File request_spec_shared_examples.rb
has 348 lines of code (exceeds 250 allowed). Consider refactoring. Open
GLOBAL_SCOPES = %w[
admin
admin_read_only
global_auditor
].freeze
Class BaseController
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class BaseController
V2_ROUTE_PREFIX ||= '/v2'.freeze
include VCAP::CloudController
include CloudController::Errors
File cors_spec.rb
has 340 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
RSpec.describe 'CORS', type: :integration do
before(:all) do
start_cc
Function porterStemmer
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
var porterStemmer = function porterStemmer(w) {
var stem,
suffix,
firstch,
re,
File organization_quotas_update_message_spec.rb
has 338 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'spec_helper'
require 'messages/organization_quotas_update_message'
module VCAP::CloudController
RSpec.describe OrganizationQuotasUpdateMessage do