Skip to content

Commit

Permalink
Merge pull request #3534 from cloudfoundry/dependabot/bundler/rubocop…
Browse files Browse the repository at this point in the history
…-1.58.0

build(deps-dev): bump rubocop from 1.57.2 to 1.58.0
  • Loading branch information
philippthun authored Dec 5, 2023
2 parents 9aa478d + 8144cfa commit d502820
Show file tree
Hide file tree
Showing 66 changed files with 148 additions and 142 deletions.
4 changes: 4 additions & 0 deletions .rubocop_cc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ Lint/IncompatibleIoSelectWithFiberScheduler:
Enabled: true
Lint/LambdaWithoutLiteralBlock:
Enabled: true
Lint/LiteralAssignmentInCondition:
Enabled: true
Lint/MixedCaseRange:
Enabled: true
Lint/NoReturnInBeginEndBlocks:
Expand Down Expand Up @@ -326,6 +328,8 @@ Style/SelectByRegexp:
Enabled: true
Style/StringChars:
Enabled: true
Style/SuperWithArgsParentheses:
Enabled: true
Style/SwapValues:
Enabled: true
Style/YAMLFileRead:
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ group :test do
gem 'rspec-its'
gem 'rspec-rails', '~> 6.1.0'
gem 'rspec-wait'
gem 'rubocop', '~> 1.57.2'
gem 'rubocop', '~> 1.58.0'
gem 'rubocop-rails', '~> 2.22'
gem 'rubocop-rspec', '~> 2.25'
gem 'rubocop-sequel', '~> 0.3.4'
Expand Down
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ GEM
irb (1.7.4)
reline (>= 0.3.6)
jaro_winkler (1.5.4)
json (2.6.3)
json (2.7.0)
json-diff (0.4.1)
json-schema (4.1.1)
addressable (>= 2.8)
Expand Down Expand Up @@ -441,15 +441,15 @@ GEM
activesupport (>= 3.0.0)
mustache (~> 1.0, >= 0.99.4)
rspec (~> 3.0)
rubocop (1.57.2)
rubocop (1.58.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.4)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.30.0)
Expand Down Expand Up @@ -629,7 +629,7 @@ DEPENDENCIES
rspec-rails (~> 6.1.0)
rspec-wait
rspec_api_documentation (>= 6.1.0)
rubocop (~> 1.57.2)
rubocop (~> 1.58.0)
rubocop-rails (~> 2.22)
rubocop-rspec (~> 2.25)
rubocop-sequel (~> 0.3.4)
Expand Down
2 changes: 1 addition & 1 deletion app/access/app_event_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def create?(_object, _params=nil)
def read?(object)
return @ok_read if instance_variable_defined?(:@ok_read)

@ok_read = (admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user))
@ok_read = admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user)
end

def read_for_update?(_object, _params=nil)
Expand Down
2 changes: 1 addition & 1 deletion app/access/app_usage_event_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def create?(_object, _params=nil)
def read?(object)
return @ok_read if instance_variable_defined?(:@ok_read)

@ok_read = (admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user))
@ok_read = admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user)
end

def read_for_update?(_object, _params=nil)
Expand Down
2 changes: 1 addition & 1 deletion app/access/base_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class BaseAccess
def read?(object)
return @ok_read if instance_variable_defined?(:@ok_read)

@ok_read = (admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user))
@ok_read = admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user)
end

private
Expand Down
2 changes: 1 addition & 1 deletion app/access/buildpack_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def create?(_object, _params=nil)
def read?(object)
return @ok_read if instance_variable_defined?(:@ok_read)

@ok_read = (admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user))
@ok_read = admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user)
end

def read_for_update?(_object, _params=nil)
Expand Down
2 changes: 1 addition & 1 deletion app/access/event_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def create?(_object, _params=nil)
def read?(object)
return @ok_read if instance_variable_defined?(:@ok_read)

@ok_read = (admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user))
@ok_read = admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user)
end

def read_for_update?(_object, _params=nil)
Expand Down
2 changes: 1 addition & 1 deletion app/access/managed_service_instance_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class ManagedServiceInstanceAccess < ServiceInstanceAccess
def read?(object)
return @ok_read if instance_variable_defined?(:@ok_read)

@ok_read = (admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user))
@ok_read = admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user)
end

