Skip to content

Commit

Permalink
Update Standard Ruby and comply
Browse files Browse the repository at this point in the history
  • Loading branch information
jonallured committed Dec 5, 2024
1 parent ae175f0 commit 43481c7
Show file tree
Hide file tree
Showing 18 changed files with 89 additions and 70 deletions.
37 changes: 25 additions & 12 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ GEM
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (2.9.0)
jwt (2.2.3)
kaminari (1.2.1)
activesupport (>= 4.1.0)
Expand All @@ -271,6 +272,8 @@ GEM
rexml (>= 3.3.9)
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
language_server-protocol (3.17.0.3)
lint_roller (1.1.0)
listen (3.4.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
Expand Down Expand Up @@ -444,20 +447,21 @@ GEM
rspec-mocks (~> 3.10)
rspec-support (~> 3.10)
rspec-support (3.10.2)
rubocop (1.14.0)
rubocop (1.68.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.0.0.0)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.5.0, < 2.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.36.2)
parser (>= 3.3.1.0)
rubocop-performance (1.11.2)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-performance (1.22.1)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
ruby_parser (3.15.1)
Expand Down Expand Up @@ -530,9 +534,18 @@ GEM
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
standard (1.1.1)
rubocop (= 1.14.0)
rubocop-performance (= 1.11.2)
standard (1.42.1)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.68.0)
standard-custom (~> 1.0.0)
standard-performance (~> 1.5)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50)
standard-performance (1.5.0)
lint_roller (~> 1.1)
rubocop-performance (~> 1.22.0)
temple (0.8.2)
thor (1.3.2)
tilt (2.4.0)
Expand Down
2 changes: 1 addition & 1 deletion app/graphql/resolvers/concerns/resolvers/submissionable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def external_submission_id
end

def compute_error
return IdsNotPassed unless ids_passed?
IdsNotPassed unless ids_passed?
end

def ids_passed?
Expand Down
2 changes: 1 addition & 1 deletion app/graphql/resolvers/offer_resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def run
private

def compute_error
return BadArgumentError unless admin? || partner? || user?
BadArgumentError unless admin? || partner? || user?
end

def validate_user(offer)
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/submissions_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def formatted_minimum_price_for_email(submission)

def artist_supply_priority(is_p1: false, target_supply: false, **)
return "P1" if is_p1
return "P2" if target_supply
"P2" if target_supply
end

def assignable_admin?(user)
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/utm_params_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module UtmParamsHelper
def utm_params(source:, campaign:, **args)
initial = {utm_campaign: campaign, utm_medium: "email", utm_source: source}
transformed_args = args.each_with_object({}) { |(key, value), obj| obj["utm_#{key}".to_sym] = value }
transformed_args = args.each_with_object({}) { |(key, value), obj| obj[:"utm_#{key}"] = value }
initial.merge(transformed_args)
end

Expand Down
24 changes: 12 additions & 12 deletions app/mailers/admin_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ def submission(submission:, user:, artist:)
)

smtpapi category: %w[submission],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}
mail(
to: Convection.config.admin_email_address,
subject: "Submission ##{@submission.id}"
Expand All @@ -33,9 +33,9 @@ def submission_approved(submission:, artist:)
assigned_admin = AdminUser.find_by(gravity_user_id: submission.assigned_to)

smtpapi category: %w[submission],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}

mail(
to: assigned_admin.email,
Expand All @@ -51,9 +51,9 @@ def submission_resubmitted(submission:, artist:)
assigned_admin = AdminUser.find_by(gravity_user_id: submission.assigned_to)

smtpapi category: %w[submission],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}

mail(
to: assigned_admin.email,
Expand All @@ -72,9 +72,9 @@ def artwork_updated(submission:, artwork_data:, changes: nil, image_added: nil)
@image_added = image_added

smtpapi category: %w[submission],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}

mail(
to: assigned_admin.email,
Expand Down
6 changes: 3 additions & 3 deletions app/mailers/partner_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ def submission_digest(
content: "sub-digest-auction"
)
smtpapi category: %w[submission_digest],
unique_args: {
partner_name: partner_name
}
unique_args: {
partner_name: partner_name
}

current_date = Time.now.utc.strftime("%B %-d")
mail(
Expand Down
56 changes: 28 additions & 28 deletions app/mailers/user_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ def submission_receipt(submission:, artist:)
)

smtpapi category: %w[submission_receipt],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}
mail(
to: submission.email,
subject: "Thank you for submitting your artwork to Artsy",
Expand All @@ -35,9 +35,9 @@ def first_upload_reminder(submission:)
)

