1
0
مراية لـ https://github.com/postalserver/postal.git تم المزامنة 2026-01-22 07:38:18 +00:00

style(rubocop): Style/TrailingCommaInArrayLiteral

هذا الالتزام موجود في:
Adam Cooke
2024-03-12 11:45:44 +00:00
الأصل d84152eb5d
التزام 4e13577891
13 ملفات معدلة مع 40 إضافات و25 حذوفات

عرض الملف

@@ -125,6 +125,9 @@ Style/MultilineBlockChain:
Exclude: Exclude:
- "spec/**/*.rb" - "spec/**/*.rb"
Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: consistent_comma
Metrics/AbcSize: Metrics/AbcSize:
Enabled: false Enabled: false

عرض الملف

@@ -45,8 +45,16 @@ class ServersController < ApplicationController
extra_params = [:spam_threshold, :spam_failure_threshold, :postmaster_address] extra_params = [:spam_threshold, :spam_failure_threshold, :postmaster_address]
if current_user.admin? if current_user.admin?
extra_params += [:send_limit, :allow_sender, :privacy_mode, :log_smtp_data, :outbound_spam_threshold, extra_params += [
:message_retention_days, :raw_message_retention_days, :raw_message_retention_size] :send_limit,
:allow_sender,
:privacy_mode,
:log_smtp_data,
:outbound_spam_threshold,
:message_retention_days,
:raw_message_retention_days,
:raw_message_retention_size,
]
end end
if @server.update(safe_params(*extra_params)) if @server.update(safe_params(*extra_params))

عرض الملف

@@ -111,9 +111,11 @@ class DNSResolver
def dns(raise_timeout_errors: false) def dns(raise_timeout_errors: false)
Resolv::DNS.open(nameserver: @nameservers, Resolv::DNS.open(nameserver: @nameservers,
raise_timeout_errors: raise_timeout_errors) do |dns| raise_timeout_errors: raise_timeout_errors) do |dns|
dns.timeouts = [Postal::Config.dns.timeout, dns.timeouts = [
Postal::Config.dns.timeout / 2, Postal::Config.dns.timeout,
Postal::Config.dns.timeout / 2] Postal::Config.dns.timeout / 2,
Postal::Config.dns.timeout / 2,
]
yield dns yield dns
end end
end end

عرض الملف

@@ -13,7 +13,7 @@ class ReplySeparator
/^>*\s*On.{10,200}wrote:\s*$.*/m, /^>*\s*On.{10,200}wrote:\s*$.*/m,
/^>*\s*Sent from my.*/m, /^>*\s*Sent from my.*/m,
/^>*\s*=== Please reply above this line ===.*/m, /^>*\s*=== Please reply above this line ===.*/m,
/(^>.*\n?){10,}/ /(^>.*\n?){10,}/,
].freeze ].freeze
def self.separate(text) def self.separate(text)

عرض الملف

@@ -155,7 +155,7 @@ module SMTPServer
[ [
"250-My capabilities are", "250-My capabilities are",
Postal::Config.smtp_server.tls_enabled? && !@tls ? "250-STARTTLS" : nil, Postal::Config.smtp_server.tls_enabled? && !@tls ? "250-STARTTLS" : nil,
"250 AUTH CRAM-MD5 PLAIN LOGIN" "250 AUTH CRAM-MD5 PLAIN LOGIN",
].compact ].compact
end end

عرض الملف

@@ -26,7 +26,7 @@ module Worker
# @return [Array<Class>] # @return [Array<Class>]
JOBS = [ JOBS = [
Jobs::ProcessQueuedMessagesJob, Jobs::ProcessQueuedMessagesJob,
Jobs::ProcessWebhookRequestsJob Jobs::ProcessWebhookRequestsJob,
].freeze ].freeze
# An array of tasks that should be processed # An array of tasks that should be processed
@@ -41,7 +41,7 @@ module Worker
PruneSuppressionListsScheduledTask, PruneSuppressionListsScheduledTask,
PruneWebhookRequestsScheduledTask, PruneWebhookRequestsScheduledTask,
SendNotificationsScheduledTask, SendNotificationsScheduledTask,
TidyQueuedMessagesTask TidyQueuedMessagesTask,
].freeze ].freeze
# @param [Integer] thread_count The number of worker threads to run in this process # @param [Integer] thread_count The number of worker threads to run in this process