def can_remove_related_object?(object, params=nil)
Expand Down
2 changes: 1 addition & 1 deletion app/access/private_domain_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class PrivateDomainAccess < BaseAccess
def read?(object)
return @ok_read if instance_variable_defined?(:@ok_read)

@ok_read = (admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user))
@ok_read = admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user)
end

def can_remove_related_object?(object, params=nil)
Expand Down
2 changes: 1 addition & 1 deletion app/access/process_model_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class ProcessModelAccess < BaseAccess
def read?(object)
return @ok_read if instance_variable_defined?(:@ok_read)

@ok_read = (admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user))
@ok_read = admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user)
end

def can_remove_related_object?(object, params=nil)
Expand Down
2 changes: 1 addition & 1 deletion app/access/quota_definition_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def create?(_object, _params=nil)
def read?(object)
return @ok_read if instance_variable_defined?(:@ok_read)

@ok_read = (admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user))
@ok_read = admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user)
end

def read_for_update?(_object, _params=nil)
Expand Down
2 changes: 1 addition & 1 deletion app/access/route_mapping_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class RouteMappingModelAccess < BaseAccess
def read?(object)
return @ok_read if instance_variable_defined?(:@ok_read)

@ok_read = (admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user))
@ok_read = admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user)
end

def can_remove_related_object?(object, params=nil)
Expand Down
2 changes: 1 addition & 1 deletion app/access/security_group_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def create?(_object, _params=nil)
def read?(object)
return @ok_read if instance_variable_defined?(:@ok_read)

@ok_read = (admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user))
@ok_read = admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user)
end

def read_for_update?(_object, _params=nil)
Expand Down
2 changes: 1 addition & 1 deletion app/access/service_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def create?(_object, _params=nil)
def read?(object)
return @ok_read if instance_variable_defined?(:@ok_read)

@ok_read = (admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user))
@ok_read = admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user)
end

def read_for_update?(_object, _params=nil)
Expand Down
2 changes: 1 addition & 1 deletion app/access/service_binding_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class ServiceBindingAccess < BaseAccess
def read?(object)
return @ok_read if instance_variable_defined?(:@ok_read)

@ok_read = (admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user))
@ok_read = admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user)
end

def read_for_update?(_object, _params=nil)
Expand Down
2 changes: 1 addition & 1 deletion app/access/service_broker_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class ServiceBrokerAccess < BaseAccess
def read?(object)
return @ok_read if instance_variable_defined?(:@ok_read)

@ok_read = (admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user))
@ok_read = admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user)
end

def read_for_update?(_object, _params=nil)
Expand Down
2 changes: 1 addition & 1 deletion app/access/service_instance_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class ServiceInstanceAccess < BaseAccess
def read?(object)
return @ok_read if instance_variable_defined?(:@ok_read)

@ok_read = (admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user))
@ok_read = admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user)
end

def can_remove_related_object?(object, params=nil)
Expand Down
2 changes: 1 addition & 1 deletion app/access/service_plan_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def create?(_object, _params=nil)
def read?(object)
return @ok_read if instance_variable_defined?(:@ok_read)

@ok_read = (admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user))
@ok_read = admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user)
end

def read_for_update?(_object, _params=nil)
Expand Down
2 changes: 1 addition & 1 deletion app/access/service_plan_visibility_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def create?(_object, _params=nil)
def read?(object)
return @ok_read if instance_variable_defined?(:@ok_read)

@ok_read = (admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user))
@ok_read = admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user)
end

def read_for_update?(_object, _params=nil)
Expand Down
2 changes: 1 addition & 1 deletion app/access/service_usage_event_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def create?(_object, _params=nil)
def read?(object)
return @ok_read if instance_variable_defined?(:@ok_read)

@ok_read = (admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user))
@ok_read = admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user)
end

def read_for_update?(_object, _params=nil)
Expand Down
2 changes: 1 addition & 1 deletion app/access/stack_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def create?(_object, _params=nil)
def read?(object)
return @ok_read if instance_variable_defined?(:@ok_read)

@ok_read = (admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user))
@ok_read = admin_user? || admin_read_only_user? || global_auditor? || object_is_visible_to_user?(object, context.user)
end

