Skip to content

Commit

Permalink
appease ChefStyle: Style/TrailingCommaInHashLiteral
Browse files Browse the repository at this point in the history
> Put a comma after the last item of a multiline hash.

OK

Signed-off-by: Robb Kidd <rkidd@chef.io>
  • Loading branch information
robbkidd committed Jun 25, 2020
1 parent d299055 commit 8cbd548
Show file tree
Hide file tree
Showing 41 changed files with 118 additions and 118 deletions.
6 changes: 3 additions & 3 deletions src/supermarket/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
postgres: {
user: "vagrant",
database: "supermarket_development",
auth_method: "trust"
auth_method: "trust",
},
supermarket: {
host: "localhost",
port: VM_PORT
}
port: VM_PORT,
},
}

chef.run_list = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def destroy
error(
{
error_code: t("api.error_codes.forbidden"),
error_messages: [t("api.error_messages.unauthorized_destroy_error")]
error_messages: [t("api.error_messages.unauthorized_destroy_error")],
},
403
)
Expand Down Expand Up @@ -162,7 +162,7 @@ def destroy_version
def upload_params
{
cookbook: params.require(:cookbook),
tarball: params.require(:tarball)
tarball: params.require(:tarball),
}
end

Expand All @@ -181,7 +181,7 @@ def authenticate_user!
return error(
{
error_code: t("api.error_codes.authentication_failed"),
error_messages: [t("api.error_messages.invalid_username", username: username)]
error_messages: [t("api.error_messages.invalid_username", username: username)],
},
401
)
Expand All @@ -191,7 +191,7 @@ def authenticate_user!
return error(
{
error_code: t("api.error_codes.authentication_failed"),
error_messages: [t("api.error_messages.missing_public_key_error", current_host: request.base_url)]
error_messages: [t("api.error_messages.missing_public_key_error", current_host: request.base_url)],
},
401
)
Expand All @@ -208,7 +208,7 @@ def authenticate_user!
error(
{
error_code: t("api.error_codes.authentication_failed"),
error_messages: [t("api.error_messages.authentication_key_error")]
error_messages: [t("api.error_messages.authentication_key_error")],
},
401
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def show
total_cookbooks: Cookbook.count,
total_follows: CookbookFollower.count,
total_users: User.count,
total_hits: { "/universe" => Universe.show_hits }
total_hits: { "/universe" => Universe.show_hits },
}
end
end
4 changes: 2 additions & 2 deletions src/supermarket/app/controllers/api/v1_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def render_404
error(
{
error_messages: [t("api.error_messages.not_found")],
error_code: t("api.error_codes.not_found")
error_code: t("api.error_codes.not_found"),
},
404
)
Expand All @@ -27,7 +27,7 @@ def render_not_authorized(messages)
error(
{
error_code: t("api.error_codes.unauthorized"),
error_messages: messages
error_messages: messages,
},
401
)
Expand Down
2 changes: 1 addition & 1 deletion src/supermarket/app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def flash_message_class_for(name)
{
"notice" => "success",
"alert" => "alert",
"warning" => "warning"
"warning" => "warning",
}.fetch(name)
end
end
2 changes: 1 addition & 1 deletion src/supermarket/app/helpers/supported_platforms_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def supported_platform_icon(platform)
"suse" => "suse",
"ubuntu" => "ubuntu",
"windows" => "windows",
"zlinux" => "zlinux"
"zlinux" => "zlinux",
}.fetch(platform.name.parameterize(separator: "_"), "generic")
end
end
2 changes: 1 addition & 1 deletion src/supermarket/app/helpers/users_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def pluralized_stats(count, thing)

def gravatar_image(user, options = {})
options = {
size: 48
size: 48,
}.merge(options)

size = options[:size]
Expand Down
12 changes: 6 additions & 6 deletions src/supermarket/app/models/cookbook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Cookbook < ApplicationRecord
"recently_updated" => "updated_at DESC",
"recently_added" => "id DESC",
"most_downloaded" => "(cookbooks.web_download_count + cookbooks.api_download_count) DESC, id ASC",
"most_followed" => "cookbook_followers_count DESC, id ASC"
"most_followed" => "cookbook_followers_count DESC, id ASC",
}.fetch(ordering, "name ASC"))
}

