mirror of https://github.com/Siphonay/mastodon
Fix `Style/RedundantReturn` cop (#28391)
This commit is contained in:
parent
89d468ada7
commit
0e5b8fc46b
|
@ -426,15 +426,6 @@ Style/RedundantFetchBlock:
|
||||||
- 'config/initializers/paperclip.rb'
|
- 'config/initializers/paperclip.rb'
|
||||||
- 'config/puma.rb'
|
- 'config/puma.rb'
|
||||||
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: AllowMultipleReturnValues.
|
|
||||||
Style/RedundantReturn:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/api/v1/directories_controller.rb'
|
|
||||||
- 'app/controllers/auth/confirmations_controller.rb'
|
|
||||||
- 'app/lib/ostatus/tag_manager.rb'
|
|
||||||
- 'app/models/form/import.rb'
|
|
||||||
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
|
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
|
||||||
# AllowedMethods: present?, blank?, presence, try, try!
|
# AllowedMethods: present?, blank?, presence, try, try!
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Api::V1::DirectoriesController < Api::BaseController
|
||||||
private
|
private
|
||||||
|
|
||||||
def require_enabled!
|
def require_enabled!
|
||||||
return not_found unless Setting.profile_directory
|
not_found unless Setting.profile_directory
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_accounts
|
def set_accounts
|
||||||
|
|
|
@ -62,7 +62,7 @@ class Auth::ConfirmationsController < Devise::ConfirmationsController
|
||||||
end
|
end
|
||||||
|
|
||||||
def captcha_user_bypass?
|
def captcha_user_bypass?
|
||||||
return true if @confirmation_user.nil? || @confirmation_user.confirmed?
|
@confirmation_user.nil? || @confirmation_user.confirmed?
|
||||||
end
|
end
|
||||||
|
|
||||||
def require_unconfirmed!
|
def require_unconfirmed!
|
||||||
|
|
|
@ -52,7 +52,7 @@ class OStatus::TagManager
|
||||||
ActivityPub::TagManager.instance.uri_to_local_id(tag)
|
ActivityPub::TagManager.instance.uri_to_local_id(tag)
|
||||||
else
|
else
|
||||||
matches = Regexp.new("objectId=([\\d]+):objectType=#{expected_type}").match(tag)
|
matches = Regexp.new("objectId=([\\d]+):objectType=#{expected_type}").match(tag)
|
||||||
return matches[1] unless matches.nil?
|
matches[1] unless matches.nil?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -43,14 +43,19 @@ class Form::Import
|
||||||
validate :validate_data
|
validate :validate_data
|
||||||
|
|
||||||
def guessed_type
|
def guessed_type
|
||||||
return :muting if csv_headers_match?('Hide notifications')
|
if csv_headers_match?('Hide notifications') || file_name_matches?('mutes') || file_name_matches?('muted_accounts')
|
||||||
return :following if csv_headers_match?('Show boosts') || csv_headers_match?('Notify on new posts') || csv_headers_match?('Languages')
|
:muting
|
||||||
return :following if file_name_matches?('follows') || file_name_matches?('following_accounts')
|
elsif csv_headers_match?('Show boosts') || csv_headers_match?('Notify on new posts') || csv_headers_match?('Languages') || file_name_matches?('follows') || file_name_matches?('following_accounts')
|
||||||
return :blocking if file_name_matches?('blocks') || file_name_matches?('blocked_accounts')
|
:following
|
||||||
return :muting if file_name_matches?('mutes') || file_name_matches?('muted_accounts')
|
elsif file_name_matches?('blocks') || file_name_matches?('blocked_accounts')
|
||||||
return :domain_blocking if file_name_matches?('domain_blocks') || file_name_matches?('blocked_domains')
|
:blocking
|
||||||
return :bookmarks if file_name_matches?('bookmarks')
|
elsif file_name_matches?('domain_blocks') || file_name_matches?('blocked_domains')
|
||||||
return :lists if file_name_matches?('lists')
|
:domain_blocking
|
||||||
|
elsif file_name_matches?('bookmarks')
|
||||||
|
:bookmarks
|
||||||
|
elsif file_name_matches?('lists')
|
||||||
|
:lists
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Whether the uploaded CSV file seems to correspond to a different import type than the one selected
|
# Whether the uploaded CSV file seems to correspond to a different import type than the one selected
|
||||||
|
|
Loading…
Reference in New Issue