Skip to content

Commit

Permalink
Use frozen string literal in actionpack/
Browse files Browse the repository at this point in the history
  • Loading branch information
kirs committed Jul 29, 2017
1 parent 904f1a8 commit dfcc766
Show file tree
Hide file tree
Showing 281 changed files with 563 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,12 @@ Style/FrozenStringLiteralComment:
- 'activerecord/**/*'
- 'actionmailer/**/*'
- 'actionview/**/*'
- 'actionpack/**/*'
Exclude:
- 'actionview/test/**/*.builder'
- 'actionview/test/**/*.ruby'
- 'actionpack/test/**/*.builder'
- 'actionpack/test/**/*.ruby'

# Use `foo {}` not `foo{}`.
Layout/SpaceBeforeBlockBraces:
Expand Down
2 changes: 2 additions & 0 deletions actionpack/Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "rake/testtask"

test_files = Dir.glob("test/**/*_test.rb")
Expand Down
2 changes: 2 additions & 0 deletions actionpack/actionpack.gemspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

version = File.read(File.expand_path("../RAILS_VERSION", __dir__)).strip

Gem::Specification.new do |s|
Expand Down
1 change: 1 addition & 0 deletions actionpack/bin/test
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

COMPONENT_ROOT = File.expand_path("..", __dir__)
require_relative "../../tools/test"
2 changes: 2 additions & 0 deletions actionpack/lib/abstract_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "action_pack"
require "active_support/rails"
require "active_support/i18n"
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/abstract_controller/asset_paths.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module AbstractController
module AssetPaths #:nodoc:
extend ActiveSupport::Concern
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/abstract_controller/base.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative "error"
require "active_support/configurable"
require "active_support/descendants_tracker"
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/abstract_controller/caching.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module AbstractController
module Caching
extend ActiveSupport::Concern
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/abstract_controller/caching/fragments.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module AbstractController
module Caching
# Fragment caching is used for caching various blocks within
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/abstract_controller/callbacks.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module AbstractController
# = Abstract Controller Callbacks
#
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/abstract_controller/collector.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "action_dispatch/http/mime_type"

module AbstractController
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/abstract_controller/error.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module AbstractController
class Error < StandardError #:nodoc:
end
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/abstract_controller/helpers.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "active_support/dependencies"

module AbstractController
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/abstract_controller/logger.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "active_support/benchmarkable"

module AbstractController
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/abstract_controller/railties/routes_helpers.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module AbstractController
module Railties
module RoutesHelpers
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/abstract_controller/rendering.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative "error"
require "action_view"
require "action_view/view_paths"
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/abstract_controller/translation.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module AbstractController
module Translation
# Delegates to <tt>I18n.translate</tt>. Also aliased as <tt>t</tt>.
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/abstract_controller/url_for.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module AbstractController
# Includes +url_for+ into the host class (e.g. an abstract controller or mailer). The class
# has to provide a +RouteSet+ by implementing the <tt>_routes</tt> methods. Otherwise, an
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "active_support/rails"
require "abstract_controller"
require "action_dispatch"
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/api.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "action_view"
require "action_controller"
require_relative "log_subscriber"
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/api/api_rendering.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ActionController
module ApiRendering
extend ActiveSupport::Concern
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/base.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "action_view"
require_relative "log_subscriber"
require_relative "metal/params_wrapper"
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/caching.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ActionController
# \Caching is a cheap way of speeding up slow applications by keeping the result of
# calculations, renderings, and database calls around for subsequent requests.
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/form_builder.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ActionController
# Override the default form builder for all views rendered by this
# controller and any of its descendants. Accepts a subclass of
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/log_subscriber.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ActionController
class LogSubscriber < ActiveSupport::LogSubscriber
INTERNAL_PARAMS = %w(controller action format _method only_path)
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "active_support/core_ext/array/extract_options"
require "action_dispatch/middleware/stack"
require "action_dispatch/http/request"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ActionController
module BasicImplicitRender # :nodoc:
def send_action(method, *args)
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal/conditional_get.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "active_support/core_ext/hash/keys"

module ActionController
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal/cookies.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ActionController #:nodoc:
module Cookies
extend ActiveSupport::Concern
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal/data_streaming.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative "exceptions"