عرض الملف

@@ -6,5 +6,5 @@
# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported # sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
# notations and behaviors. # notations and behaviors.
Rails.application.config.filter_parameters += [ Rails.application.config.filter_parameters += [
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn,
] ]

عرض الملف

@@ -66,7 +66,7 @@ RSpec.describe DNSResolver do
it "returns a list of TXT records" do it "returns a list of TXT records" do
expect(resolver.txt("dnstest.postalserver.io").sort).to eq [ expect(resolver.txt("dnstest.postalserver.io").sort).to eq [
"an example txt record", "an example txt record",
"another example" "another example",
] ]
end end
@@ -79,7 +79,7 @@ RSpec.describe DNSResolver do
it "returns a list of TXT records" do it "returns a list of TXT records" do
expect(resolver.txt("dnstest.postalserver.io", raise_timeout_errors: true).sort).to eq [ expect(resolver.txt("dnstest.postalserver.io", raise_timeout_errors: true).sort).to eq [
"an example txt record", "an example txt record",
"another example" "another example",
] ]
end end
@@ -120,7 +120,7 @@ RSpec.describe DNSResolver do
it "returns a list of MX records" do it "returns a list of MX records" do
expect(resolver.mx("dnstest.postalserver.io")).to eq [ expect(resolver.mx("dnstest.postalserver.io")).to eq [
[10, "mx1.dnstest.postalserver.io"], [10, "mx1.dnstest.postalserver.io"],
[20, "mx2.dnstest.postalserver.io"] [20, "mx2.dnstest.postalserver.io"],
] ]
end end
@@ -133,7 +133,7 @@ RSpec.describe DNSResolver do
it "returns a list of MX records" do it "returns a list of MX records" do
expect(resolver.mx("dnstest.postalserver.io", raise_timeout_errors: true)).to eq [ expect(resolver.mx("dnstest.postalserver.io", raise_timeout_errors: true)).to eq [
[10, "mx1.dnstest.postalserver.io"], [10, "mx1.dnstest.postalserver.io"],
[20, "mx2.dnstest.postalserver.io"] [20, "mx2.dnstest.postalserver.io"],
] ]
end end
@@ -150,7 +150,7 @@ RSpec.describe DNSResolver do
it "returns the nameserver names that are authoritative for the given domain" do it "returns the nameserver names that are authoritative for the given domain" do
expect(resolver.effective_ns("postalserver.io").sort).to eq [ expect(resolver.effective_ns("postalserver.io").sort).to eq [
"prestigious-honeybadger.katapultdns.com", "prestigious-honeybadger.katapultdns.com",
"the-cake-is-a-lie.katapultdns.com" "the-cake-is-a-lie.katapultdns.com",
] ]
end end
@@ -163,7 +163,7 @@ RSpec.describe DNSResolver do
it "returns a list of NS records" do it "returns a list of NS records" do
expect(resolver.effective_ns("postalserver.io", raise_timeout_errors: true).sort).to eq [ expect(resolver.effective_ns("postalserver.io", raise_timeout_errors: true).sort).to eq [
"prestigious-honeybadger.katapultdns.com", "prestigious-honeybadger.katapultdns.com",
"the-cake-is-a-lie.katapultdns.com" "the-cake-is-a-lie.katapultdns.com",
] ]
end end

عرض الملف