Expand Down Expand Up @@ -69,15 +69,15 @@ class Cookbook < ApplicationRecord
pg_search_scope(
:search,
against: {
name: "A"
name: "A",
},
associated_against: {
chef_account: { username: "B" },
cookbook_versions: { description: "C" }
cookbook_versions: { description: "C" },
},
using: {
tsearch: { dictionary: "english", only: [:username, :description], prefix: true },
trigram: { only: [:name] }
trigram: { only: [:name] },
},
ranked_by: ":trigram + (0.5 * :tsearch)",
order_within_rank: "cookbooks.name"
Expand Down Expand Up @@ -116,11 +116,11 @@ class Cookbook < ApplicationRecord
validates :cookbook_versions, presence: true
validates :source_url, url: {
allow_blank: true,
allow_nil: true
allow_nil: true,
}
validates :issues_url, url: {
allow_blank: true,
allow_nil: true
allow_nil: true,
}

#
Expand Down
4 changes: 2 additions & 2 deletions src/supermarket/app/models/cookbook_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CookbookVersion < ApplicationRecord
validates :version, presence: true,
uniqueness: {
scope: :cookbook_id,
case_sensitive: false
case_sensitive: false,
},
chef_version: true
validates_attachment(
Expand All @@ -41,7 +41,7 @@ class CookbookVersion < ApplicationRecord
"application/x-bzip", "application/x-zip-compressed",
"application/cap", "application/x-tar-gz",
"application/postscript", "application/x-targz"],
message: ->(_, info) { "can not be #{info[:value]}." }
message: ->(_, info) { "can not be #{info[:value]}." },
}
)

Expand Down
10 changes: 5 additions & 5 deletions src/supermarket/app/models/tool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Tool < ApplicationRecord
validates :slug, presence: true, uniqueness: { case_sensitive: false }, format: /\A[\w_-]+\z/i
validates :source_url, url: {
allow_blank: true,
allow_nil: true
allow_nil: true,
}

# Search
Expand All @@ -31,14 +31,14 @@ class Tool < ApplicationRecord
:search,
against: {
name: "A",
description: "C"
description: "C",
},
associated_against: {
chef_account: { username: "B" }
chef_account: { username: "B" },
},
using: {
tsearch: { dictionary: "english", only: [:username, :description], prefix: true },
trigram: { only: [:name] }
trigram: { only: [:name] },
},
ranked_by: ":trigram + (0.5 * :tsearch)",
order_within_rank: "tools.name"
Expand Down Expand Up @@ -73,7 +73,7 @@ class Tool < ApplicationRecord

scope :ordered_by, lambda { |ordering|
reorder({
"recently_added" => "id DESC"
"recently_added" => "id DESC",
}.fetch(ordering, "name ASC"))
}

Expand Down
2 changes: 1 addition & 1 deletion src/supermarket/app/models/universe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def generate(opts = {})
LOCATION_TYPE => CHEF,
LOCATION_PATH => location_path,
DOWNLOAD_URL => download_url(name, version, url_base),
DEPENDENCIES => {}
DEPENDENCIES => {},
}

if dependency && dependency_constraint
Expand Down
6 changes: 3 additions & 3 deletions src/supermarket/app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ class User < ApplicationRecord
against: {
first_name: "A",
last_name: "B",
email: "C"
email: "C",
},
associated_against: {
chef_account: :username,
github_account: :username
github_account: :username,
},
using: {
tsearch: { prefix: true, dictionary: "english" },
trigram: { threshold: 0.2 }
trigram: { threshold: 0.2 },
}
)

Expand Down
4 changes: 2 additions & 2 deletions src/supermarket/app/workers/fieri_notify_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def perform(cookbook_version_id)
{
"name" => cookbook_version.name,
"version" => cookbook_version.version,
"artifact_url" => cookbook_version.cookbook_artifact_url
}
"artifact_url" => cookbook_version.cookbook_artifact_url,
},
}

req = Net::HTTP::Post.new(uri, "Content-Type" => "application/json")
Expand Down
2 changes: 1 addition & 1 deletion src/supermarket/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Application < Rails::Application
self.default_url_options = {
host: ENV["FQDN"],
port: ENV["PORT"],
protocol: ENV["PROTOCOL"]
protocol: ENV["PROTOCOL"],
}

# Configure the email renderer for building links back to the site
Expand Down
2 changes: 1 addition & 1 deletion src/supermarket/config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