module ActionController #:nodoc:
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal/etag_with_flash.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ActionController
# When you're using the flash, it's generally used as a conditional on the view.
# This means the content of the view depends on the flash. Which in turn means
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ActionController
# When our views change, they should bubble up into HTTP cache freshness
# and bust browser caches. So the template digest for the current action
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal/exceptions.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ActionController
class ActionControllerError < StandardError #:nodoc:
end
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal/flash.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ActionController #:nodoc:
module Flash
extend ActiveSupport::Concern
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal/force_ssl.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "active_support/core_ext/hash/except"
require "active_support/core_ext/hash/slice"

Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal/head.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ActionController
module Head
# Returns a response that has no content (merely headers). The options
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal/helpers.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ActionController
# The \Rails framework provides a large number of helpers for working with assets, dates, forms,
# numbers and model objects, to name a few. These helpers are available to all templates
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal/implicit_render.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ActionController
# Handles implicit rendering for a controller action that does not
# explicitly respond with +render+, +respond_to+, +redirect+, or +head+.
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal/instrumentation.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "benchmark"
require "abstract_controller/logger"

Expand Down
4 changes: 3 additions & 1 deletion actionpack/lib/action_controller/metal/live.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "action_dispatch/http/response"
require "delegate"
require "active_support/json"
Expand Down Expand Up @@ -295,7 +297,7 @@ def log_error(exception)
return unless logger

logger.fatal do
message = "\n#{exception.class} (#{exception.message}):\n"
message = "\n#{exception.class} (#{exception.message}):\n".dup
message << exception.annoted_source_code.to_s if exception.respond_to?(:annoted_source_code)
message << " " << exception.backtrace.join("\n ")
"#{message}\n\n"
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal/mime_responds.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "abstract_controller/collector"

module ActionController #:nodoc:
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal/parameter_encoding.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ActionController
# Specify binary encoding for parameters for a given action.
module ParameterEncoding
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal/params_wrapper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "active_support/core_ext/hash/slice"
require "active_support/core_ext/hash/except"
require "active_support/core_ext/module/anonymous"
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal/redirecting.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ActionController
module Redirecting
extend ActiveSupport::Concern
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal/renderers.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "set"

module ActionController
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal/rendering.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "active_support/core_ext/string/filters"

module ActionController
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "rack/session/abstract/id"
require_relative "exceptions"
require "active_support/security_utils"
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal/rescue.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ActionController #:nodoc:
# This module is responsible for providing `rescue_from` helpers
# to controllers and configuring when detailed exceptions must be
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal/streaming.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "rack/chunked"

module ActionController #:nodoc:
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal/strong_parameters.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "active_support/core_ext/hash/indifferent_access"
require "active_support/core_ext/hash/transform_values"
require "active_support/core_ext/array/wrap"
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal/testing.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ActionController
module Testing
extend ActiveSupport::Concern
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/metal/url_for.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ActionController
# Includes +url_for+ into the host class. The class has to provide a +RouteSet+ by implementing
# the <tt>_routes</tt> method. Otherwise, an exception will be raised.
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/railtie.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "rails"
require "action_controller"
require "action_dispatch/railtie"
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/railties/helpers.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ActionController
module Railties
module Helpers
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/renderer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "active_support/core_ext/hash/keys"

module ActionController
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/template_assertions.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ActionController
module TemplateAssertions
def assert_template(options = {}, message = nil)
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/test_case.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "rack/session/abstract/id"
require "active_support/core_ext/hash/conversions"
require "active_support/core_ext/object/to_query"
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_dispatch.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

#--
# Copyright (c) 2004-2017 David Heinemeier Hansson
#
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_dispatch/http/cache.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ActionDispatch
module Http
module Cache
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_dispatch/http/filter_parameters.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require_relative "parameter_filter"

module ActionDispatch
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_dispatch/http/filter_redirect.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ActionDispatch
module Http
module FilterRedirect
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_dispatch/http/headers.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module ActionDispatch
module Http
# Provides access to the request's HTTP headers from the environment.
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_dispatch/http/mime_negotiation.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "active_support/core_ext/module/attribute_accessors"

module ActionDispatch
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_dispatch/http/mime_type.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# -*- frozen-string-literal: true -*-

require "singleton"
Expand Down
Loading

0 comments on commit dfcc766

Please sign in to comment.