Skip to content

A platform for community discussion. Free, open, simple.

DEPS: Bump rubocop, rubocop-rails, rubocop-capybara, and rubocop-rspec (#43305)

David Taylorba17a5916b34
diff --git a/Gemfile.lock b/Gemfile.lock
index eaa259a65d5..1cde5b40f58 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -509,7 +509,7 @@ GEM
puma (8.0.2)
nio4r (~> 2.0)
racc (1.8.1)
- rack (2.2.23)
+ rack (2.2.24)
rack-mini-profiler (4.0.1)
rack (>= 1.2.0)
rack-protection (3.2.0)
@@ -622,8 +622,8 @@ GEM
rspec-core (>= 2.14)
rtlcss (0.2.1)
mini_racer (>= 0.6.3)
- rubocop (1.86.1)
- json (~> 2.3)
+ rubocop (1.90.0)
+ json (>= 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (>= 1.10)
@@ -633,10 +633,10 @@ GEM
rubocop-ast (>= 1.49.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
- rubocop-ast (1.49.1)
+ rubocop-ast (1.50.0)
parser (>= 3.3.7.2)
prism (~> 1.7)
- rubocop-capybara (2.23.0)
+ rubocop-capybara (3.0.0)
lint_roller (~> 1.1)
rubocop (~> 1.81)
rubocop-discourse (3.18.0)
@@ -653,15 +653,16 @@ GEM
rubocop-factory_bot (2.28.0)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
- rubocop-rails (2.34.3)
+ rubocop-rails (2.37.0)
activesupport (>= 4.2.0)
lint_roller (~> 1.1)
rack (>= 1.1)
- rubocop (>= 1.75.0, < 2.0)
+ rubocop (>= 1.89.0, < 2.0)
rubocop-ast (>= 1.44.0, < 2.0)
- rubocop-rspec (3.9.0)
+ rubocop-rspec (3.10.2)
lint_roller (~> 1.1)
- rubocop (~> 1.81)
+ regexp_parser (>= 2.0)
+ rubocop (~> 1.86, >= 1.86.2)
rubocop-rspec_rails (2.32.0)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
@@ -1202,7 +1203,7 @@ CHECKSUMS
public_suffix (7.0.5) sha256=1a8bb08f1bbea19228d3bed6e5ed908d1cb4f7c2726d18bd9cadf60bc676f623
puma (8.0.2) sha256=c8ed871dfbbe66448ea9ffd46692342d9804d4071522b52b5331b7b6e7b686fb
racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
- rack (2.2.23) sha256=a8fe9d7e07064770b8ec123663fded8a59ef7e2b6db5cda7173d45a5718ab69c
+ rack (2.2.24) sha256=ef16526a0d871c43753452338c754040a664c8b41bf0dd7450b85f7772adca5f
rack-mini-profiler (4.0.1) sha256=485810c23211f908196c896ea10cad72ed68780ee2998bec1f1dfd7558263d78
rack-protection (3.2.0) sha256=3c74ba7fc59066453d61af9bcba5b6fe7a9b3dab6f445418d3b391d5ea8efbff
rack-session (1.0.2) sha256=a02115e5420b4de036839b9811e3f7967d73446a554b42aa45106af335851d76
@@ -1247,14 +1248,14 @@ CHECKSUMS
rss (0.3.3) sha256=37ef1ec4d691d67edbe92159079a4e89a0965e6a6b32246009ae3d734d12d1ab
rswag-specs (2.17.0) sha256=a3b2bdf6df89f8741fe4a4ee47ceb1e77dc13e1c96bbe07352117d6e61afa9e3
rtlcss (0.2.1) sha256=213d5a00bf61267f93a7a516d699d77e1cc5f396743abb33c01e3f3243a7bf60
- rubocop (1.86.1) sha256=44415f3f01d01a21e01132248d2fd0867572475b566ca188a0a42133a08d4531
- rubocop-ast (1.49.1) sha256=4412f3ee70f6fe4546cc489548e0f6fcf76cafcfa80fa03af67098ffed755035
- rubocop-capybara (2.23.0) sha256=f9ea1ba3a7561ee8e88cf76fc378ce517ce5327155f305ee7b5c2500e5aee357
+ rubocop (1.90.0) sha256=9eb4c065b5c5154e4ef554c547972f3905a9eb6b53e657e580b6796b54bf8242
+ rubocop-ast (1.50.0) sha256=b9ca88300da0803ee222ad20cdb30494c0a784eed06fdc35d254b06d662788db
+ rubocop-capybara (3.0.0) sha256=7a64655238acda7f8f3c87e37ac825a64c615a79c17c253f1a28270dc3768c4b
rubocop-discourse (3.18.0) sha256=bdb31f13cbb1ed82443b5a53b36efbce3b52a77b7a0f3ee7b421ce81d937ce0b
rubocop-discourse-base (1.0.0) sha256=a4121f0f2a8e32c3259fee22106af9fd35372cbeac14b0c69673bdee79b472b7
rubocop-factory_bot (2.28.0) sha256=4b17fc02124444173317e131759d195b0d762844a71a29fe8139c1105d92f0cb
- rubocop-rails (2.34.3) sha256=10d37989024865ecda8199f311f3faca990143fbac967de943f88aca11eb9ad2
- rubocop-rspec (3.9.0) sha256=8fa70a3619408237d789aeecfb9beef40576acc855173e60939d63332fdb55e2
+ rubocop-rails (2.37.0) sha256=6e1645add5060e0328f8ddda0d820f55697c591394398bf14bb9dccb62f14b7e
+ rubocop-rspec (3.10.2) sha256=0b3e2ecc592cd10ecbf0095bb58d1e357905276e069643523cc19eb7495f65e2
rubocop-rspec_rails (2.32.0) sha256=4a0d641c72f6ebb957534f539d9d0a62c47abd8ce0d0aeee1ef4701e892a9100
ruby-lsp (0.26.9) sha256=33a01c001c00a76b4e821efc04ed7572983430f31ca5d6f3e343d0b6ccab4129
ruby-lsp-rails (0.4.8) sha256=f09d1f926d4063deeb2f3049311925c20dfe6c912371e3bcd04a265a865c44ae
diff --git a/app/models/badge.rb b/app/models/badge.rb
index 8fbbed5980d..a0d5236015d 100644
--- a/app/models/badge.rb
+++ b/app/models/badge.rb
@@ -252,7 +252,7 @@ class Badge < ActiveRecord::Base
def default_icon=(val)
if image_upload_id.blank?
self.icon ||= val
- self.icon = val if self.icon == "certificate"
+ self.icon = val if icon == "certificate"
end
end
diff --git a/app/models/post.rb b/app/models/post.rb
index 66eb78aee5a..3f5888a77ae 100644
--- a/app/models/post.rb
+++ b/app/models/post.rb
@@ -1259,7 +1259,7 @@ class Post < ActiveRecord::Base
def add_to_quoted_post_numbers(num)
return if num.blank?
self.quoted_post_numbers ||= []
- self.quoted_post_numbers << num
+ quoted_post_numbers << num
end
def create_reply_relationship_with(post)
diff --git a/app/models/tag.rb b/app/models/tag.rb
index 134d5eaa495..3acbd66b0e6 100644
--- a/app/models/tag.rb
+++ b/app/models/tag.rb
@@ -321,11 +321,11 @@ class Tag < ActiveRecord::Base
self.slug ||= ""
return if name.blank?
- if self.slug.present? && will_save_change_to_slug? && slug != slugified_custom_slug
+ if slug.present? && will_save_change_to_slug? && slug != slugified_custom_slug
errors.add(:slug, :invalid)
- elsif self.slug.blank? || (will_save_change_to_name? && !will_save_change_to_slug?)
+ elsif slug.blank? || (will_save_change_to_name? && !will_save_change_to_slug?)
self.slug = Slug.for(name, "")
- self.slug = "" if self.slug.blank? || duplicate_slug?
+ self.slug = "" if slug.blank? || duplicate_slug?
end
end
diff --git a/app/models/theme_modifier_set.rb b/app/models/theme_modifier_set.rb
index ce685d132d7..8703e146696 100644
--- a/app/models/theme_modifier_set.rb
+++ b/app/models/theme_modifier_set.rb
@@ -80,13 +80,13 @@ class ThemeModifierSet < ActiveRecord::Base
def add_theme_setting_modifier(modifier_name, setting_name)
self.theme_setting_modifiers ||= {}
- self.theme_setting_modifiers[modifier_name] = setting_name
+ theme_setting_modifiers[modifier_name] = setting_name
end
def refresh_theme_setting_modifiers(target_setting_name: nil, target_setting_value: nil)
changed = false
- if self.theme_setting_modifiers.present?
- self.theme_setting_modifiers.each do |modifier_name, setting_name|
+ if theme_setting_modifiers.present?
+ theme_setting_modifiers.each do |modifier_name, setting_name|
modifier_name = modifier_name.to_sym
setting_name = setting_name.to_sym
diff --git a/lib/site_setting_extension.rb b/lib/site_setting_extension.rb
index 63c989890ac..d7c52e2775f 100644
--- a/lib/site_setting_extension.rb
+++ b/lib/site_setting_extension.rb
@@ -1282,17 +1282,15 @@ module SiteSettingExtension
# }
def fetch_setting_hash_from_provider
Hash[
- *(
- provider
- .all
- .map do |setting|
- [
- setting.name.to_sym,
- type_supervisor.to_rb_value(setting.name, setting.value, setting.data_type),
- ]
- end
- .flatten
- )
+ *provider
+ .all
+ .map do |setting|
+ [
+ setting.name.to_sym,
+ type_supervisor.to_rb_value(setting.name, setting.value, setting.data_type),
+ ]
+ end
+ .flatten
]
end
diff --git a/plugins/discourse-ai/spec/lib/completions/endpoints/vllm_spec.rb b/plugins/discourse-ai/spec/lib/completions/endpoints/vllm_spec.rb
index 948535b81b0..b0e8712913c 100644
--- a/plugins/discourse-ai/spec/lib/completions/endpoints/vllm_spec.rb
+++ b/plugins/discourse-ai/spec/lib/completions/endpoints/vllm_spec.rb
@@ -614,10 +614,10 @@ RSpec.describe DiscourseAi::Completions::Endpoints::Vllm do
it "streams Thinking partials followed by content" do
chunks = []
- chunks << "data: #{({ choices: [{ delta: { role: "assistant", reasoning: "Let me " } }] }).to_json}\n\n"
- chunks << "data: #{({ choices: [{ delta: { reasoning: "think." } }] }).to_json}\n\n"
- chunks << "data: #{({ choices: [{ delta: { content: "The answer" } }] }).to_json}\n\n"
- chunks << "data: #{({ choices: [{ delta: { content: " is 4." } }], usage: { prompt_tokens: 10, completion_tokens: 20 } }).to_json}\n\n"
+ chunks << "data: #{{ choices: [{ delta: { role: "assistant", reasoning: "Let me " } }] }.to_json}\n\n"
+ chunks << "data: #{{ choices: [{ delta: { reasoning: "think." } }] }.to_json}\n\n"
+ chunks << "data: #{{ choices: [{ delta: { content: "The answer" } }] }.to_json}\n\n"
+ chunks << "data: #{{ choices: [{ delta: { content: " is 4." } }], usage: { prompt_tokens: 10, completion_tokens: 20 } }.to_json}\n\n"
chunks << "data: [DONE]\n\n"
stub_request(:post, "https://test.dev/v1/chat/completions").to_return(
@@ -651,9 +651,9 @@ RSpec.describe DiscourseAi::Completions::Endpoints::Vllm do
it "finalizes Thinking before content when a delta carries both" do
chunks = []
- chunks << "data: #{({ choices: [{ delta: { role: "assistant", reasoning: "Let me " } }] }).to_json}\n\n"
- chunks << "data: #{({ choices: [{ delta: { content: "The answer", reasoning: "think." } }] }).to_json}\n\n"
- chunks << "data: #{({ choices: [{ delta: { content: " is 4." } }] }).to_json}\n\n"
+ chunks << "data: #{{ choices: [{ delta: { role: "assistant", reasoning: "Let me " } }] }.to_json}\n\n"
+ chunks << "data: #{{ choices: [{ delta: { content: "The answer", reasoning: "think." } }] }.to_json}\n\n"
+ chunks << "data: #{{ choices: [{ delta: { content: " is 4." } }] }.to_json}\n\n"
chunks << "data: [DONE]\n\n"
stub_request(:post, "https://test.dev/v1/chat/completions").to_return(
@@ -780,10 +780,10 @@ RSpec.describe DiscourseAi::Completions::Endpoints::Vllm do
it "streams Thinking partials followed by content" do
chunks = []
- chunks << "data: #{({ choices: [{ delta: { role: "assistant", reasoning_content: "Let me " } }] }).to_json}\n\n"
- chunks << "data: #{({ choices: [{ delta: { reasoning_content: "think." } }] }).to_json}\n\n"
- chunks << "data: #{({ choices: [{ delta: { content: "The answer" } }] }).to_json}\n\n"
- chunks << "data: #{({ choices: [{ delta: { content: " is 4." } }], usage: { prompt_tokens: 10, completion_tokens: 20 } }).to_json}\n\n"
+ chunks << "data: #{{ choices: [{ delta: { role: "assistant", reasoning_content: "Let me " } }] }.to_json}\n\n"
+ chunks << "data: #{{ choices: [{ delta: { reasoning_content: "think." } }] }.to_json}\n\n"
+ chunks << "data: #{{ choices: [{ delta: { content: "The answer" } }] }.to_json}\n\n"
+ chunks << "data: #{{ choices: [{ delta: { content: " is 4." } }], usage: { prompt_tokens: 10, completion_tokens: 20 } }.to_json}\n\n"
chunks << "data: [DONE]\n\n"
stub_request(:post, "https://test.dev/v1/chat/completions").to_return(
diff --git a/plugins/discourse-assign/app/models/assignment.rb b/plugins/discourse-assign/app/models/assignment.rb
index 1104e05da1d..e26dd4aaf31 100644
--- a/plugins/discourse-assign/app/models/assignment.rb
+++ b/plugins/discourse-assign/app/models/assignment.rb
@@ -128,7 +128,7 @@ class Assignment < ActiveRecord::Base
end
def validate_status
- if SiteSetting.enable_assign_status && !Assignment.statuses.include?(self.status)
+ if SiteSetting.enable_assign_status && !Assignment.statuses.include?(status)
errors.add(:status, :invalid)
end
end
diff --git a/script/bulk_import/base.rb b/script/bulk_import/base.rb
index 4a28e904d93..111e483d873 100644
--- a/script/bulk_import/base.rb
+++ b/script/bulk_import/base.rb
@@ -1471,7 +1471,6 @@ class BulkImport::Base
user[:approved_at] ||= user[:created_at]
user[:approved_by_id] ||= Discourse::SYSTEM_USER_ID
end
- user[:suspended_at] ||= user[:suspended_at]
user[:suspended_till] ||= user[:suspended_till] ||
(200.years.from_now if user[:suspended_at].present?)
diff --git a/script/import_scripts/smf2.rb b/script/import_scripts/smf2.rb
index 35090d7812e..7e1658ae389 100644
--- a/script/import_scripts/smf2.rb
+++ b/script/import_scripts/smf2.rb
@@ -766,7 +766,7 @@ class ImportScripts::Smf2 < ImportScripts::Base
end
end
rescue => err
- raise SettingsError, err.message unless self.database
+ raise SettingsError, err.message unless database
end
def parser
@@ -774,21 +774,15 @@ class ImportScripts::Smf2 < ImportScripts::Base
OptionParser.new(nil, 12) do |o|
o.banner = "Usage:\t#{File.basename($0)} <SMFROOT> [options]\n"
o.banner = "${o.banner}\t#{File.basename($0)} -d <DATABASE> [options]"
- o.on("-h HOST", :REQUIRED, "MySQL server hostname [\"#{self.host}\"]") do |s|
- self.host = s
- end
- o.on("-u USER", :REQUIRED, "MySQL username [\"#{self.username}\"]") do |s|
- self.username = s
- end
+ o.on("-h HOST", :REQUIRED, "MySQL server hostname [\"#{host}\"]") { |s| self.host = s }
+ o.on("-u USER", :REQUIRED, "MySQL username [\"#{username}\"]") { |s| self.username = s }
o.on(
"-p [PASS]",
:OPTIONAL,
"MySQL password. Without argument, reads password from STDIN.",
) { |s| self.password = s || :ask }
o.on("-d DBNAME", :REQUIRED, "Name of SMF database") { |s| self.database = s }
- o.on("-f PREFIX", :REQUIRED, "Table names prefix [\"#{self.prefix}\"]") do |s|
- self.prefix = s
- end
+ o.on("-f PREFIX", :REQUIRED, "Table names prefix [\"#{prefix}\"]") { |s| self.prefix = s }
o.on("-t TIMEZONE", :REQUIRED, "Timezone used by SMF2 [auto-detected from PHP]") do |s|
self.timezone = s
end
diff --git a/script/require_profiler.rb b/script/require_profiler.rb
index 328a7e1767a..603b367fb8b 100644
--- a/script/require_profiler.rb
+++ b/script/require_profiler.rb
@@ -78,8 +78,7 @@ module RequireProfiler
@stack ||= []
self.stats ||= {}
- stat =
- self.stats.fetch(path) { |key| self.stats[key] = { calls: 0, time: 0, parent_time: 0 } }
+ stat = stats.fetch(path) { |key| stats[key] = { calls: 0, time: 0, parent_time: 0 } }
@stack << stat