Skip to content

Commit

Permalink
style(rubocop): Style/WordArray
Browse files Browse the repository at this point in the history
  • Loading branch information
adamcooke committed Feb 10, 2024
1 parent 129dffa commit bd85920
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion app/models/concerns/has_dns_checks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module HasDNSChecks

def dns_ok?
spf_status == "OK" && dkim_status == "OK" && ["OK", "Missing"].include?(mx_status) && ["OK", "Missing"].include?(return_path_status)
spf_status == "OK" && dkim_status == "OK" && %w[OK Missing].include?(mx_status) && %w[OK Missing].include?(return_path_status)
end

def dns_checked?
Expand Down
2 changes: 1 addition & 1 deletion app/models/credential.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Credential < ApplicationRecord

belongs_to :server

TYPES = ["SMTP", "API", "SMTP-IP"].freeze
TYPES = %w[SMTP API SMTP-IP].freeze

validates :key, presence: true, uniqueness: { case_sensitive: false }
validates :type, inclusion: { in: TYPES }
Expand Down
4 changes: 2 additions & 2 deletions app/models/domain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class Domain < ApplicationRecord

include HasDNSChecks

VERIFICATION_EMAIL_ALIASES = ["webmaster", "postmaster", "admin", "administrator", "hostmaster"].freeze
VERIFICATION_METHODS = ["DNS", "Email"].freeze
VERIFICATION_EMAIL_ALIASES = %w[webmaster postmaster admin administrator hostmaster].freeze
VERIFICATION_METHODS = %w[DNS Email].freeze

belongs_to :server, optional: true
belongs_to :owner, optional: true, polymorphic: true
Expand Down
4 changes: 2 additions & 2 deletions app/models/http_endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class HTTPEndpoint < ApplicationRecord
has_many :routes, as: :endpoint
has_many :additional_route_endpoints, dependent: :destroy, as: :endpoint

ENCODINGS = ["BodyAsJSON", "FormData"].freeze
FORMATS = ["Hash", "RawMessage"].freeze
ENCODINGS = %w[BodyAsJSON FormData].freeze
FORMATS = %w[Hash RawMessage].freeze

before_destroy :update_routes

Expand Down
2 changes: 1 addition & 1 deletion app/models/organization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

class Organization < ApplicationRecord

RESERVED_PERMALINKS = ["new", "edit", "remove", "delete", "destroy", "admin", "mail", "org", "server"].freeze
RESERVED_PERMALINKS = %w[new edit remove delete destroy admin mail org server].freeze

INITIAL_QUOTA = 10
INITIAL_SUPER_QUOTA = 10_000
Expand Down
6 changes: 3 additions & 3 deletions app/models/route.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

class Route < ApplicationRecord

MODES = ["Endpoint", "Accept", "Hold", "Bounce", "Reject"].freeze
SPAM_MODES = ["Mark", "Quarantine", "Fail"].freeze
ENDPOINT_TYPES = ["SMTPEndpoint", "HTTPEndpoint", "AddressEndpoint"].freeze
MODES = %w[Endpoint Accept Hold Bounce Reject].freeze
SPAM_MODES = %w[Mark Quarantine Fail].freeze
ENDPOINT_TYPES = %w[SMTPEndpoint HTTPEndpoint AddressEndpoint].freeze

include HasUUID

Expand Down
4 changes: 2 additions & 2 deletions app/models/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@

class Server < ApplicationRecord

RESERVED_PERMALINKS = ["new", "all", "search", "stats", "edit", "manage", "delete", "destroy", "remove"].freeze
MODES = ["Live", "Development"].freeze
RESERVED_PERMALINKS = %w[new all search stats edit manage delete destroy remove].freeze
MODES = %w[Live Development].freeze

include HasUUID
include HasSoftDestroy
Expand Down
2 changes: 1 addition & 1 deletion app/models/smtp_endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class SMTPEndpoint < ApplicationRecord
has_many :routes, as: :endpoint
has_many :additional_route_endpoints, dependent: :destroy, as: :endpoint

SSL_MODES = ["None", "Auto", "STARTTLS", "TLS"].freeze
SSL_MODES = %w[None Auto STARTTLS TLS].freeze

before_destroy :update_routes

Expand Down
18 changes: 9 additions & 9 deletions app/models/webhook_event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@

class WebhookEvent < ApplicationRecord

EVENTS = [
"MessageSent",
"MessageDelayed",
"MessageDeliveryFailed",
"MessageHeld",
"MessageBounced",
"MessageLinkClicked",
"MessageLoaded",
"DomainDNSError"
EVENTS = %w[
MessageSent
MessageDelayed
MessageDeliveryFailed
MessageHeld
MessageBounced
MessageLinkClicked
MessageLoaded
DomainDNSError
].freeze

belongs_to :webhook
Expand Down
2 changes: 1 addition & 1 deletion lib/postal/message_db/database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def select(table, options = {})
end
if options[:order]
direction = (options[:direction] || "ASC").upcase
raise Postal::Error, "Invalid direction #{options[:direction]}" unless ["ASC", "DESC"].include?(direction)
raise Postal::Error, "Invalid direction #{options[:direction]}" unless %w[ASC DESC].include?(direction)

sql_query << " ORDER BY `#{options[:order]}` #{direction}"
end
Expand Down
6 changes: 3 additions & 3 deletions lib/postal/message_db/provisioner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ def drop_table(table_name)
# environment and can be quite dangerous in production.
#
def clean
["clicks", "deliveries", "links", "live_stats", "loads", "messages",
"raw_message_sizes", "spam_checks", "stats_daily", "stats_hourly",
"stats_monthly", "stats_yearly", "suppressions", "webhook_requests"].each do |table|
%w[clicks deliveries links live_stats loads messages
raw_message_sizes spam_checks stats_daily stats_hourly
stats_monthly stats_yearly suppressions webhook_requests].each do |table|
@database.query("TRUNCATE `#{@database.database_name}`.`#{table}`")
end
end
Expand Down

0 comments on commit bd85920

Please sign in to comment.