smtpapi category: %w[first_upload_reminder],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}
mail to: submission.email, subject: "You're Almost Done"
end

Expand All @@ -50,11 +50,11 @@ def second_upload_reminder(submission:)
)

smtpapi category: %w[second_upload_reminder],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}
mail to: submission.email,
subject: "Artsy Consignments - complete your submission"
subject: "Artsy Consignments - complete your submission"
end

def submission_approved(submission:, artist:)
Expand All @@ -69,9 +69,9 @@ def submission_approved(submission:, artist:)
)

smtpapi category: %w[submission_approved],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}
mail(
to: submission.email,
subject: "Artsy Approved Submission | Next Steps"
Expand All @@ -90,9 +90,9 @@ def artist_submission_rejected(submission:, artist:)
)

smtpapi category: %w[artist_submission_rejected],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}
mail(to: submission.email, subject: "An update about your submission")
end

Expand All @@ -108,9 +108,9 @@ def fake_submission_rejected(submission:, artist:)
)

smtpapi category: %w[fake_submission_rejected],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}
mail(to: submission.email, subject: "Artsy Submission")
end

Expand All @@ -128,9 +128,9 @@ def nsv_bsv_submission_rejected(submission:, artist:, logged_in:)
)

smtpapi category: %w[nsv_bsv_submission_rejected],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}
title = submission.title || "Unknown"
artist_name = artist&.name
subject = "Update on \"#{title}\" #{artist_name ? "by #{artist_name}" : ""}"
Expand All @@ -150,9 +150,9 @@ def non_target_supply_artist_rejected(submission:, artist:)
)

smtpapi category: %w[non_target_supply_artist_rejected],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}
mail(to: submission.email, subject: "An update about your submission")
end

Expand All @@ -168,9 +168,9 @@ def other_submission_rejected(submission:, artist:)
)

smtpapi category: %w[other_submission_rejected],
unique_args: {
submission_id: submission.id
}
unique_args: {
submission_id: submission.id
}
mail(to: submission.email, subject: "An update about your submission")
end

Expand Down
6 changes: 3 additions & 3 deletions app/models/concerns/percentize.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ module Percentize
class_methods do
def percentize(*method_names)
method_names.each do |method_name|
attribute "#{method_name}_whole".to_sym
attribute :"#{method_name}_whole"

define_method "#{method_name}_whole" do
define_method :"#{method_name}_whole" do
return if self[method_name].blank?

(self[method_name] * 100).round(2)
end

define_method "#{method_name}_whole=" do |percent_whole|
define_method :"#{method_name}_whole=" do |percent_whole|
if percent_whole.blank?
self[method_name] = nil
else
Expand Down
2 changes: 1 addition & 1 deletion app/models/offer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def set_state

# defines methods sent?, accepted?, etc. for each possible offer state
STATES.each do |method|
define_method "#{method}?".to_sym do
define_method :"#{method}?" do
state == method
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/models/submission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def sale_state
end

def sorted_images
images.sort_by.with_index { |a, i| a == primary_image ? -1 : i }
images.sort_by.with_index { |a, i| (a == primary_image) ? -1 : i }
end

def as_json(options = {})
Expand Down Expand Up @@ -170,7 +170,7 @@ def thumbnail

# defines methods submitted?, approved?, etc. for each possible submission state
STATES.each do |method|
define_method "#{method}?".to_sym do
define_method :"#{method}?" do
state == method
end
end
Expand Down
1 change: 1 addition & 0 deletions config/initializers/application_controller_renderer.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# ActiveSupport::Reloader.to_prepare do
Expand Down
1 change: 1 addition & 0 deletions config/initializers/backtrace_silencers.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
Expand Down
1 change: 1 addition & 0 deletions config/initializers/content_security_policy.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# Define an application-wide content security policy
Expand Down
1 change: 1 addition & 0 deletions config/initializers/inflections.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# Add new inflection rules using the following format. Inflections
Expand Down
1 change: 1 addition & 0 deletions config/initializers/mime_types.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# Add new mime types for use in respond_to blocks:
Expand Down
1 change: 1 addition & 0 deletions config/initializers/permissions_policy.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Define an application-wide HTTP permissions policy. For further
# information see https://developers.google.com/web/updates/2018/06/feature-policy
#
Expand Down
Loading

0 comments on commit 43481c7

Please sign in to comment.