Skip to content

Commit

Permalink
Merge pull request #36472 from kamipo/empty_line_only_before_access_m…
Browse files Browse the repository at this point in the history
…odifier

Enable `Layout/EmptyLinesAroundAccessModifier` cop
  • Loading branch information
kamipo committed Jun 13, 2019
2 parents c5ecc33 + c81af6a commit 98a57aa
Show file tree
Hide file tree
Showing 434 changed files with 8 additions and 514 deletions.
4 changes: 4 additions & 0 deletions .rubocop.yml
Expand Up @@ -61,6 +61,10 @@ Layout/EndAlignment:
Layout/EmptyLineAfterMagicComment:
Enabled: true

Layout/EmptyLinesAroundAccessModifier:
Enabled: true
EnforcedStyle: only_before

Layout/EmptyLinesAroundBlockBody:
Enabled: true

Expand Down
1 change: 0 additions & 1 deletion actioncable/lib/action_cable/server/worker.rb
Expand Up @@ -66,7 +66,6 @@ def invoke(receiver, method, *args, connection:, &block)
end

private

def logger
ActionCable.server.logger
end
Expand Down
2 changes: 0 additions & 2 deletions actionmailer/lib/action_mailer/base.rb
Expand Up @@ -591,7 +591,6 @@ def deliver_mail(mail) #:nodoc:
end

private

def set_payload_for_mail(payload, mail)
payload[:mail] = mail.encoded
payload[:mailer] = name
Expand Down Expand Up @@ -873,7 +872,6 @@ def mail(headers = {}, &block)
end

private

# Used by #mail to set the content type of the message.
#
# It will use the given +user_content_type+, or multipart if the mail
Expand Down
1 change: 0 additions & 1 deletion actionmailer/lib/action_mailer/preview.rb
Expand Up @@ -55,7 +55,6 @@ def unregister_preview_interceptor(interceptor)
end

private

def interceptor_class_for(interceptor)
case interceptor
when String, Symbol
Expand Down
2 changes: 0 additions & 2 deletions actionmailer/lib/action_mailer/test_case.rb
Expand Up @@ -22,7 +22,6 @@ module ClearTestDeliveries
end

private

def clear_test_deliveries
if ActionMailer::Base.delivery_method == :test
ActionMailer::Base.deliveries.clear
Expand Down Expand Up @@ -76,7 +75,6 @@ def determine_default_mailer(name)
end

private

def initialize_test_deliveries
set_delivery_method :test
@old_perform_deliveries = ActionMailer::Base.perform_deliveries
Expand Down
1 change: 0 additions & 1 deletion actionmailer/lib/action_mailer/test_helper.rb
Expand Up @@ -152,7 +152,6 @@ def assert_no_enqueued_emails(&block)
end

private

def delivery_job_filter(job)
job_class = job.is_a?(Hash) ? job.fetch(:job) : job.class

Expand Down
1 change: 0 additions & 1 deletion actionmailer/test/base_test.rb
Expand Up @@ -939,7 +939,6 @@ def a_callback
end

private

# Execute the block setting the given values and restoring old values after
# the block is executed.
def swap(klass, new_values)
Expand Down
1 change: 0 additions & 1 deletion actionmailer/test/caching_test.rb
Expand Up @@ -189,7 +189,6 @@ def test_fragment_cache_instrumentation
end

private

def template_digest(name, format)
ActionView::Digestor.digest(name: name, format: format, finder: @mailer.lookup_context)
end
Expand Down
1 change: 0 additions & 1 deletion actionmailer/test/i18n_with_controller_test.rb
Expand Up @@ -67,7 +67,6 @@ def test_send_mail
end

private

def with_translation(locale, data)
I18n.backend.store_translations(locale, data)
yield
Expand Down
1 change: 0 additions & 1 deletion actionmailer/test/legacy_delivery_job_test.rb
Expand Up @@ -69,7 +69,6 @@ class LegacyDeliveryJob < ActionMailer::DeliveryJob
end

private

def with_delivery_job(job)
old_params_delivery_job = ParamsMailer.delivery_job
old_regular_delivery_job = DelayedMailer.delivery_job
Expand Down
1 change: 0 additions & 1 deletion actionmailer/test/mail_helper_test.rb
Expand Up @@ -68,7 +68,6 @@ def use_cache
end

private

def mail_with_defaults(&block)
mail(to: "test@localhost", from: "tester@example.com",
subject: "using helpers", &block)
Expand Down
1 change: 0 additions & 1 deletion actionmailer/test/mailers/proc_mailer.rb
Expand Up @@ -18,7 +18,6 @@ def computed_value
end

private