def read_for_update?(_object, _params=nil)
Expand Down
2 changes: 1 addition & 1 deletion app/actions/space_diff_manifest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def remove_default_missing_fields(existing_value, current_key, value)
if manifest_app_hash_resource.nil?
existing_value.delete_at(i)
else
resource.each do |k, _v|
resource.each_key do |k|
existing_value[i].delete(k) if manifest_app_hash_resource[k].nil?
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/base/model_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def do_related(verb, guid, name, other_guid, parent_model=model)
#
# @param [Roles] The roles for the current user or client.
def validate_access(operation, obj, *)
if @access_context.cannot?("#{operation}_with_token".to_sym, obj)
if @access_context.cannot?(:"#{operation}_with_token", obj)
obj = obj.to_s if obj.is_a? Class
logger.info('allowy.access-denied.insufficient-scope', op: "#{operation}_with_token", obj: obj, user: user, roles: roles)
raise CloudController::Errors::ApiError.new_from_details('InsufficientScope')
Expand Down
18 changes: 9 additions & 9 deletions app/controllers/internal/syslog_drain_urls_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ def list
where(Sequel.lit('syslog_drain_url IS NOT NULL')).
where(Sequel.lit("syslog_drain_url != ''")).
group(
"#{AppModel.table_name}__guid".to_sym,
"#{AppModel.table_name}__name".to_sym,
"#{Space.table_name}__name".to_sym,
"#{Organization.table_name}__name".to_sym
:"#{AppModel.table_name}__guid",
:"#{AppModel.table_name}__name",
:"#{Space.table_name}__name",
:"#{Organization.table_name}__name"
).
select(
"#{AppModel.table_name}__guid".to_sym,
"#{AppModel.table_name}__name".to_sym,
aggregate_function("#{ServiceBinding.table_name}__syslog_drain_url".to_sym).as(:syslog_drain_urls)
:"#{AppModel.table_name}__guid",
:"#{AppModel.table_name}__name",
aggregate_function(:"#{ServiceBinding.table_name}__syslog_drain_url").as(:syslog_drain_urls)
).
select_append("#{Space.table_name}__name___space_name".to_sym).
select_append("#{Organization.table_name}__name___organization_name".to_sym).
select_append(:"#{Space.table_name}__name___space_name").
select_append(:"#{Organization.table_name}__name___organization_name").
order(:guid).
limit(batch_size).
offset(last_id).
Expand Down
12 changes: 6 additions & 6 deletions app/controllers/runtime/organizations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ def get_memory_usage(guid)
VCAP::CloudController::Roles::ORG_ROLE_NAMES.each do |role|
plural_role = role.to_s.pluralize

put "/v2/organizations/:guid/#{plural_role}/:user_id", "add_#{role}_by_user_id".to_sym
put "/v2/organizations/:guid/#{plural_role}", "add_#{role}_by_username".to_sym
put "/v2/organizations/:guid/#{plural_role}/:user_id", :"add_#{role}_by_user_id"
put "/v2/organizations/:guid/#{plural_role}", :"add_#{role}_by_username"

define_method("add_#{role}_by_username") do |guid|
FeatureFlag.raise_unless_enabled!(:set_roles_by_username)
Expand Down Expand Up @@ -213,10 +213,10 @@ def get_memory_usage(guid)
VCAP::CloudController::Roles::ORG_ROLE_NAMES.each do |role|
plural_role = role.to_s.pluralize

delete "/v2/organizations/:guid/#{plural_role}/:user_id", "remove_#{role}_by_user_id".to_sym
delete "/v2/organizations/:guid/#{plural_role}", "remove_#{role}_by_username".to_sym
delete "/v2/organizations/:guid/#{plural_role}/:user_id", :"remove_#{role}_by_user_id"
delete "/v2/organizations/:guid/#{plural_role}", :"remove_#{role}_by_username"

post "/v2/organizations/:guid/#{plural_role}/remove", "remove_#{role}_by_username".to_sym
post "/v2/organizations/:guid/#{plural_role}/remove", :"remove_#{role}_by_username"

define_method("remove_#{role}_by_username") do |guid|
FeatureFlag.raise_unless_enabled!(:unset_roles_by_username)
Expand Down Expand Up @@ -340,7 +340,7 @@ def add_role(guid, role, user_id, username)
end

def remove_role(guid, role, user_id)
response = remove_related(guid, "#{role}s".to_sym, user_id, Organization)
response = remove_related(guid, :"#{role}s", user_id, Organization)

user = User.first(guid: user_id)
user.username = '' unless user.username
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/runtime/route_mappings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def get_filtered_dataset_for_enumeration(model, dataset, query_params, opts)
define_routes

