From 3e7a541e09ac875be21bea3cf8a444e3228d2a4c Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Mon, 31 Jul 2017 22:19:13 +0900 Subject: [PATCH] Change RuboCop rules to loose (#4464) --- .rubocop.yml | 9 +++++---- app/lib/emoji.rb | 2 +- app/services/batched_remove_status_service.rb | 2 +- app/workers/pubsubhubbub/distribution_worker.rb | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 1cbdadd49f..ae36971747 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -27,6 +27,7 @@ Metrics/AbcSize: Max: 100 Metrics/BlockLength: + Max: 35 Exclude: - 'lib/tasks/**/*' @@ -35,10 +36,10 @@ Metrics/BlockNesting: Metrics/ClassLength: CountComments: false - Max: 200 + Max: 300 Metrics/CyclomaticComplexity: - Max: 15 + Max: 25 Metrics/LineLength: AllowURI: true @@ -53,11 +54,11 @@ Metrics/ModuleLength: Max: 200 Metrics/ParameterLists: - Max: 4 + Max: 5 CountKeywordArgs: true Metrics/PerceivedComplexity: - Max: 10 + Max: 20 Rails: Enabled: true diff --git a/app/lib/emoji.rb b/app/lib/emoji.rb index 6de70e9b41..45b7f53dec 100644 --- a/app/lib/emoji.rb +++ b/app/lib/emoji.rb @@ -6,7 +6,7 @@ class Emoji include Singleton def initialize - data = Oj.load(File.open(File.join(Rails.root, 'lib', 'assets', 'emoji.json'))) + data = Oj.load(File.open(Rails.root.join('lib', 'assets', 'emoji.json'))) @map = {} diff --git a/app/services/batched_remove_status_service.rb b/app/services/batched_remove_status_service.rb index b462154ae7..ab810c628e 100644 --- a/app/services/batched_remove_status_service.rb +++ b/app/services/batched_remove_status_service.rb @@ -90,7 +90,7 @@ class BatchedRemoveStatusService < BaseService key = FeedManager.instance.key(:home, follower_id) originals = statuses.reject(&:reblog?) - reblogs = statuses.reject { |s| !s.reblog? } + reblogs = statuses.select(&:reblog?) # Quickly remove all originals redis.pipelined do diff --git a/app/workers/pubsubhubbub/distribution_worker.rb b/app/workers/pubsubhubbub/distribution_worker.rb index ce467d18b1..ea246128d2 100644 --- a/app/workers/pubsubhubbub/distribution_worker.rb +++ b/app/workers/pubsubhubbub/distribution_worker.rb @@ -14,7 +14,7 @@ class Pubsubhubbub::DistributionWorker @subscriptions = active_subscriptions.to_a distribute_public!(stream_entries.reject(&:hidden?)) - distribute_hidden!(stream_entries.reject { |s| !s.hidden? }) + distribute_hidden!(stream_entries.select(&:hidden?)) end private @@ -35,7 +35,7 @@ class Pubsubhubbub::DistributionWorker @payload = OStatus::AtomSerializer.render(OStatus::AtomSerializer.new.feed(@account, stream_entries)) @domains = @account.followers.domains - Pubsubhubbub::DeliveryWorker.push_bulk(@subscriptions.reject { |s| !allowed_to_receive?(s.callback_url, s.domain) }) do |subscription| + Pubsubhubbub::DeliveryWorker.push_bulk(@subscriptions.select { |s| allowed_to_receive?(s.callback_url, s.domain) }) do |subscription| [subscription.id, @payload] end end