From 0b59877f5cc1349b8feba45d1a4d5282ebc4bb55 Mon Sep 17 00:00:00 2001 From: Marwin Hochfelsner <50826859+hlfan@users.noreply.github.com> Date: Thu, 29 Jan 2026 00:15:10 +0000 Subject: [PATCH] Fix new rubocop warnings --- app/helpers/heatmap_helper.rb | 2 +- db/migrate/006_tile_nodes.rb | 20 +++++++++---------- ...250212160355_backfill_note_descriptions.rb | 2 +- lib/rich_text.rb | 2 +- lib/tasks/backfill_changeset_stats.rake | 2 +- .../api/messages/inboxes_controller_test.rb | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/helpers/heatmap_helper.rb b/app/helpers/heatmap_helper.rb index f7cefcca1..65c1bbbb1 100644 --- a/app/helpers/heatmap_helper.rb +++ b/app/helpers/heatmap_helper.rb @@ -16,7 +16,7 @@ module HeatmapHelper .map do |month| month_offset += 12 if month == 1 month + month_offset - end + end { :days => all_days, diff --git a/db/migrate/006_tile_nodes.rb b/db/migrate/006_tile_nodes.rb index 572cc4a62..d808dadb8 100644 --- a/db/migrate/006_tile_nodes.rb +++ b/db/migrate/006_tile_nodes.rb @@ -10,22 +10,22 @@ class TileNodes < ActiveRecord::Migration[4.2] end def self.upgrade_table(from_table, to_table, model) - execute <<-SQL.squish - INSERT INTO #{to_table} (id, latitude, longitude, user_id, visible, tags, timestamp, tile) - SELECT id, ROUND(latitude * 10000000), ROUND(longitude * 10000000), - user_id, visible, tags, timestamp, 0 - FROM #{from_table} + execute <<~SQL.squish + INSERT INTO #{to_table} (id, latitude, longitude, user_id, visible, tags, timestamp, tile) + SELECT id, ROUND(latitude * 10000000), ROUND(longitude * 10000000), + user_id, visible, tags, timestamp, 0 + FROM #{from_table} SQL model.all.each(&:save!) end def self.downgrade_table(from_table, to_table) - execute <<-SQL.squish - INSERT INTO #{to_table} (id, latitude, longitude, user_id, visible, tags, timestamp) - SELECT id, latitude / 10000000, longitude / 10000000, - user_id, visible, tags, timestamp - FROM #{from_table} + execute <<~SQL.squish + INSERT INTO #{to_table} (id, latitude, longitude, user_id, visible, tags, timestamp) + SELECT id, latitude / 10000000, longitude / 10000000, + user_id, visible, tags, timestamp + FROM #{from_table} SQL end diff --git a/db/migrate/20250212160355_backfill_note_descriptions.rb b/db/migrate/20250212160355_backfill_note_descriptions.rb index 87086f950..741210d98 100644 --- a/db/migrate/20250212160355_backfill_note_descriptions.rb +++ b/db/migrate/20250212160355_backfill_note_descriptions.rb @@ -10,7 +10,7 @@ class BackfillNoteDescriptions < ActiveRecord::Migration[7.2] Note.in_batches(:of => 1000) do |notes| note_ids = notes.pluck(:id) - sql_query = <<-SQL.squish + sql_query = <<~SQL.squish WITH first_comment AS( SELECT DISTINCT ON (note_id) * FROM note_comments diff --git a/lib/rich_text.rb b/lib/rich_text.rb index 76ba29254..87b44be20 100644 --- a/lib/rich_text.rb +++ b/lib/rich_text.rb @@ -129,7 +129,7 @@ module RichText shorten_host(normalised_url, rule.hosts, rule.host_replacement) do |path| path.sub(Regexp.new(rule.optional_path_prefix || ""), "") end - end + end Array.wrap(Settings.linkify&.display_rules) .select { |rule| rule.pattern && rule.replacement } .reduce(url) { |url, rule| url.sub(Regexp.new(rule.pattern), rule.replacement) } diff --git a/lib/tasks/backfill_changeset_stats.rake b/lib/tasks/backfill_changeset_stats.rake index e3e54a1ad..36d6d507a 100644 --- a/lib/tasks/backfill_changeset_stats.rake +++ b/lib/tasks/backfill_changeset_stats.rake @@ -114,7 +114,7 @@ namespace :db do ] rows_affected = ActiveRecord::Base.connection.exec_update(sql, "UpdateStats", binds) puts " #{rows_affected} changesets updated." - end + end puts "\nDone." end diff --git a/test/controllers/api/messages/inboxes_controller_test.rb b/test/controllers/api/messages/inboxes_controller_test.rb index 5c2f04a02..28b50727b 100644 --- a/test/controllers/api/messages/inboxes_controller_test.rb +++ b/test/controllers/api/messages/inboxes_controller_test.rb @@ -115,7 +115,7 @@ module Api assert_operator(jsm[i]["id"], :<, jsm[i + 1]["id"]) unless i == jsm.count - 1 msgs_read[jsm[i]["id"]] = jsm[i] end - params[:from_id] = jsm[jsm.count - 1]["id"] + params[:from_id] = jsm[-1]["id"] end assert_equal 100, msgs_read.count end @@ -153,7 +153,7 @@ module Api assert_operator(jsm[i]["id"], :>, jsm[i + 1]["id"]) unless i == jsm.count - 1 msgs_read[jsm[i]["id"]] = jsm[i] end - params[:from_id] = jsm[jsm.count - 1]["id"] + params[:from_id] = jsm[-1]["id"] end assert_equal 100, msgs_read.count assert_not_equal(-1, real_max_id) -- 2.39.5