def give_a_greeting
"Thanks for signing up this afternoon"
end
Expand Down
1 change: 0 additions & 1 deletion actionmailer/test/parameterized_test.rb
Expand Up @@ -81,7 +81,6 @@ class DummyDeliveryJob < ActionMailer::MailDeliveryJob
end

private

def with_delivery_job(job)
old_delivery_job = ParamsMailer.delivery_job
ParamsMailer.delivery_job = job
Expand Down
1 change: 0 additions & 1 deletion actionpack/lib/abstract_controller/base.rb
Expand Up @@ -176,7 +176,6 @@ def self.supports_path?
end

private

# Returns true if the name can be considered an action because
# it has a method defined in the controller.
#
Expand Down
1 change: 0 additions & 1 deletion actionpack/lib/abstract_controller/collector.rb
Expand Up @@ -22,7 +22,6 @@ def #{sym}(*args, &block)
end

private

def method_missing(symbol, &block)
unless mime_constant = Mime[symbol]
raise NoMethodError, "To respond to a custom format, register it as a MIME type first: " \
Expand Down
1 change: 0 additions & 1 deletion actionpack/lib/action_controller/caching.rb
Expand Up @@ -30,7 +30,6 @@ module Caching
end

private

def instrument_payload(key)
{
controller: controller_name,
Expand Down
1 change: 0 additions & 1 deletion actionpack/lib/action_controller/metal.rb
Expand Up @@ -35,7 +35,6 @@ def build(action, app = nil, &block)
end

private

INCLUDE = ->(list, action) { list.include? action }
EXCLUDE = ->(list, action) { !list.include? action }
NULL = ->(list, action) { true }
Expand Down
Expand Up @@ -36,7 +36,6 @@ def content_security_policy_report_only(report_only = true, **options)
end

private

def content_security_policy?
request.content_security_policy
end
Expand Down
1 change: 0 additions & 1 deletion actionpack/lib/action_controller/metal/instrumentation.rb
Expand Up @@ -69,7 +69,6 @@ def redirect_to(*args)
end

private

# A hook invoked every time a before callback is halted.
def halted_callback_hook(filter)
ActiveSupport::Notifications.instrument("halted_callback.action_controller", filter: filter)
Expand Down
4 changes: 0 additions & 4 deletions actionpack/lib/action_controller/metal/live.rb
Expand Up @@ -107,7 +107,6 @@ def write(object, options = {})
end

private

def perform_write(json, options)
current_options = @options.merge(options).stringify_keys

Expand Down Expand Up @@ -205,7 +204,6 @@ def call_on_error
end

private

def each_chunk(&block)
loop do
str = nil
Expand All @@ -220,7 +218,6 @@ def each_chunk(&block)

class Response < ActionDispatch::Response #:nodoc: all
private

def before_committed
super
jar = request.cookie_jar
Expand Down Expand Up @@ -286,7 +283,6 @@ def response_body=(body)
end

private

# Spawn a new thread to serve up the controller in. This is to get
# around the fact that Rack isn't based around IOs and we need to use
# a thread to stream data from the response bodies. Nobody should call
Expand Down
1 change: 0 additions & 1 deletion actionpack/lib/action_controller/metal/params_wrapper.rb
Expand Up @@ -246,7 +246,6 @@ def process_action(*args)
end

private

# Returns the wrapper key which will be used to store wrapped parameters.
def _wrapper_key
_wrapper_options.name
Expand Down
1 change: 0 additions & 1 deletion actionpack/lib/action_controller/metal/rendering.rb
Expand Up @@ -53,7 +53,6 @@ def render_to_body(options = {})
end

private

def _process_variant(options)
if defined?(request) && !request.nil? && request.variant.present?
options[:variant] = request.variant
Expand Down
Expand Up @@ -151,7 +151,6 @@ def skip_forgery_protection(options = {})
end

private

def protection_method_class(name)
ActionController::RequestForgeryProtection::ProtectionMethods.const_get(name.to_s.classify)
rescue NameError
Expand All @@ -175,7 +174,6 @@ def handle_unverified_request
end

private

class NullSessionHash < Rack::Session::Abstract::SessionHash #:nodoc:
def initialize(req)
super(nil, req)
Expand Down
1 change: 0 additions & 1 deletion actionpack/lib/action_controller/metal/streaming.rb
Expand Up @@ -196,7 +196,6 @@ module Streaming
extend ActiveSupport::Concern

private

# Set proper cache control and transfer encoding when streaming
def _process_options(options)
super
Expand Down
3 changes: 0 additions & 3 deletions actionpack/lib/action_controller/test_case.rb
Expand Up @@ -158,7 +158,6 @@ def content_type
end.new

private

def params_parsers
super.merge @custom_param_parsers
end
Expand Down Expand Up @@ -208,7 +207,6 @@ def fetch(key, *args, &block)
end

private

def load!
@id
end
Expand Down Expand Up @@ -594,7 +592,6 @@ def build_response(klass)
end

private

def scrub_env!(env)
env.delete_if { |k, v| k =~ /^(action_dispatch|rack)\.request/ }
env.delete_if { |k, v| k =~ /^action_dispatch\.rescue/ }
Expand Down
1 change: 0 additions & 1 deletion actionpack/lib/action_dispatch/http/cache.rb
Expand Up @@ -123,7 +123,6 @@ def strong_etag?
end

private

DATE = "Date"
LAST_MODIFIED = "Last-Modified"
SPECIAL_KEYS = Set.new(%w[extras no-cache max-age public private must-revalidate])
Expand Down
Expand Up @@ -30,7 +30,6 @@ def call(env)
end

private

def html_response?(headers)
if content_type = headers[CONTENT_TYPE]
content_type =~ /html/
Expand Down Expand Up @@ -91,7 +90,6 @@ def content_security_policy_nonce
end

private

def generate_content_security_policy_nonce
content_security_policy_nonce_generator.call(self)
end
Expand Down
1 change: 0 additions & 1 deletion actionpack/lib/action_dispatch/http/filter_parameters.rb
Expand Up @@ -56,7 +56,6 @@ def filtered_path
end

private

def parameter_filter # :doc:
parameter_filter_for fetch_header("action_dispatch.parameter_filter") {
return NULL_PARAM_FILTER
Expand Down
1 change: 0 additions & 1 deletion actionpack/lib/action_dispatch/http/filter_redirect.rb
Expand Up @@ -14,7 +14,6 @@ def filtered_location # :nodoc:
end

private

def location_filters
if request
request.get_header("action_dispatch.redirect_filter") || []
Expand Down
1 change: 0 additions & 1 deletion actionpack/lib/action_dispatch/http/headers.rb
Expand Up @@ -116,7 +116,6 @@ def merge!(headers_or_env)
def env; @req.env.dup; end

private

# Converts an HTTP header name to an environment variable name if it is
# not contained within the headers hash.
def env_name(key)
Expand Down
1 change: 0 additions & 1 deletion actionpack/lib/action_dispatch/http/mime_negotiation.rb
Expand Up @@ -154,7 +154,6 @@ def negotiate_mime(order)
end

private

BROWSER_LIKE_ACCEPTS = /,\s*\*\/\*|\*\/\*\s*,/

def valid_accept_header # :doc:
Expand Down
2 changes: 0 additions & 2 deletions actionpack/lib/action_dispatch/http/mime_type.rb
Expand Up @@ -290,11 +290,9 @@ def html?
def all?; false; end

protected

attr_reader :string, :synonyms

private

def to_ary; end
def to_a; end

Expand Down
1 change: 0 additions & 1 deletion actionpack/lib/action_dispatch/http/parameters.rb
Expand Up @@ -85,7 +85,6 @@ def path_parameters
end

private

def set_binary_encoding(params, controller, action)
return params unless controller && controller.valid_encoding?

Expand Down
2 changes: 0 additions & 2 deletions actionpack/lib/action_dispatch/http/response.rb
Expand Up @@ -143,7 +143,6 @@ def closed?
end

private

def each_chunk(&block)
@buf.each(&block)
end
Expand Down Expand Up @@ -409,7 +408,6 @@ def cookies
end

private

ContentTypeHeader = Struct.new :mime_type, :charset
NullContentTypeHeader = ContentTypeHeader.new nil, nil

Expand Down
1 change: 0 additions & 1 deletion actionpack/lib/action_dispatch/http/url.rb
Expand Up @@ -78,7 +78,6 @@ def path_for(options)
end

private

def add_params(path, params)
params = { params: params } unless params.is_a?(Hash)
params.reject! { |_, v| v.to_param.nil? }
Expand Down
1 change: 0 additions & 1 deletion actionpack/lib/action_dispatch/journey/formatter.rb
Expand Up @@ -62,7 +62,6 @@ def clear
end

private

def extract_parameterized_parts(route, options, recall, parameterize = nil)
parameterized_parts = recall.merge(options)

Expand Down
1 change: 0 additions & 1 deletion actionpack/lib/action_dispatch/journey/gtg/builder.rb
Expand Up @@ -128,7 +128,6 @@ def followpos(node)
end

private

def followpos_table
@followpos ||= build_followpos
end
Expand Down
Expand Up @@ -141,7 +141,6 @@ def transitions
end

private

def states_hash_for(sym)
case sym
when String
Expand Down
Expand Up @@ -94,7 +94,6 @@ def transitions
end

private

def inverted
return @inverted if @inverted

Expand Down

0 comments on commit 98a57aa

Please sign in to comment.