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

Also fixes whitespace related issues raised by rubocop.
This commit is contained in:
Jarek Radosz 2020-10-30 15:04:29 +01:00 committed by GitHub
parent af4938baf1
commit 2f4a1ff61b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 19 additions and 20 deletions

View File

@ -340,23 +340,22 @@ GEM
json-schema (~> 2.2) json-schema (~> 2.2)
railties (>= 3.1, < 7.0) railties (>= 3.1, < 7.0)
rtlit (0.0.5) rtlit (0.0.5)
rubocop (0.93.1) rubocop (1.1.0)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 2.7.1.5) parser (>= 2.7.1.5)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8) regexp_parser (>= 1.8)
rexml rexml
rubocop-ast (>= 0.6.0) rubocop-ast (>= 1.0.1)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0) unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (1.1.0) rubocop-ast (1.1.0)
parser (>= 2.7.1.5) parser (>= 2.7.1.5)
rubocop-discourse (2.3.2) rubocop-discourse (2.4.0)
rubocop (>= 0.69.0) rubocop (>= 1.1.0)
rubocop-rspec (>= 1.39.0) rubocop-rspec (>= 2.0.0.pre)
rubocop-rspec (1.44.1) rubocop-rspec (2.0.0.pre)
rubocop (~> 0.87) rubocop (~> 1.0)
rubocop-ast (>= 0.7.1)
ruby-prof (1.4.1) ruby-prof (1.4.1)
ruby-progressbar (1.10.1) ruby-progressbar (1.10.1)
ruby-readability (0.7.0) ruby-readability (0.7.0)

View File

@ -152,7 +152,7 @@ module Reports::ModeratorsActivity
AND p.created_at <= '#{report.end_date}' AND p.created_at <= '#{report.end_date}'
GROUP BY p.user_id GROUP BY p.user_id
) )
SELECT SELECT
m.user_id, m.user_id,
m.username, m.username,

View File

@ -56,7 +56,7 @@ module Reports::TopIgnoredUsers
ORDER BY COUNT(*) DESC ORDER BY COUNT(*) DESC
LIMIT :limit LIMIT :limit
) )
SELECT u.id as user_id, SELECT u.id as user_id,
u.username as username, u.username as username,
u.uploaded_avatar_id as uploaded_avatar_id, u.uploaded_avatar_id as uploaded_avatar_id,

View File

@ -5,7 +5,7 @@ class ClearApprovedUsersFromTheReviewQueue < ActiveRecord::Migration[6.0]
UPDATE reviewables r UPDATE reviewables r
SET status = #{Reviewable.statuses[:approved]} SET status = #{Reviewable.statuses[:approved]}
FROM users u 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]} AND r.type = 'ReviewableUser' AND r.status = #{Reviewable.statuses[:pending]}
RETURNING r.id RETURNING r.id
SQL SQL

View File

@ -163,8 +163,8 @@ class CorrectSchemaDiscrepancies < ActiveRecord::Migration[6.0]
raw_info = DB.query_hash <<~SQL raw_info = DB.query_hash <<~SQL
SELECT table_name, column_name, is_nullable, character_maximum_length, column_default SELECT table_name, column_name, is_nullable, character_maximum_length, column_default
FROM information_schema.columns FROM information_schema.columns
WHERE table_schema='public' WHERE table_schema='public'
AND ( AND (
#{lookup_sql} #{lookup_sql}
) )

View File

@ -7,7 +7,7 @@ class FixTopicUsersBookmarkedColumnThatShouldBeFalse < ActiveRecord::Migration[6
UPDATE topic_users SET bookmarked = FALSE WHERE ID IN ( UPDATE topic_users SET bookmarked = FALSE WHERE ID IN (
SELECT DISTINCT topic_users.id FROM topic_users 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 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)) WHERE topic_users.bookmarked = true AND (bookmarks.id IS NULL AND post_actions.id IS NULL))
SQL SQL
DB.exec(sql) DB.exec(sql)

View File

@ -18,7 +18,7 @@ class SyncTopicUserBookmarkedColumnWithBookmarks < ActiveRecord::Migration[6.0]
UPDATE topic_users SET bookmarked = FALSE WHERE ID IN ( UPDATE topic_users SET bookmarked = FALSE WHERE ID IN (
SELECT DISTINCT topic_users.id FROM topic_users 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 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)) WHERE topic_users.bookmarked = true AND (bookmarks.id IS NULL AND post_actions.id IS NULL))
SQL SQL
DB.exec(should_not_be_bookmarked_sql) DB.exec(should_not_be_bookmarked_sql)

View File

@ -9,10 +9,10 @@ class CorrectPostsSchema < ActiveRecord::Migration[6.0]
# This should be done in a transaction # This should be done in a transaction
def up def up
result = DB.query <<~SQL result = DB.query <<~SQL
SELECT character_maximum_length SELECT character_maximum_length
FROM information_schema.columns FROM information_schema.columns
WHERE table_schema='public' WHERE table_schema='public'
AND table_name = 'posts' AND table_name = 'posts'
AND column_name IN ('action_code', 'edit_reason') AND column_name IN ('action_code', 'edit_reason')
SQL SQL

View File

@ -54,7 +54,7 @@ class TwitterApi
<div class='tweet-images'> <div class='tweet-images'>
<div class='aspect-image-full-size' style='--aspect-ratio:#{width}/#{height};'> <div class='aspect-image-full-size' style='--aspect-ratio:#{width}/#{height};'>
<video class='tweet-video' #{attributes} <video class='tweet-video' #{attributes}
width='#{width}' width='#{width}'
height='#{height}' height='#{height}'
poster='#{m['media_url_https']}'> poster='#{m['media_url_https']}'>
<source src='#{url}' type="video/mp4"> <source src='#{url}' type="video/mp4">

View File

@ -398,7 +398,7 @@ class ImportScripts::JForum < ImportScripts::Base
FROM jforum_karma k 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}) 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_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 ORDER BY k.post_id, k.from_user_id
LIMIT #{BATCH_SIZE} LIMIT #{BATCH_SIZE}
SQL SQL