config.cache_store = :memory_store
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{2.days.seconds.to_i}"
"Cache-Control" => "public, max-age=#{2.days.seconds.to_i}",
}
else
config.action_controller.perform_caching = false
Expand Down
2 changes: 1 addition & 1 deletion src/supermarket/config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
port: ENV["SMTP_PORT"],
user_name: ENV["SMTP_USER_NAME"],
password: ENV["SMTP_PASSWORD"],
authentication: "plain"
authentication: "plain",
}
else
config.action_mailer.delivery_method = :sendmail
Expand Down
2 changes: 1 addition & 1 deletion src/supermarket/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{1.hour.seconds.to_i}"
"Cache-Control" => "public, max-age=#{1.hour.seconds.to_i}",
}

# Show full error reports and disable caching.
Expand Down
2 changes: 1 addition & 1 deletion src/supermarket/config/initializers/datadog_tracer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
auto_instrument: true,
auto_instrument_redis: true,
default_service: ENV["DATADOG_APP_NAME"] || "rails_app",
env: ENV["DATADOG_ENVIRONMENT"] || nil
env: ENV["DATADOG_ENVIRONMENT"] || nil,
}
end
4 changes: 2 additions & 2 deletions src/supermarket/config/initializers/omniauth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
client_options = {
ssl: {
verify: ENV["CHEF_OAUTH2_VERIFY_SSL"].present? &&
ENV["CHEF_OAUTH2_VERIFY_SSL"] != "false"
}
ENV["CHEF_OAUTH2_VERIFY_SSL"] != "false",
},
}

if ENV["CHEF_OAUTH2_URL"].present?
Expand Down
6 changes: 3 additions & 3 deletions src/supermarket/config/initializers/paperclip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@
options = {
storage: "s3",
s3_credentials: {
bucket: ENV["S3_BUCKET"]
bucket: ENV["S3_BUCKET"],
},
path: path,
bucket: ENV["S3_BUCKET"],
s3_protocol: ENV["PROTOCOL"],
s3_region: ENV["S3_REGION"]
s3_region: ENV["S3_REGION"],
}

# If static creds are present in config - use them
if Supermarket::S3ConfigAudit.use_s3_with_static_creds?(ENV)
options = options.merge(
s3_credentials: {
access_key_id: ENV["S3_ACCESS_KEY_ID"],
secret_access_key: ENV["S3_SECRET_ACCESS_KEY"]
secret_access_key: ENV["S3_SECRET_ACCESS_KEY"],
}
)
end
Expand Down
4 changes: 2 additions & 2 deletions src/supermarket/config/initializers/sidekiq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
Sidekiq::Cron::Job.load_from_hash(
"Daily refresh of the sitemap" => {
class: "SitemapRefreshWorker",
cron: "@daily"
cron: "@daily",
},
"Schedule refresh of expiring tokens" => {
class: "OauthTokenRefreshScheduleWorker",
cron: "*/5 * * * *"
cron: "*/5 * * * *",
}
)
end
Expand Down
2 changes: 1 addition & 1 deletion src/supermarket/spec/api/cookbook_destroy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"average_rating" => nil,
"category" => "Other",
"latest_version" => "http://www.example.com/api/v1/cookbooks/redis-test/versions/1.0.0",
"up_for_adoption" => nil
"up_for_adoption" => nil,
}
end

Expand Down
8 changes: 4 additions & 4 deletions src/supermarket/spec/api/cookbook_search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"cookbook_name" => "redis-test",
"cookbook_description" => "Installs/Configures redis-test",
"cookbook" => "http://www.example.com/api/v1/cookbooks/redis-test",
"cookbook_maintainer" => user.username
"cookbook_maintainer" => user.username,
}
end

Expand All @@ -17,7 +17,7 @@
"cookbook_name" => "redisio-test",
"cookbook_description" => "Installs/Configures redisio-test",
"cookbook" => "http://www.example.com/api/v1/cookbooks/redisio-test",
"cookbook_maintainer" => user.username
"cookbook_maintainer" => user.username,
}
end

Expand All @@ -36,7 +36,7 @@
search_response = {
"items" => [redis_test_signature, redisio_test_signature],
"total" => 2,
"start" => 0
"start" => 0,
}

get "/api/v1/search?q=redis"
Expand All @@ -48,7 +48,7 @@
search_response = {
"items" => [redisio_test_signature],
"total" => 1,
"start" => 1
"start" => 1,
}

get "/api/v1/search?q=redis&start=1&items=1"
Expand Down
2 changes: 1 addition & 1 deletion src/supermarket/spec/api/cookbook_show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
],
"description" => "Installs/Configures redis-test",
"average_rating" => nil,
"deprecated" => false
"deprecated" => false,
}
end

Expand Down
Loading

0 comments on commit 8cbd548

Please sign in to comment.