Skip to content

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

DEV: Update rubocop-discourse from 2.3.2 to 2.4.0 (#11079)

Jarek Radosz2f4a1ff61b40
diff --git a/Gemfile.lock b/Gemfile.lock
index 1e557f2f823..8e02d7ca6f1 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -340,23 +340,22 @@ GEM
json-schema (~> 2.2)
railties (>= 3.1, < 7.0)
rtlit (0.0.5)
- rubocop (0.93.1)
+ rubocop (1.1.0)
parallel (~> 1.10)
parser (>= 2.7.1.5)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8)
rexml
- rubocop-ast (>= 0.6.0)
+ rubocop-ast (>= 1.0.1)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (1.1.0)
parser (>= 2.7.1.5)
- rubocop-discourse (2.3.2)
- rubocop (>= 0.69.0)
- rubocop-rspec (>= 1.39.0)
- rubocop-rspec (1.44.1)
- rubocop (~> 0.87)
- rubocop-ast (>= 0.7.1)
+ rubocop-discourse (2.4.0)
+ rubocop (>= 1.1.0)
+ rubocop-rspec (>= 2.0.0.pre)
+ rubocop-rspec (2.0.0.pre)
+ rubocop (~> 1.0)
ruby-prof (1.4.1)
ruby-progressbar (1.10.1)
ruby-readability (0.7.0)
diff --git a/app/models/concerns/reports/moderators_activity.rb b/app/models/concerns/reports/moderators_activity.rb
index fc3f77cc712..135e4f09460 100644
--- a/app/models/concerns/reports/moderators_activity.rb
+++ b/app/models/concerns/reports/moderators_activity.rb
@@ -152,7 +152,7 @@ module Reports::ModeratorsActivity
AND p.created_at <= '#{report.end_date}'
GROUP BY p.user_id
)
-
+
SELECT
m.user_id,
m.username,
diff --git a/app/models/concerns/reports/top_ignored_users.rb b/app/models/concerns/reports/top_ignored_users.rb
index ce1f08e0c7a..3b02f081956 100644
--- a/app/models/concerns/reports/top_ignored_users.rb
+++ b/app/models/concerns/reports/top_ignored_users.rb
@@ -56,7 +56,7 @@ module Reports::TopIgnoredUsers
ORDER BY COUNT(*) DESC
LIMIT :limit
)
-
+
SELECT u.id as user_id,
u.username as username,
u.uploaded_avatar_id as uploaded_avatar_id,
diff --git a/db/migrate/20200311135425_clear_approved_users_from_the_review_queue.rb b/db/migrate/20200311135425_clear_approved_users_from_the_review_queue.rb
index d26e4acb4cc..349fea7c7b7 100644
--- a/db/migrate/20200311135425_clear_approved_users_from_the_review_queue.rb
+++ b/db/migrate/20200311135425_clear_approved_users_from_the_review_queue.rb
@@ -5,7 +5,7 @@ class ClearApprovedUsersFromTheReviewQueue < ActiveRecord::Migration[6.0]
UPDATE reviewables r
SET status = #{Reviewable.statuses[:approved]}
FROM users u
- WHERE u.id = r.target_id AND u.approved = true
+ WHERE u.id = r.target_id AND u.approved = true
AND r.type = 'ReviewableUser' AND r.status = #{Reviewable.statuses[:pending]}
RETURNING r.id
SQL
diff --git a/db/migrate/20200601130900_correct_schema_discrepancies.rb b/db/migrate/20200601130900_correct_schema_discrepancies.rb
index ad18fed7c99..4d76e953525 100644
--- a/db/migrate/20200601130900_correct_schema_discrepancies.rb
+++ b/db/migrate/20200601130900_correct_schema_discrepancies.rb
@@ -163,8 +163,8 @@ class CorrectSchemaDiscrepancies < ActiveRecord::Migration[6.0]
raw_info = DB.query_hash <<~SQL
SELECT table_name, column_name, is_nullable, character_maximum_length, column_default
- FROM information_schema.columns
- WHERE table_schema='public'
+ FROM information_schema.columns
+ WHERE table_schema='public'
AND (
#{lookup_sql}
)
diff --git a/db/migrate/20200710013237_fix_topic_users_bookmarked_column_that_should_be_false.rb b/db/migrate/20200710013237_fix_topic_users_bookmarked_column_that_should_be_false.rb
index e84cdc5e049..a5fa7aed728 100644
--- a/db/migrate/20200710013237_fix_topic_users_bookmarked_column_that_should_be_false.rb
+++ b/db/migrate/20200710013237_fix_topic_users_bookmarked_column_that_should_be_false.rb
@@ -7,7 +7,7 @@ class FixTopicUsersBookmarkedColumnThatShouldBeFalse < ActiveRecord::Migration[6
UPDATE topic_users SET bookmarked = FALSE WHERE ID IN (
SELECT DISTINCT topic_users.id FROM topic_users
LEFT JOIN bookmarks ON bookmarks.topic_id = topic_users.topic_id AND bookmarks.user_id = topic_users.user_id
- LEFT JOIN post_actions ON post_actions.user_id = topic_users.user_id AND post_actions.post_action_type_id = 1 AND post_actions.post_id IN (SELECT id FROM posts WHERE posts.topic_id = topic_users.topic_id)
+ LEFT JOIN post_actions ON post_actions.user_id = topic_users.user_id AND post_actions.post_action_type_id = 1 AND post_actions.post_id IN (SELECT id FROM posts WHERE posts.topic_id = topic_users.topic_id)
WHERE topic_users.bookmarked = true AND (bookmarks.id IS NULL AND post_actions.id IS NULL))
SQL
DB.exec(sql)
diff --git a/db/migrate/20200728022830_sync_topic_user_bookmarked_column_with_bookmarks.rb b/db/migrate/20200728022830_sync_topic_user_bookmarked_column_with_bookmarks.rb
index 76dfde6c5cd..35926168127 100644
--- a/db/migrate/20200728022830_sync_topic_user_bookmarked_column_with_bookmarks.rb
+++ b/db/migrate/20200728022830_sync_topic_user_bookmarked_column_with_bookmarks.rb
@@ -18,7 +18,7 @@ class SyncTopicUserBookmarkedColumnWithBookmarks < ActiveRecord::Migration[6.0]
UPDATE topic_users SET bookmarked = FALSE WHERE ID IN (
SELECT DISTINCT topic_users.id FROM topic_users
LEFT JOIN bookmarks ON bookmarks.topic_id = topic_users.topic_id AND bookmarks.user_id = topic_users.user_id
- LEFT JOIN post_actions ON post_actions.user_id = topic_users.user_id AND post_actions.post_action_type_id = 1 AND post_actions.post_id IN (SELECT id FROM posts WHERE posts.topic_id = topic_users.topic_id)
+ LEFT JOIN post_actions ON post_actions.user_id = topic_users.user_id AND post_actions.post_action_type_id = 1 AND post_actions.post_id IN (SELECT id FROM posts WHERE posts.topic_id = topic_users.topic_id)
WHERE topic_users.bookmarked = true AND (bookmarks.id IS NULL AND post_actions.id IS NULL))
SQL
DB.exec(should_not_be_bookmarked_sql)
diff --git a/db/post_migrate/20200610150900_correct_posts_schema.rb b/db/post_migrate/20200610150900_correct_posts_schema.rb
index c2fc2ba5d65..fe6acb9cec0 100644
--- a/db/post_migrate/20200610150900_correct_posts_schema.rb
+++ b/db/post_migrate/20200610150900_correct_posts_schema.rb
@@ -9,10 +9,10 @@ class CorrectPostsSchema < ActiveRecord::Migration[6.0]
# This should be done in a transaction
def up
result = DB.query <<~SQL
- SELECT character_maximum_length
- FROM information_schema.columns
+ SELECT character_maximum_length
+ FROM information_schema.columns
WHERE table_schema='public'
- AND table_name = 'posts'
+ AND table_name = 'posts'
AND column_name IN ('action_code', 'edit_reason')
SQL
diff --git a/lib/twitter_api.rb b/lib/twitter_api.rb
index 7fe8ae6f41a..5664bb2a263 100644
--- a/lib/twitter_api.rb
+++ b/lib/twitter_api.rb
@@ -54,7 +54,7 @@ class TwitterApi
<div class='tweet-images'>
<div class='aspect-image-full-size' style='--aspect-ratio:#{width}/#{height};'>
<video class='tweet-video' #{attributes}
- width='#{width}'
+ width='#{width}'
height='#{height}'
poster='#{m['media_url_https']}'>
<source src='#{url}' type="video/mp4">
diff --git a/script/import_scripts/jforum.rb b/script/import_scripts/jforum.rb
index 1f52412c593..e5d56718b62 100644
--- a/script/import_scripts/jforum.rb
+++ b/script/import_scripts/jforum.rb
@@ -398,7 +398,7 @@ class ImportScripts::JForum < ImportScripts::Base
FROM jforum_karma k
WHERE k.points >= 2 AND ((k.post_id = #{last_post_id} AND k.from_user_id > #{last_user_id}) OR k.post_id > #{last_post_id})
AND EXISTS (SELECT 1 FROM jforum_posts p WHERE k.post_id = p.post_id)
- AND EXISTS (SELECT 1 FROM jforum_users u WHERE k.from_user_id = u.user_id)
+ AND EXISTS (SELECT 1 FROM jforum_users u WHERE k.from_user_id = u.user_id)
ORDER BY k.post_id, k.from_user_id
LIMIT #{BATCH_SIZE}
SQL