From e595d91ac2c07371b441f8b04781e7c03ac44135 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Tue, 28 Oct 2014 17:33:36 -0700 Subject: edit pass over all warnings This patch uniformizes warning messages. I used the most common style already present in the code base: * Capitalize the first word. * End the message with a full stop. * "Rails 5" instead of "Rails 5.0". * Backticks for method names and inline code. Also, converted a few long strings into the new heredoc convention. --- actionmailer/lib/action_mailer/message_delivery.rb | 8 ++++---- actionpack/lib/action_dispatch/http/parameters.rb | 2 +- actionpack/lib/action_dispatch/http/request.rb | 2 +- actionpack/lib/action_dispatch/http/response.rb | 6 +++--- actionpack/lib/action_dispatch/routing/mapper.rb | 13 +++++++++++-- actionpack/lib/action_dispatch/routing/route_set.rb | 5 ++++- actionpack/lib/action_dispatch/testing/assertions/tag.rb | 2 +- actionview/lib/action_view/view_paths.rb | 6 +++++- activemodel/lib/active_model/dirty.rb | 12 ++++++++++-- .../associations/has_many_through_association.rb | 6 +++--- activerecord/lib/active_record/attribute_methods.rb | 4 ++-- .../connection_adapters/abstract/connection_pool.rb | 2 +- .../connection_adapters/abstract/schema_definitions.rb | 7 +++---- .../connection_adapters/connection_specification.rb | 2 +- activerecord/lib/active_record/inheritance.rb | 4 ++-- activerecord/lib/active_record/type/boolean.rb | 10 +++++++--- .../lib/active_support/core_ext/kernel/reporting.rb | 6 +++--- activesupport/lib/active_support/json/encoding.rb | 2 +- activesupport/lib/active_support/test_case.rb | 2 +- railties/lib/rails/rack/log_tailer.rb | 2 +- 20 files changed, 65 insertions(+), 38 deletions(-) diff --git a/actionmailer/lib/action_mailer/message_delivery.rb b/actionmailer/lib/action_mailer/message_delivery.rb index e058b3b15d..b5dc2d7497 100644 --- a/actionmailer/lib/action_mailer/message_delivery.rb +++ b/actionmailer/lib/action_mailer/message_delivery.rb @@ -87,8 +87,8 @@ module ActionMailer def deliver! #:nodoc: ActiveSupport::Deprecation.warn(<<-MSG.squish) - #deliver! is deprecated and will be removed in Rails 5. Use - #deliver_now! to deliver immediately or #deliver_later! to + `#deliver!` is deprecated and will be removed in Rails 5. Use + `#deliver_now!` to deliver immediately or `#deliver_later!` to deliver through Active Job. MSG @@ -97,8 +97,8 @@ module ActionMailer def deliver #:nodoc: ActiveSupport::Deprecation.warn(<<-MSG.squish) - #deliver is deprecated and will be removed in Rails 5. Use - #deliver_now to deliver immediately or #deliver_later to + `#deliver` is deprecated and will be removed in Rails 5. Use + `#deliver_now` to deliver immediately or `#deliver_later` to deliver through Active Job. MSG diff --git a/actionpack/lib/action_dispatch/http/parameters.rb b/actionpack/lib/action_dispatch/http/parameters.rb index 20ae48d458..a5cd26a3c1 100644 --- a/actionpack/lib/action_dispatch/http/parameters.rb +++ b/actionpack/lib/action_dispatch/http/parameters.rb @@ -27,7 +27,7 @@ module ActionDispatch def symbolized_path_parameters ActiveSupport::Deprecation.warn( - "`symbolized_path_parameters` is deprecated. Please use `path_parameters`" + '`symbolized_path_parameters` is deprecated. Please use `path_parameters`.' ) path_parameters end diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index a8785ee6bf..2a7bb374a5 100644 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -328,7 +328,7 @@ module ActionDispatch # Extracted into ActionDispatch::Request::Utils.deep_munge, but kept here for backwards compatibility. def deep_munge(hash) ActiveSupport::Deprecation.warn( - "This method has been extracted into ActionDispatch::Request::Utils.deep_munge. Please start using that instead." + 'This method has been extracted into `ActionDispatch::Request::Utils.deep_munge`. Please start using that instead.' ) Utils.deep_munge(hash) diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index 2918a98796..33de2f8b5f 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -290,9 +290,9 @@ module ActionDispatch # :nodoc: # Not sensible behavior. def to_ary ActiveSupport::Deprecation.warn(<<-MSG.squish) - 'ActionDispatch::Response#to_ary no longer performs implicit conversion - to an Array. Please use response.to_a instead, or a splat like `status, - headers, body = *response` + `ActionDispatch::Response#to_ary` no longer performs implicit conversion + to an array. Please use `response.to_a` instead, or a splat like `status, + headers, body = *response`. MSG to_a diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index a121fef663..ac03ecb2c8 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -4,6 +4,7 @@ require 'active_support/core_ext/hash/slice' require 'active_support/core_ext/enumerable' require 'active_support/core_ext/array/extract_options' require 'active_support/core_ext/module/remove_method' +require 'active_support/core_ext/string/filters' require 'active_support/inflector' require 'action_dispatch/routing/redirection' require 'action_dispatch/routing/endpoint' @@ -282,11 +283,19 @@ module ActionDispatch def split_to(to) case to when Symbol - ActiveSupport::Deprecation.warn "defining a route where `to` is a symbol is deprecated. Please change \"to: :#{to}\" to \"action: :#{to}\"" + ActiveSupport::Deprecation.warn(<<-MSG.squish) + Defining a route where `to` is a symbol is deprecated. + Please change `to: :#{to}` to `action: :#{to}`. + MSG + [nil, to.to_s] when /#/ then to.split('#') when String - ActiveSupport::Deprecation.warn "defining a route where `to` is a controller without an action is deprecated. Please change \"to: :#{to}\" to \"controller: :#{to}\"" + ActiveSupport::Deprecation.warn(<<-MSG.squish) + Defining a route where `to` is a controller without an action is deprecated. + Please change `to: :#{to}` to `controller: :#{to}`. + MSG + [to, nil] else [] diff --git a/actionpack/lib/action_dispatch/routing/route_set.rb b/actionpack/lib/action_dispatch/routing/route_set.rb index 746742a85f..a641ea3ea9 100644 --- a/actionpack/lib/action_dispatch/routing/route_set.rb +++ b/actionpack/lib/action_dispatch/routing/route_set.rb @@ -103,7 +103,10 @@ module ActionDispatch end def helpers - ActiveSupport::Deprecation.warn("`named_routes.helpers` is deprecated, please use `route_defined?(route_name)` to see if a named route was defined.") + ActiveSupport::Deprecation.warn(<<-MSG.squish) + `named_routes.helpers` is deprecated, please use `route_defined?(route_name)` + to see if a named route was defined. + MSG @path_helpers + @url_helpers end diff --git a/actionpack/lib/action_dispatch/testing/assertions/tag.rb b/actionpack/lib/action_dispatch/testing/assertions/tag.rb index 5c2905d1ac..da98b1d6ce 100644 --- a/actionpack/lib/action_dispatch/testing/assertions/tag.rb +++ b/actionpack/lib/action_dispatch/testing/assertions/tag.rb @@ -1,3 +1,3 @@ require 'active_support/deprecation' -ActiveSupport::Deprecation.warn("ActionDispatch::Assertions::TagAssertions has been extracted to the rails-dom-testing gem.") +ActiveSupport::Deprecation.warn('`ActionDispatch::Assertions::TagAssertions` has been extracted to the rails-dom-testing gem.') diff --git a/actionview/lib/action_view/view_paths.rb b/actionview/lib/action_view/view_paths.rb index 80a41f2418..2e203a7590 100644 --- a/actionview/lib/action_view/view_paths.rb +++ b/actionview/lib/action_view/view_paths.rb @@ -38,7 +38,11 @@ module ActionView def handle_deprecated_parent_prefixes # TODO: remove in 4.3/5.0. return unless respond_to?(:parent_prefixes) - ActiveSupport::Deprecation.warn "Overriding ActionController::Base::parent_prefixes is deprecated, override .local_prefixes instead." + ActiveSupport::Deprecation.warn(<<-MSG.squish) + Overriding `ActionController::Base::parent_prefixes` is deprecated, + override `.local_prefixes` instead. + MSG + local_prefixes + parent_prefixes end end diff --git a/activemodel/lib/active_model/dirty.rb b/activemodel/lib/active_model/dirty.rb index ca04f48c1c..ae185694ca 100644 --- a/activemodel/lib/active_model/dirty.rb +++ b/activemodel/lib/active_model/dirty.rb @@ -1,5 +1,6 @@ require 'active_support/hash_with_indifferent_access' require 'active_support/core_ext/object/duplicable' +require 'active_support/core_ext/string/filters' module ActiveModel # == Active \Model \Dirty @@ -200,7 +201,11 @@ module ActiveModel end def reset_changes - ActiveSupport::Deprecation.warn "#reset_changes is deprecated and will be removed on Rails 5. Please use #clear_changes_information instead." + ActiveSupport::Deprecation.warn(<<-MSG.squish) + `#reset_changes` is deprecated and will be removed on Rails 5. + Please use `#clear_changes_information` instead. + MSG + clear_changes_information end @@ -224,7 +229,10 @@ module ActiveModel # Handle reset_*! for +method_missing+. def reset_attribute!(attr) - ActiveSupport::Deprecation.warn "#reset_#{attr}! is deprecated and will be removed on Rails 5. Please use #restore_#{attr}! instead." + ActiveSupport::Deprecation.warn(<<-MSG.squish) + `#reset_#{attr}!` is deprecated and will be removed on Rails 5. + Please use `#restore_#{attr}!` instead. + MSG restore_attribute!(attr) end diff --git a/activerecord/lib/active_record/associations/has_many_through_association.rb b/activerecord/lib/active_record/associations/has_many_through_association.rb index 1b84fdf5f2..04a69ba446 100644 --- a/activerecord/lib/active_record/associations/has_many_through_association.rb +++ b/activerecord/lib/active_record/associations/has_many_through_association.rb @@ -67,9 +67,9 @@ module ActiveRecord if has_cached_counter? && !through_reflection_updates_counter_cache? ActiveSupport::Deprecation.warn(<<-MSG.squish) Automatic updating of counter caches on through associations has been - deprecated, and will be removed in Rails 5.0. Instead, please set the - appropriate counter_cache options on the has_many and belongs_to for - your associations to #{through_reflection.name}. + deprecated, and will be removed in Rails 5. Instead, please set the + appropriate `counter_cache` options on the `has_many` and `belongs_to` + for your associations to #{through_reflection.name}. MSG update_counter_in_database(1) diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb index 6ee4efe7f6..34ec397aee 100644 --- a/activerecord/lib/active_record/attribute_methods.rb +++ b/activerecord/lib/active_record/attribute_methods.rb @@ -207,8 +207,8 @@ module ActiveRecord column = columns_hash[name.to_s] if column.nil? ActiveSupport::Deprecation.warn(<<-MSG.squish) - `column_for_attribute` will return a null object for non-existent - columns in Rails 5.0. Use `has_attribute?` if you need to check for + `#column_for_attribute` will return a null object for non-existent + columns in Rails 5. Use `#has_attribute?` if you need to check for an attribute's existence. MSG end diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb index e197f7f2f9..46812b75bb 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -520,7 +520,7 @@ module ActiveRecord def connection_pools ActiveSupport::Deprecation.warn(<<-MSG.squish) - In the next release, this will return the same as #connection_pool_list. + In the next release, this will return the same as `#connection_pool_list`. (An array of pools, rather than a hash mapping specs to pools.) MSG diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb index 1aed8b0457..f8b6daea5a 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb @@ -61,10 +61,9 @@ module ActiveRecord return if options.key?(:null) ActiveSupport::Deprecation.warn(<<-MSG.squish) - `timestamp` was called without specifying an option for `null`. In Rails - 5.0, this behavior will change to `null: false`. You should manually - specify `null: true` to prevent the behavior of your existing migrations - from changing. + `#timestamp` was called without specifying an option for `null`. In Rails 5, + this behavior will change to `null: false`. You should manually specify + `null: true` to prevent the behavior of your existing migrations from changing. MSG end end diff --git a/activerecord/lib/active_record/connection_adapters/connection_specification.rb b/activerecord/lib/active_record/connection_adapters/connection_specification.rb index af405fc690..609ec7dabd 100644 --- a/activerecord/lib/active_record/connection_adapters/connection_specification.rb +++ b/activerecord/lib/active_record/connection_adapters/connection_specification.rb @@ -225,7 +225,7 @@ module ActiveRecord ActiveSupport::Deprecation.warn(<<-MSG.squish) Passing a string to ActiveRecord::Base.establish_connection for a configuration lookup is deprecated, please pass a symbol - (#{spec.to_sym.inspect}) instead + (#{spec.to_sym.inspect}) instead. MSG resolve_symbol_connection(spec) diff --git a/activerecord/lib/active_record/inheritance.rb b/activerecord/lib/active_record/inheritance.rb index 251d682a02..f58145ab05 100644 --- a/activerecord/lib/active_record/inheritance.rb +++ b/activerecord/lib/active_record/inheritance.rb @@ -80,12 +80,12 @@ module ActiveRecord end def symbolized_base_class - ActiveSupport::Deprecation.warn("ActiveRecord::Base.symbolized_base_class is deprecated and will be removed without replacement.") + ActiveSupport::Deprecation.warn('`ActiveRecord::Base.symbolized_base_class` is deprecated and will be removed without replacement.') @symbolized_base_class ||= base_class.to_s.to_sym end def symbolized_sti_name - ActiveSupport::Deprecation.warn("ActiveRecord::Base.symbolized_sti_name is deprecated and will be removed without replacement.") + ActiveSupport::Deprecation.warn('`ActiveRecord::Base.symbolized_sti_name` is deprecated and will be removed without replacement.') @symbolized_sti_name ||= sti_name.present? ? sti_name.to_sym : symbolized_base_class end diff --git a/activerecord/lib/active_record/type/boolean.rb b/activerecord/lib/active_record/type/boolean.rb index 612478e67d..978d16d524 100644 --- a/activerecord/lib/active_record/type/boolean.rb +++ b/activerecord/lib/active_record/type/boolean.rb @@ -14,9 +14,13 @@ module ActiveRecord true else if !ConnectionAdapters::Column::FALSE_VALUES.include?(value) - ActiveSupport::Deprecation.warn(<<-EOM) - You attempted to assign a value which is not explicitly true or false to a boolean column. Currently this value casts to false. This will change to match Ruby's semantics, and will cast to true in Rails 5.0. If you would like to maintain the current behavior, you should explicitly handle the values you would like cast to false. - EOM + ActiveSupport::Deprecation.warn(<<-MSG.squish) + You attempted to assign a value which is not explicitly `true` or `false` + to a boolean column. Currently this value casts to `false`. This will + change to match Ruby's semantics, and will cast to `true` in Rails 5. + If you would like to maintain the current behavior, you should + explicitly handle the values you would like cast to `false`. + MSG end false end diff --git a/activesupport/lib/active_support/core_ext/kernel/reporting.rb b/activesupport/lib/active_support/core_ext/kernel/reporting.rb index 80c531b694..f5179552bb 100644 --- a/activesupport/lib/active_support/core_ext/kernel/reporting.rb +++ b/activesupport/lib/active_support/core_ext/kernel/reporting.rb @@ -32,7 +32,7 @@ module Kernel # For compatibility def silence_stderr #:nodoc: ActiveSupport::Deprecation.warn( - "#silence_stderr is deprecated and will be removed in the next release" + "`#silence_stderr` is deprecated and will be removed in the next release." ) #not thread-safe silence_stream(STDERR) { yield } end @@ -87,7 +87,7 @@ module Kernel # stream # => "error\n" def capture(stream) ActiveSupport::Deprecation.warn( - "#capture(stream) is deprecated and will be removed in the next release" + "`#capture(stream)` is deprecated and will be removed in the next release." ) #not thread-safe stream = stream.to_s captured_stream = Tempfile.new(stream) @@ -113,7 +113,7 @@ module Kernel # This method is not thread-safe. def quietly ActiveSupport::Deprecation.warn( - "#quietly is deprecated and will be removed in the next release" + "`#quietly` is deprecated and will be removed in the next release." ) #not thread-safe silence_stream(STDOUT) do silence_stream(STDERR) do diff --git a/activesupport/lib/active_support/json/encoding.rb b/activesupport/lib/active_support/json/encoding.rb index a14ed7ee94..c0ac5af153 100644 --- a/activesupport/lib/active_support/json/encoding.rb +++ b/activesupport/lib/active_support/json/encoding.rb @@ -131,7 +131,7 @@ module ActiveSupport "The JSON encoder in Rails 4.1 no longer supports encoding BigDecimals as JSON numbers. Instead, " \ "the new encoder will always encode them as strings.\n\n" \ "You are seeing this error because you are trying to check the value of the related configuration, " \ - "'active_support.encode_big_decimal_as_string'. If your application depends on this option, you should " \ + "`active_support.encode_big_decimal_as_string`. If your application depends on this option, you should " \ "add the 'activesupport-json_encoder' gem to your Gemfile. For now, this option will always be true. " \ "In the future, it will be removed from Rails, so you should stop checking its value." diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb index 4c3e77b7fd..a4ba5989b1 100644 --- a/activesupport/lib/active_support/test_case.rb +++ b/activesupport/lib/active_support/test_case.rb @@ -25,7 +25,7 @@ module ActiveSupport if test_order.nil? ActiveSupport::Deprecation.warn "You did not specify a value for the " \ - "configuration option 'active_support.test_order'. In Rails 5.0, " \ + "configuration option `active_support.test_order`. In Rails 5, " \ "the default value of this option will change from `:sorted` to " \ "`:random`.\n" \ "To disable this warning and keep the current behavior, you can add " \ diff --git a/railties/lib/rails/rack/log_tailer.rb b/railties/lib/rails/rack/log_tailer.rb index bc26421a9e..46517713c9 100644 --- a/railties/lib/rails/rack/log_tailer.rb +++ b/railties/lib/rails/rack/log_tailer.rb @@ -4,7 +4,7 @@ module Rails module Rack class LogTailer def initialize(app, log = nil) - ActiveSupport::Deprecation.warn "LogTailer is deprecated and will be removed on Rails 5" + ActiveSupport::Deprecation.warn('LogTailer is deprecated and will be removed on Rails 5.') @app = app -- cgit v1.2.3