Skip to content

Commit

Permalink
Merge pull request #3455 from sap-contributions/un-pluck
Browse files Browse the repository at this point in the history
Un-pluck Rubocop changes
  • Loading branch information
philippthun authored Oct 4, 2023
2 parents 6d23f0c + e83202d commit 8a7a1f1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def map_space_roles(user_guids, space_id)
end

def subset_of_guids(role_dataset, user_guids)
role_dataset.where(guid: user_guids).pluck(:guid)
role_dataset.where(guid: user_guids).select_map(:guid)
end
end
end
10 changes: 3 additions & 7 deletions app/fetchers/app_list_fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,24 @@ def filter(message, dataset)
message.stacks
)

dataset = dataset.where(guid: buildpack_lifecycle_data_dataset.map(&:app_guid))
dataset = dataset.where(guid: buildpack_lifecycle_data_dataset.select(:app_guid))
end

# rubocop:disable Rails/PluckInWhere
if message.requested?(:lifecycle_type)
if message.lifecycle_type == BuildpackLifecycleDataModel::LIFECYCLE_TYPE
dataset = dataset.where(
guid: BuildpackLifecycleDataModel.
select(:app_guid).
where(Sequel.~(app_guid: nil)).
pluck(:app_guid)
select(:app_guid)
)
elsif message.lifecycle_type == DockerLifecycleDataModel::LIFECYCLE_TYPE
dataset = dataset.exclude(
guid: BuildpackLifecycleDataModel.
select(:app_guid).
where(Sequel.~(app_guid: nil)).
pluck(:app_guid)
select(:app_guid)
)
end
end
# rubocop:enable Rails/PluckInWhere

if message.requested?(:organization_guids)
dataset = dataset.
Expand Down
2 changes: 1 addition & 1 deletion lib/cloud_controller/permissions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def can_read_system_environment_variables?(space_id, org_id)
end

def readable_app_guids
VCAP::CloudController::AppModel.user_visible(@user, can_read_globally?).pluck(:guid)
VCAP::CloudController::AppModel.user_visible(@user, can_read_globally?).select_map(:guid)
end

def readable_space_quota_guids
Expand Down
2 changes: 1 addition & 1 deletion lib/cloud_controller/validate_database_keys.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def validate_encryption_key_values_unchanged!(config)

def missing_database_encryption_keys(defined_encryption_key_labels)
used_encryption_key_labels = Set.new(Encryptor.encrypted_classes.map do |klass|
klass.constantize.distinct.pluck(:encryption_key_label)
klass.constantize.distinct.select_map(:encryption_key_label)
end.flatten.compact_blank.map(&:to_sym))
(used_encryption_key_labels - defined_encryption_key_labels).to_a
end
Expand Down

0 comments on commit 8a7a1f1

Please sign in to comment.