def filter_dataset(dataset)
dataset.where("#{RouteMappingModel.table_name}__process_type".to_sym => ProcessTypes::WEB)
dataset.where("#{RouteMappingModel.table_name}__process_type": ProcessTypes::WEB)
end

def get_app_port(process_guid, app_port)
Expand Down
10 changes: 5 additions & 5 deletions app/controllers/runtime/spaces_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ def delete(guid)
VCAP::CloudController::Roles::SPACE_ROLE_NAMES.each do |role|
plural_role = role.to_s.pluralize

put "/v2/spaces/:guid/#{plural_role}/:user_id", "add_#{role}_by_user_id".to_sym
put "/v2/spaces/:guid/#{plural_role}", "add_#{role}_by_username".to_sym
put "/v2/spaces/:guid/#{plural_role}/:user_id", :"add_#{role}_by_user_id"
put "/v2/spaces/:guid/#{plural_role}", :"add_#{role}_by_username"

define_method("add_#{role}_by_username") do |guid|
FeatureFlag.raise_unless_enabled!(:set_roles_by_username)
Expand Down Expand Up @@ -217,10 +217,10 @@ def delete(guid)
VCAP::CloudController::Roles::SPACE_ROLE_NAMES.each do |role|
plural_role = role.to_s.pluralize

delete "/v2/spaces/:guid/#{plural_role}/:user_id", "remove_#{role}_by_user_id".to_sym
delete "/v2/spaces/:guid/#{plural_role}", "remove_#{role}_by_username".to_sym
delete "/v2/spaces/:guid/#{plural_role}/:user_id", :"remove_#{role}_by_user_id"
delete "/v2/spaces/:guid/#{plural_role}", :"remove_#{role}_by_username"

post "/v2/spaces/:guid/#{plural_role}/remove", "remove_#{role}_by_username".to_sym
post "/v2/spaces/:guid/#{plural_role}/remove", :"remove_#{role}_by_username"

define_method("remove_#{role}_by_username") do |guid|
FeatureFlag.raise_unless_enabled!(:unset_roles_by_username)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/v3/service_instances_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def credentials

service_event_repository.record_user_provided_service_instance_event(:show, service_instance)

render status: :ok, json: (service_instance.credentials || {})
render status: :ok, json: service_instance.credentials || {}
end

def parameters
Expand Down
4 changes: 2 additions & 2 deletions app/fetchers/isolation_segment_list_fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ def fetch_for_organizations(message, org_guids_query:)
private

def filter(message, dataset)
dataset = dataset.where("#{IsolationSegmentModel.table_name}__guid".to_sym => message.guids) if message.requested?(:guids)
dataset = dataset.where("#{IsolationSegmentModel.table_name}__guid": message.guids) if message.requested?(:guids)

dataset = dataset.where("#{IsolationSegmentModel.table_name}__name".to_sym => message.names) if message.requested?(:names)
dataset = dataset.where("#{IsolationSegmentModel.table_name}__name": message.names) if message.requested?(:names)

if message.requested?(:organization_guids)
dataset = dataset.join(:organizations_isolation_segments, {
Expand Down
2 changes: 1 addition & 1 deletion app/fetchers/package_list_fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def fetch_for_app(message:)
private

def table_column_name(table_class, name)
"#{table_class.table_name}__#{name}".to_sym
:"#{table_class.table_name}__#{name}"
end

def joined_dataset
Expand Down
2 changes: 1 addition & 1 deletion app/messages/base_message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def to_param_hash(exclude: [], fields: [])

if fields.include?(key)
val.each do |resource, selectors|
params["#{key}[#{resource}]".to_sym] = selectors.join(',')
params[:"#{key}[#{resource}]"] = selectors.join(',')
end
else
params[key] = val.is_a?(Array) ? val.map { |v| v.gsub(',', CGI.escape(',')) }.join(',') : val
Expand Down
2 changes: 1 addition & 1 deletion app/messages/route_update_destinations_message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def validate_destination_contents
app_to_ports_hash[dst[:app]] << dst[:port]
end

app_to_ports_hash.each do |_, port_array|
app_to_ports_hash.each_value do |port_array|
if port_array.length > 10
errors.add(:process, 'must have at most 10 exposed ports.')
break
Expand Down
Loading

0 comments on commit d502820

Please sign in to comment.