@@ -73,7 +73,7 @@ module Postal
it "returns a value for postal.smtp_relays" do it "returns a value for postal.smtp_relays" do
expect(config.postal.smtp_relays).to eq [ expect(config.postal.smtp_relays).to eq [
{ "host" => "1.2.3.4", "port" => 25, "ssl_mode" => "Auto" }, { "host" => "1.2.3.4", "port" => 25, "ssl_mode" => "Auto" },
{ "host" => "2.2.2.2", "port" => 2525, "ssl_mode" => "None" } { "host" => "2.2.2.2", "port" => 2525, "ssl_mode" => "None" },
] ]
end end
end end

عرض الملف

@@ -29,7 +29,7 @@ module SMTPClient
have_attributes(ip_address: "2a00::67a0:a::1234"), have_attributes(ip_address: "2a00::67a0:a::1234"),
have_attributes(ip_address: "2a00::67a0:a::2345"), have_attributes(ip_address: "2a00::67a0:a::2345"),
have_attributes(ip_address: "1.2.3.4"), have_attributes(ip_address: "1.2.3.4"),
have_attributes(ip_address: "2.3.4.5") have_attributes(ip_address: "2.3.4.5"),
] ]
end end
end end
@@ -43,7 +43,7 @@ module SMTPClient
it "returns ipv4 endpoints" do it "returns ipv4 endpoints" do
expect(server.endpoints).to match [ expect(server.endpoints).to match [
have_attributes(ip_address: "1.2.3.4"), have_attributes(ip_address: "1.2.3.4"),
have_attributes(ip_address: "2.3.4.5") have_attributes(ip_address: "2.3.4.5"),
] ]
end end
end end
@@ -57,7 +57,7 @@ module SMTPClient
it "returns ipv6 endpoints" do it "returns ipv6 endpoints" do
expect(server.endpoints).to match [ expect(server.endpoints).to match [
have_attributes(ip_address: "2a00::67a0:a::1234"), have_attributes(ip_address: "2a00::67a0:a::1234"),
have_attributes(ip_address: "2a00::67a0:a::2345") have_attributes(ip_address: "2a00::67a0:a::2345"),
] ]
end end
end end

عرض الملف

@@ -19,7 +19,7 @@ module SMTPServer
describe "EHLO" do describe "EHLO" do
it "returns the capabilities" do it "returns the capabilities" do
expect(client.handle("EHLO test.example.com")).to eq ["250-My capabilities are", expect(client.handle("EHLO test.example.com")).to eq ["250-My capabilities are",
"250 AUTH CRAM-MD5 PLAIN LOGIN"] "250 AUTH CRAM-MD5 PLAIN LOGIN",]
end end
context "when TLS is enabled" do context "when TLS is enabled" do
@@ -27,7 +27,7 @@ module SMTPServer
allow(Postal::Config.smtp_server).to receive(:tls_enabled?).and_return(true) allow(Postal::Config.smtp_server).to receive(:tls_enabled?).and_return(true)
expect(client.handle("EHLO test.example.com")).to eq ["250-My capabilities are", expect(client.handle("EHLO test.example.com")).to eq ["250-My capabilities are",
"250-STARTTLS", "250-STARTTLS",
"250 AUTH CRAM-MD5 PLAIN LOGIN"] "250 AUTH CRAM-MD5 PLAIN LOGIN",]
end end
end end
end end

عرض الملف

@@ -209,7 +209,7 @@ describe Domain do
"postmaster@example.com", "postmaster@example.com",
"admin@example.com", "admin@example.com",
"administrator@example.com", "administrator@example.com",
"hostmaster@example.com" "hostmaster@example.com",
] ]
end end
end end

عرض الملف

@@ -180,8 +180,10 @@ RSpec.describe SMTPSender do
it "includes both endpoints in the array of endpoints tried" do it "includes both endpoints in the array of endpoints tried" do
sender.start sender.start
expect(sender.endpoints).to match([have_attributes(ip_address: "1.2.3.4"), expect(sender.endpoints).to match([
have_attributes(ip_address: "2.3.4.5")]) have_attributes(ip_address: "1.2.3.4"),
have_attributes(ip_address: "2.3.4.5"),
])
end end
end end