From 8325866c6101c7b63b616e7e0035080ef1af96a7 Mon Sep 17 00:00:00 2001 From: yhirano Date: Sun, 30 Apr 2017 07:23:45 +0900 Subject: [PATCH] Downgrade rubocop 0.48.1 => 0.46.0 (#2628) * downgrade rubocop 0.48.1 => 0.46.0 * exclude vendor/**/* from rubocop target files * add frozen_string_literal comment line * fix percent literal delimited by ( and ) * fix alignment * remove comment disabling unknown cop --- .rubocop.yml | 1 + Capfile | 1 + Gemfile | 2 +- Gemfile.lock | 6 +++--- app/controllers/authorize_follows_controller.rb | 2 +- app/controllers/well_known/host_meta_controller.rb | 2 +- app/helpers/admin/filter_helper.rb | 4 ++-- app/services/account_search_service.rb | 10 ++++++---- app/services/process_feed_service.rb | 2 +- lib/tasks/mastodon.rake | 1 - 10 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index ab28c0fe1..bc43fee81 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -88,3 +88,4 @@ AllCops: - 'Rakefile' - 'node_modules/**/*' - 'Vagrantfile' + - 'vendor/**/*' diff --git a/Capfile b/Capfile index 5bbf6933b..93d78e107 100644 --- a/Capfile +++ b/Capfile @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'capistrano/setup' require 'capistrano/deploy' require 'capistrano/scm/git' diff --git a/Gemfile b/Gemfile index 7ea358e81..fea35daf1 100644 --- a/Gemfile +++ b/Gemfile @@ -83,7 +83,7 @@ group :test do end group :development do - gem 'rubocop', require: false + gem 'rubocop', '0.46.0', require: false gem 'better_errors' gem 'binding_of_caller' gem 'letter_opener' diff --git a/Gemfile.lock b/Gemfile.lock index b519f2d62..9f9b6728c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -394,8 +394,8 @@ GEM rspec-core (~> 3.0, >= 3.0.0) sidekiq (>= 2.4.0) rspec-support (3.5.0) - rubocop (0.48.1) - parser (>= 2.3.3.1, < 3.0) + rubocop (0.46.0) + parser (>= 2.3.1.1, < 3.0) powerpack (~> 0.1) rainbow (>= 1.99.1, < 3.0) ruby-progressbar (~> 1.7) @@ -547,7 +547,7 @@ DEPENDENCIES rqrcode rspec-rails rspec-sidekiq - rubocop + rubocop (= 0.46.0) ruby-oembed sanitize sass-rails (~> 5.0) diff --git a/app/controllers/authorize_follows_controller.rb b/app/controllers/authorize_follows_controller.rb index f00646e20..b15883d58 100644 --- a/app/controllers/authorize_follows_controller.rb +++ b/app/controllers/authorize_follows_controller.rb @@ -44,7 +44,7 @@ class AuthorizeFollowsController < ApplicationController end def acct_param_is_url? - parsed_uri.path && %w[http https].include?(parsed_uri.scheme) + parsed_uri.path && %w(http https).include?(parsed_uri.scheme) end def parsed_uri diff --git a/app/controllers/well_known/host_meta_controller.rb b/app/controllers/well_known/host_meta_controller.rb index 2f0960acd..82bfd3575 100644 --- a/app/controllers/well_known/host_meta_controller.rb +++ b/app/controllers/well_known/host_meta_controller.rb @@ -1,4 +1,4 @@ - # frozen_string_literal: true +# frozen_string_literal: true module WellKnown class HostMetaController < ApplicationController diff --git a/app/helpers/admin/filter_helper.rb b/app/helpers/admin/filter_helper.rb index 5080e6350..1e4a3f0d0 100644 --- a/app/helpers/admin/filter_helper.rb +++ b/app/helpers/admin/filter_helper.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true module Admin::FilterHelper - ACCOUNT_FILTERS = %i[local remote by_domain silenced suspended recent].freeze - REPORT_FILTERS = %i[resolved account_id target_account_id].freeze + ACCOUNT_FILTERS = %i(local remote by_domain silenced suspended recent).freeze + REPORT_FILTERS = %i(resolved account_id target_account_id).freeze FILTERS = ACCOUNT_FILTERS + REPORT_FILTERS diff --git a/app/services/account_search_service.rb b/app/services/account_search_service.rb index e695d22ca..04b2ed958 100644 --- a/app/services/account_search_service.rb +++ b/app/services/account_search_service.rb @@ -63,10 +63,12 @@ class AccountSearchService < BaseService end def search_results - @_search_results ||= if account - advanced_search_results - else - simple_search_results + @_search_results ||= begin + if account + advanced_search_results + else + simple_search_results + end end end diff --git a/app/services/process_feed_service.rb b/app/services/process_feed_service.rb index 799a9f6e3..7a27b7b29 100644 --- a/app/services/process_feed_service.rb +++ b/app/services/process_feed_service.rb @@ -205,7 +205,7 @@ class ProcessFeedService < BaseService media = MediaAttachment.where(status: parent, remote_url: link['href']).first_or_initialize(account: parent.account, status: parent, remote_url: link['href']) parsed_url = Addressable::URI.parse(link['href']).normalize - next if !%w[http https].include?(parsed_url.scheme) || parsed_url.host.empty? + next if !%w(http https).include?(parsed_url.scheme) || parsed_url.host.empty? media.save diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake index 985747936..2ddf3c2f0 100644 --- a/lib/tasks/mastodon.rake +++ b/lib/tasks/mastodon.rake @@ -61,7 +61,6 @@ namespace :mastodon do desc 'Set unknown attachment type for remote-only attachments' task set_unknown: :environment do Rails.logger.debug 'Setting unknown attachment type for remote-only attachments...' - # rubocop:disable Rails/SkipsModelValidations MediaAttachment.where(file_file_name: nil).where.not(type: :unknown).in_batches.update_all(type: :unknown) Rails.logger.debug 'Done!' end