From 49d885f29075cfef4cb954bb9247b6fbc8318cac Mon Sep 17 00:00:00 2001 From: Loren Segal Date: Thu, 11 Aug 2016 15:32:43 -0700 Subject: [PATCH] Enable and support Ruby 2.3+ frozen_string_literals --- .rubocop.yml | 2 -- Gemfile | 1 + Rakefile | 1 + benchmarks/builtins_vs_eval.rb | 1 + benchmarks/concat_vs_join.rb | 1 + benchmarks/erb_vs_erubis.rb | 1 + benchmarks/format_args.rb | 1 + benchmarks/generation.rb | 1 + benchmarks/marshal_vs_dbm.rb | 1 + benchmarks/parsing.rb | 1 + benchmarks/pathname_vs_string.rb | 1 + benchmarks/rdoc_vs_yardoc.rb | 1 + benchmarks/registry_store_types.rb | 1 + benchmarks/ri_vs_yri.rb | 1 + benchmarks/ripper_parser.rb | 1 + benchmarks/splat_vs_flatten.rb | 1 + benchmarks/template_erb.rb | 1 + benchmarks/template_format.rb | 1 + benchmarks/template_profile.rb | 1 + benchmarks/yri_cache.rb | 1 + bin/yard | 1 + bin/yardoc | 1 + bin/yri | 1 + docs/templates/default/fulldoc/html/setup.rb | 1 + docs/templates/default/layout/html/setup.rb | 1 + .../templates/default/yard_tags/html/setup.rb | 1 + docs/templates/plugin.rb | 1 + lib/rubygems_plugin.rb | 1 + lib/yard.rb | 1 + lib/yard/autoload.rb | 1 + lib/yard/cli/command.rb | 1 + lib/yard/cli/command_parser.rb | 1 + lib/yard/cli/config.rb | 1 + lib/yard/cli/diff.rb | 1 + lib/yard/cli/display.rb | 1 + lib/yard/cli/gems.rb | 1 + lib/yard/cli/graph.rb | 1 + lib/yard/cli/help.rb | 1 + lib/yard/cli/i18n.rb | 1 + lib/yard/cli/list.rb | 1 + lib/yard/cli/markup_types.rb | 1 + lib/yard/cli/server.rb | 1 + lib/yard/cli/stats.rb | 1 + lib/yard/cli/yardoc.rb | 1 + lib/yard/cli/yardopts_command.rb | 1 + lib/yard/cli/yri.rb | 1 + lib/yard/code_objects/base.rb | 3 ++- lib/yard/code_objects/class_object.rb | 1 + .../code_objects/class_variable_object.rb | 1 + lib/yard/code_objects/constant_object.rb | 1 + .../code_objects/extended_method_object.rb | 1 + lib/yard/code_objects/extra_file_object.rb | 1 + lib/yard/code_objects/macro_object.rb | 1 + lib/yard/code_objects/method_object.rb | 1 + lib/yard/code_objects/module_object.rb | 1 + lib/yard/code_objects/namespace_mapper.rb | 1 + lib/yard/code_objects/namespace_object.rb | 1 + lib/yard/code_objects/proxy.rb | 1 + lib/yard/code_objects/root_object.rb | 1 + lib/yard/config.rb | 1 + lib/yard/core_ext/array.rb | 1 + lib/yard/core_ext/file.rb | 1 + lib/yard/core_ext/hash.rb | 1 + lib/yard/core_ext/insertion.rb | 1 + lib/yard/core_ext/module.rb | 1 + lib/yard/core_ext/string.rb | 9 ++++---- lib/yard/core_ext/symbol_hash.rb | 1 + lib/yard/docstring.rb | 1 + lib/yard/docstring_parser.rb | 6 +++-- lib/yard/globals.rb | 1 + lib/yard/handlers/base.rb | 1 + lib/yard/handlers/c/alias_handler.rb | 1 + lib/yard/handlers/c/attribute_handler.rb | 1 + lib/yard/handlers/c/base.rb | 1 + lib/yard/handlers/c/class_handler.rb | 1 + lib/yard/handlers/c/constant_handler.rb | 1 + lib/yard/handlers/c/handler_methods.rb | 1 + lib/yard/handlers/c/init_handler.rb | 1 + lib/yard/handlers/c/method_handler.rb | 1 + lib/yard/handlers/c/mixin_handler.rb | 1 + lib/yard/handlers/c/module_handler.rb | 1 + .../handlers/c/override_comment_handler.rb | 1 + lib/yard/handlers/c/path_handler.rb | 1 + lib/yard/handlers/c/struct_handler.rb | 1 + lib/yard/handlers/c/symbol_handler.rb | 1 + lib/yard/handlers/processor.rb | 1 + lib/yard/handlers/ruby/alias_handler.rb | 1 + lib/yard/handlers/ruby/attribute_handler.rb | 1 + lib/yard/handlers/ruby/base.rb | 1 + .../handlers/ruby/class_condition_handler.rb | 1 + lib/yard/handlers/ruby/class_handler.rb | 1 + .../handlers/ruby/class_variable_handler.rb | 1 + lib/yard/handlers/ruby/comment_handler.rb | 1 + lib/yard/handlers/ruby/constant_handler.rb | 1 + .../ruby/decorator_handler_methods.rb | 1 + lib/yard/handlers/ruby/dsl_handler.rb | 1 + lib/yard/handlers/ruby/dsl_handler_methods.rb | 1 + lib/yard/handlers/ruby/exception_handler.rb | 1 + lib/yard/handlers/ruby/extend_handler.rb | 1 + .../handlers/ruby/legacy/alias_handler.rb | 1 + .../handlers/ruby/legacy/attribute_handler.rb | 1 + lib/yard/handlers/ruby/legacy/base.rb | 1 + .../ruby/legacy/class_condition_handler.rb | 1 + .../handlers/ruby/legacy/class_handler.rb | 1 + .../ruby/legacy/class_variable_handler.rb | 1 + .../handlers/ruby/legacy/comment_handler.rb | 1 + .../handlers/ruby/legacy/constant_handler.rb | 1 + lib/yard/handlers/ruby/legacy/dsl_handler.rb | 1 + .../handlers/ruby/legacy/exception_handler.rb | 1 + .../handlers/ruby/legacy/extend_handler.rb | 1 + .../handlers/ruby/legacy/method_handler.rb | 1 + .../handlers/ruby/legacy/mixin_handler.rb | 1 + .../ruby/legacy/module_function_handler.rb | 1 + .../handlers/ruby/legacy/module_handler.rb | 1 + .../legacy/private_class_method_handler.rb | 1 + .../ruby/legacy/private_constant_handler.rb | 1 + .../ruby/legacy/visibility_handler.rb | 1 + .../handlers/ruby/legacy/yield_handler.rb | 1 + .../handlers/ruby/method_condition_handler.rb | 1 + lib/yard/handlers/ruby/method_handler.rb | 1 + lib/yard/handlers/ruby/mixin_handler.rb | 1 + .../handlers/ruby/module_function_handler.rb | 1 + lib/yard/handlers/ruby/module_handler.rb | 1 + .../ruby/private_class_method_handler.rb | 1 + .../handlers/ruby/private_constant_handler.rb | 1 + .../ruby/public_class_method_handler.rb | 1 + .../handlers/ruby/struct_handler_methods.rb | 1 + lib/yard/handlers/ruby/visibility_handler.rb | 1 + lib/yard/handlers/ruby/yield_handler.rb | 1 + lib/yard/i18n/locale.rb | 1 + lib/yard/i18n/message.rb | 1 + lib/yard/i18n/messages.rb | 1 + lib/yard/i18n/po_parser.rb | 1 + lib/yard/i18n/pot_generator.rb | 7 +++--- lib/yard/i18n/text.rb | 7 +++--- lib/yard/logging.rb | 1 + lib/yard/options.rb | 1 + lib/yard/parser/base.rb | 1 + lib/yard/parser/c/c_parser.rb | 3 ++- lib/yard/parser/c/comment_parser.rb | 1 + lib/yard/parser/c/statement.rb | 1 + lib/yard/parser/ruby/ast_node.rb | 1 + lib/yard/parser/ruby/legacy/ruby_lex.rb | 22 +++++++++---------- lib/yard/parser/ruby/legacy/ruby_parser.rb | 1 + lib/yard/parser/ruby/legacy/statement.rb | 1 + lib/yard/parser/ruby/legacy/statement_list.rb | 1 + lib/yard/parser/ruby/legacy/token_list.rb | 1 + lib/yard/parser/ruby/ruby_parser.rb | 3 ++- lib/yard/parser/ruby/token_resolver.rb | 1 + lib/yard/parser/source_parser.rb | 5 +++-- lib/yard/rake/yardoc_task.rb | 1 + lib/yard/registry.rb | 1 + lib/yard/registry_resolver.rb | 1 + lib/yard/registry_store.rb | 1 + lib/yard/rubygems/backports.rb | 1 + lib/yard/rubygems/backports/gem.rb | 1 + lib/yard/rubygems/backports/source_index.rb | 1 + lib/yard/rubygems/doc_manager.rb | 1 + lib/yard/rubygems/hook.rb | 1 + lib/yard/rubygems/specification.rb | 1 + lib/yard/serializers/base.rb | 1 + .../serializers/file_system_serializer.rb | 3 ++- lib/yard/serializers/process_serializer.rb | 1 + lib/yard/serializers/stdout_serializer.rb | 1 + lib/yard/serializers/yardoc_serializer.rb | 1 + lib/yard/server.rb | 1 + lib/yard/server/adapter.rb | 1 + lib/yard/server/commands/base.rb | 1 + .../server/commands/display_file_command.rb | 1 + .../server/commands/display_object_command.rb | 1 + lib/yard/server/commands/frames_command.rb | 1 + lib/yard/server/commands/library_command.rb | 1 + .../server/commands/library_index_command.rb | 1 + lib/yard/server/commands/list_command.rb | 1 + .../server/commands/root_request_command.rb | 1 + lib/yard/server/commands/search_command.rb | 1 + .../server/commands/static_file_command.rb | 1 + .../server/commands/static_file_helpers.rb | 1 + lib/yard/server/doc_server_helper.rb | 1 + lib/yard/server/doc_server_serializer.rb | 1 + lib/yard/server/library_version.rb | 1 + lib/yard/server/rack_adapter.rb | 1 + lib/yard/server/router.rb | 1 + lib/yard/server/static_caching.rb | 1 + .../templates/default/layout/html/setup.rb | 1 + .../default/method_details/html/setup.rb | 1 + .../doc_server/library_list/html/setup.rb | 1 + .../doc_server/processing/html/setup.rb | 1 + .../templates/doc_server/search/html/setup.rb | 1 + lib/yard/server/webrick_adapter.rb | 1 + lib/yard/tags/default_factory.rb | 7 +++--- lib/yard/tags/default_tag.rb | 1 + lib/yard/tags/directives.rb | 1 + lib/yard/tags/library.rb | 1 + lib/yard/tags/option_tag.rb | 1 + lib/yard/tags/overload_tag.rb | 3 ++- lib/yard/tags/ref_tag.rb | 1 + lib/yard/tags/ref_tag_list.rb | 1 + lib/yard/tags/tag.rb | 1 + lib/yard/tags/tag_format_error.rb | 1 + lib/yard/tags/types_explainer.rb | 3 ++- lib/yard/templates/engine.rb | 1 + lib/yard/templates/erb_cache.rb | 1 + lib/yard/templates/helpers/base_helper.rb | 1 + lib/yard/templates/helpers/filter_helper.rb | 1 + lib/yard/templates/helpers/html_helper.rb | 6 +++-- .../helpers/html_syntax_highlight_helper.rb | 3 ++- .../templates/helpers/markup/rdoc_markdown.rb | 1 + .../templates/helpers/markup/rdoc_markup.rb | 1 + lib/yard/templates/helpers/markup_helper.rb | 1 + lib/yard/templates/helpers/method_helper.rb | 1 + lib/yard/templates/helpers/module_helper.rb | 1 + lib/yard/templates/helpers/text_helper.rb | 3 ++- lib/yard/templates/helpers/uml_helper.rb | 1 + lib/yard/templates/section.rb | 1 + lib/yard/templates/template.rb | 3 ++- lib/yard/templates/template_options.rb | 1 + lib/yard/verifier.rb | 1 + lib/yard/version.rb | 1 + spec/cli/command_parser_spec.rb | 1 + spec/cli/command_spec.rb | 1 + spec/cli/config_spec.rb | 1 + spec/cli/diff_spec.rb | 1 + spec/cli/display_spec.rb | 1 + spec/cli/gems_spec.rb | 1 + spec/cli/graph_spec.rb | 1 + spec/cli/help_spec.rb | 1 + spec/cli/i18n_spec.rb | 1 + spec/cli/list_spec.rb | 1 + spec/cli/markup_types_spec.rb | 1 + spec/cli/server_spec.rb | 1 + spec/cli/stats_spec.rb | 1 + spec/cli/yardoc_spec.rb | 3 ++- spec/cli/yri_spec.rb | 1 + spec/code_objects/base_spec.rb | 1 + spec/code_objects/class_object_spec.rb | 1 + spec/code_objects/code_object_list_spec.rb | 1 + spec/code_objects/constants_spec.rb | 1 + spec/code_objects/extra_file_object_spec.rb | 7 +++--- spec/code_objects/macro_object_spec.rb | 1 + spec/code_objects/method_object_spec.rb | 1 + spec/code_objects/module_object_spec.rb | 1 + spec/code_objects/namespace_object_spec.rb | 1 + spec/code_objects/proxy_spec.rb | 1 + spec/code_objects/spec_helper.rb | 1 + spec/config_spec.rb | 1 + spec/core_ext/array_spec.rb | 1 + spec/core_ext/file_spec.rb | 1 + spec/core_ext/hash_spec.rb | 1 + spec/core_ext/insertion_spec.rb | 1 + spec/core_ext/module_spec.rb | 1 + spec/core_ext/string_spec.rb | 1 + spec/core_ext/symbol_hash_spec.rb | 1 + spec/docstring_parser_spec.rb | 1 + spec/docstring_spec.rb | 1 + spec/handlers/alias_handler_spec.rb | 1 + spec/handlers/attribute_handler_spec.rb | 1 + spec/handlers/base_spec.rb | 1 + spec/handlers/c/alias_handler_spec.rb | 1 + spec/handlers/c/attribute_handler_spec.rb | 1 + spec/handlers/c/class_handler_spec.rb | 1 + spec/handlers/c/constant_handler_spec.rb | 1 + spec/handlers/c/init_handler_spec.rb | 1 + spec/handlers/c/method_handler_spec.rb | 1 + spec/handlers/c/mixin_handler_spec.rb | 1 + spec/handlers/c/module_handler_spec.rb | 1 + .../c/override_comment_handler_spec.rb | 1 + spec/handlers/c/path_handler_spec.rb | 1 + spec/handlers/c/spec_helper.rb | 1 + spec/handlers/c/struct_handler_spec.rb | 1 + spec/handlers/class_condition_handler_spec.rb | 1 + spec/handlers/class_handler_spec.rb | 1 + .../class_method_handler_shared_examples.rb | 1 + spec/handlers/class_variable_handler_spec.rb | 1 + spec/handlers/constant_handler_spec.rb | 1 + .../decorator_handler_methods_spec.rb | 1 + spec/handlers/dsl_handler_spec.rb | 1 + spec/handlers/exception_handler_spec.rb | 1 + spec/handlers/extend_handler_spec.rb | 1 + spec/handlers/legacy_base_spec.rb | 1 + .../handlers/method_condition_handler_spec.rb | 1 + spec/handlers/method_handler_spec.rb | 1 + spec/handlers/mixin_handler_spec.rb | 1 + spec/handlers/module_function_handler_spec.rb | 1 + spec/handlers/module_handler_spec.rb | 1 + .../private_class_method_handler_spec.rb | 1 + .../handlers/private_constant_handler_spec.rb | 1 + spec/handlers/processor_spec.rb | 1 + .../public_class_method_handler_spec.rb | 1 + spec/handlers/ruby/base_spec.rb | 1 + spec/handlers/ruby/legacy/base_spec.rb | 1 + spec/handlers/spec_helper.rb | 1 + spec/handlers/visibility_handler_spec.rb | 1 + spec/handlers/yield_handler_spec.rb | 1 + spec/i18n/locale_spec.rb | 3 ++- spec/i18n/message_spec.rb | 1 + spec/i18n/messages_spec.rb | 1 + spec/i18n/pot_generator_spec.rb | 3 ++- spec/i18n/text_spec.rb | 1 + spec/logging_spec.rb | 1 + spec/options_spec.rb | 1 + spec/parser/base_spec.rb | 1 + spec/parser/c_parser_spec.rb | 1 + spec/parser/ruby/ast_node_spec.rb | 1 + .../parser/ruby/legacy/statement_list_spec.rb | 1 + spec/parser/ruby/legacy/token_list_spec.rb | 1 + spec/parser/ruby/ruby_parser_spec.rb | 1 + spec/parser/ruby/token_resolver_spec.rb | 1 + spec/parser/source_parser_spec.rb | 3 ++- spec/parser/tag_parsing_spec.rb | 1 + spec/rake/yardoc_task_spec.rb | 1 + spec/registry_spec.rb | 1 + spec/registry_store_spec.rb | 1 + spec/rubygems/doc_manager_spec.rb | 1 + .../file_system_serializer_spec.rb | 1 + spec/serializers/spec_helper.rb | 1 + spec/serializers/yardoc_serializer_spec.rb | 1 + spec/server/adapter_spec.rb | 1 + spec/server/commands/base_spec.rb | 1 + spec/server/commands/library_command_spec.rb | 1 + spec/server/doc_server_helper_spec.rb | 1 + spec/server/doc_server_serializer_spec.rb | 1 + spec/server/rack_adapter_spec.rb | 1 + spec/server/router_spec.rb | 1 + spec/server/spec_helper.rb | 1 + spec/server/static_caching_spec.rb | 1 + spec/server/webrick_servlet_spec.rb | 1 + spec/server_spec.rb | 1 + spec/spec_helper.rb | 1 + spec/tags/default_factory_spec.rb | 1 + spec/tags/default_tag_spec.rb | 1 + spec/tags/directives_spec.rb | 3 ++- spec/tags/library_spec.rb | 1 + spec/tags/overload_tag_spec.rb | 1 + spec/tags/ref_tag_list_spec.rb | 1 + spec/tags/types_explainer_spec.rb | 1 + spec/templates/class_spec.rb | 1 + spec/templates/constant_spec.rb | 1 + spec/templates/engine_spec.rb | 1 + spec/templates/helpers/base_helper_spec.rb | 1 + spec/templates/helpers/html_helper_spec.rb | 5 +++-- .../html_syntax_highlight_helper_spec.rb | 1 + .../helpers/markup/rdoc_markup_spec.rb | 1 + spec/templates/helpers/markup_helper_spec.rb | 1 + spec/templates/helpers/method_helper_spec.rb | 1 + spec/templates/helpers/module_helper_spec.rb | 1 + .../helpers/shared_signature_examples.rb | 1 + spec/templates/helpers/text_helper_spec.rb | 1 + spec/templates/method_spec.rb | 1 + spec/templates/module_spec.rb | 1 + spec/templates/onefile_spec.rb | 3 ++- spec/templates/section_spec.rb | 1 + spec/templates/spec_helper.rb | 3 +++ spec/templates/tag_spec.rb | 1 + spec/templates/template_spec.rb | 7 +++--- spec/verifier_spec.rb | 1 + templates/default/class/dot/setup.rb | 1 + templates/default/class/html/setup.rb | 1 + templates/default/class/setup.rb | 1 + templates/default/class/text/setup.rb | 1 + templates/default/constant/text/setup.rb | 1 + templates/default/docstring/setup.rb | 1 + templates/default/fulldoc/html/setup.rb | 3 ++- templates/default/layout/dot/setup.rb | 1 + templates/default/layout/html/setup.rb | 1 + templates/default/method/setup.rb | 1 + templates/default/method_details/setup.rb | 1 + .../default/method_details/text/setup.rb | 1 + templates/default/module/dot/setup.rb | 1 + templates/default/module/setup.rb | 1 + templates/default/module/text/setup.rb | 1 + templates/default/onefile/html/setup.rb | 1 + templates/default/root/dot/setup.rb | 1 + templates/default/root/html/setup.rb | 1 + templates/default/tags/setup.rb | 1 + templates/guide/class/html/setup.rb | 1 + templates/guide/docstring/html/setup.rb | 1 + templates/guide/fulldoc/html/setup.rb | 1 + templates/guide/layout/html/setup.rb | 1 + templates/guide/method/html/setup.rb | 1 + templates/guide/module/html/setup.rb | 1 + templates/guide/onefile/html/setup.rb | 1 + templates/guide/tags/html/setup.rb | 1 + yard.gemspec | 1 + 384 files changed, 440 insertions(+), 56 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index b82f1ab9e..8c63a4d23 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -66,8 +66,6 @@ Style/NestedTernaryOperator: Enabled: false Style/MutableConstant: Enabled: false -Style/FrozenStringLiteralComment: - Enabled: false Style/WhenThen: Enabled: false Style/StringLiterals: diff --git a/Gemfile b/Gemfile index 40101fed3..6ecf5fca0 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,4 @@ +# frozen_string_literal: true source 'https://rubygems.org' group :development do diff --git a/Rakefile b/Rakefile index 570a8236c..339d2da04 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/lib/yard' require File.dirname(__FILE__) + '/lib/yard/rubygems/specification' require 'rbconfig' diff --git a/benchmarks/builtins_vs_eval.rb b/benchmarks/builtins_vs_eval.rb index 8d07784ce..b9b152e40 100644 --- a/benchmarks/builtins_vs_eval.rb +++ b/benchmarks/builtins_vs_eval.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'benchmark' require File.join(File.dirname(__FILE__), '..', 'lib', 'yard') diff --git a/benchmarks/concat_vs_join.rb b/benchmarks/concat_vs_join.rb index f6434b37e..39909ceeb 100644 --- a/benchmarks/concat_vs_join.rb +++ b/benchmarks/concat_vs_join.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "benchmark" STR1 = "Hello" diff --git a/benchmarks/erb_vs_erubis.rb b/benchmarks/erb_vs_erubis.rb index 0871efdf9..2c146107d 100644 --- a/benchmarks/erb_vs_erubis.rb +++ b/benchmarks/erb_vs_erubis.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rubygems' require 'erubis' require 'erubis/tiny' diff --git a/benchmarks/format_args.rb b/benchmarks/format_args.rb index 92b878d68..7497943a5 100644 --- a/benchmarks/format_args.rb +++ b/benchmarks/format_args.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "benchmark" require 'lib/yard' diff --git a/benchmarks/generation.rb b/benchmarks/generation.rb index 8b7911f30..3a0cf765d 100644 --- a/benchmarks/generation.rb +++ b/benchmarks/generation.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "benchmark" require File.join(File.dirname(__FILE__), '..', 'lib', 'yard') diff --git a/benchmarks/marshal_vs_dbm.rb b/benchmarks/marshal_vs_dbm.rb index f34fff46e..330d8113d 100644 --- a/benchmarks/marshal_vs_dbm.rb +++ b/benchmarks/marshal_vs_dbm.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'benchmark' require 'dbm' diff --git a/benchmarks/parsing.rb b/benchmarks/parsing.rb index 8c7be9a56..5823bd43d 100644 --- a/benchmarks/parsing.rb +++ b/benchmarks/parsing.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "benchmark" require 'yard' require 'logger' diff --git a/benchmarks/pathname_vs_string.rb b/benchmarks/pathname_vs_string.rb index 17df991bb..2cf97834f 100644 --- a/benchmarks/pathname_vs_string.rb +++ b/benchmarks/pathname_vs_string.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'pathname' require "benchmark" require File.dirname(__FILE__) + '/../lib/yard' diff --git a/benchmarks/rdoc_vs_yardoc.rb b/benchmarks/rdoc_vs_yardoc.rb index 0f257ce68..704ddc218 100644 --- a/benchmarks/rdoc_vs_yardoc.rb +++ b/benchmarks/rdoc_vs_yardoc.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "benchmark" files = Dir.glob(File.dirname(__FILE__) + '/../lib/**/*.rb').join(" ") diff --git a/benchmarks/registry_store_types.rb b/benchmarks/registry_store_types.rb index e4134440d..a13f24859 100644 --- a/benchmarks/registry_store_types.rb +++ b/benchmarks/registry_store_types.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'benchmark' require File.join(File.dirname(__FILE__), '..', 'lib', 'yard') diff --git a/benchmarks/ri_vs_yri.rb b/benchmarks/ri_vs_yri.rb index dc42581a4..afa0ef38e 100644 --- a/benchmarks/ri_vs_yri.rb +++ b/benchmarks/ri_vs_yri.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "benchmark" TIMES = 10 diff --git a/benchmarks/ripper_parser.rb b/benchmarks/ripper_parser.rb index 91bfec856..45059468a 100644 --- a/benchmarks/ripper_parser.rb +++ b/benchmarks/ripper_parser.rb @@ -1,4 +1,5 @@ # encoding: utf-8 +# frozen_string_literal: true require 'benchmark' require File.dirname(__FILE__) + '/../lib/yard' diff --git a/benchmarks/splat_vs_flatten.rb b/benchmarks/splat_vs_flatten.rb index ba8a90e3f..ab157539b 100644 --- a/benchmarks/splat_vs_flatten.rb +++ b/benchmarks/splat_vs_flatten.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "benchmark" # To prove that flattening a small list is not significantly slower than diff --git a/benchmarks/template_erb.rb b/benchmarks/template_erb.rb index 011ab7a59..1457230d2 100644 --- a/benchmarks/template_erb.rb +++ b/benchmarks/template_erb.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "benchmark" require File.join(File.dirname(__FILE__), '..', 'lib', 'yard') diff --git a/benchmarks/template_format.rb b/benchmarks/template_format.rb index 0bf9929f7..25905b30b 100644 --- a/benchmarks/template_format.rb +++ b/benchmarks/template_format.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "benchmark" require File.join(File.dirname(__FILE__), '..', 'lib', 'yard') diff --git a/benchmarks/template_profile.rb b/benchmarks/template_profile.rb index 5ceb5f383..1ba32125e 100644 --- a/benchmarks/template_profile.rb +++ b/benchmarks/template_profile.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rubygems' require 'ruby-prof' # require 'benchmark' diff --git a/benchmarks/yri_cache.rb b/benchmarks/yri_cache.rb index a00118d3b..0b98ff16a 100644 --- a/benchmarks/yri_cache.rb +++ b/benchmarks/yri_cache.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + "/../lib/yard" require "benchmark" include YARD::CLI diff --git a/bin/yard b/bin/yard index 7b4348002..d17a7d04c 100755 --- a/bin/yard +++ b/bin/yard @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true # We do all this work just to find the proper load path path = __FILE__ diff --git a/bin/yardoc b/bin/yardoc index fa5b19b58..6ead3194b 100755 --- a/bin/yardoc +++ b/bin/yardoc @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true # We do all this work just to find the proper load path path = __FILE__ diff --git a/bin/yri b/bin/yri index 1cfd70384..29014eed3 100755 --- a/bin/yri +++ b/bin/yri @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true # We do all this work just to find the proper load path path = __FILE__ diff --git a/docs/templates/default/fulldoc/html/setup.rb b/docs/templates/default/fulldoc/html/setup.rb index ef281a89d..fafa88e9b 100644 --- a/docs/templates/default/fulldoc/html/setup.rb +++ b/docs/templates/default/fulldoc/html/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true def generate_tag_list @list_title = "Tag List" @list_type = "tag" diff --git a/docs/templates/default/layout/html/setup.rb b/docs/templates/default/layout/html/setup.rb index 251cb3c8a..453e7f009 100644 --- a/docs/templates/default/layout/html/setup.rb +++ b/docs/templates/default/layout/html/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true def init super sections.place(:tag_list).after_any(:files) diff --git a/docs/templates/default/yard_tags/html/setup.rb b/docs/templates/default/yard_tags/html/setup.rb index c94a9cc5b..0c2c83b9d 100644 --- a/docs/templates/default/yard_tags/html/setup.rb +++ b/docs/templates/default/yard_tags/html/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true def init sections :list, [T('docstring')] end diff --git a/docs/templates/plugin.rb b/docs/templates/plugin.rb index 8ee2766f2..f26893521 100644 --- a/docs/templates/plugin.rb +++ b/docs/templates/plugin.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true include YARD include Templates diff --git a/lib/rubygems_plugin.rb b/lib/rubygems_plugin.rb index 16db25a65..d0b59bf37 100644 --- a/lib/rubygems_plugin.rb +++ b/lib/rubygems_plugin.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true if defined?(Gem::VERSION) && Gem::VERSION >= "2.0." require File.expand_path(File.dirname(__FILE__) + '/yard/rubygems/hook') else diff --git a/lib/yard.rb b/lib/yard.rb index f5cee0431..dd02af11a 100644 --- a/lib/yard.rb +++ b/lib/yard.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD # The root path for YARD source libraries ROOT = File.expand_path(File.dirname(__FILE__)) diff --git a/lib/yard/autoload.rb b/lib/yard/autoload.rb index 9be93dc89..3505e588f 100644 --- a/lib/yard/autoload.rb +++ b/lib/yard/autoload.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # @private def __p(path) File.join(YARD::ROOT, 'yard', *path.split('/')); end diff --git a/lib/yard/cli/command.rb b/lib/yard/cli/command.rb index b50016c69..abd521abd 100644 --- a/lib/yard/cli/command.rb +++ b/lib/yard/cli/command.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'optparse' module YARD diff --git a/lib/yard/cli/command_parser.rb b/lib/yard/cli/command_parser.rb index be28fb253..1ffc4ec47 100644 --- a/lib/yard/cli/command_parser.rb +++ b/lib/yard/cli/command_parser.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module CLI # This class parses a command name out of the +yard+ CLI command and calls diff --git a/lib/yard/cli/config.rb b/lib/yard/cli/config.rb index 1f270dae6..0de2b2860 100644 --- a/lib/yard/cli/config.rb +++ b/lib/yard/cli/config.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module CLI # CLI command to view or edit configuration options diff --git a/lib/yard/cli/diff.rb b/lib/yard/cli/diff.rb index fec44ea98..81eb18439 100644 --- a/lib/yard/cli/diff.rb +++ b/lib/yard/cli/diff.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'tmpdir' require 'fileutils' require 'open-uri' diff --git a/lib/yard/cli/display.rb b/lib/yard/cli/display.rb index 48bf42ee4..0295a660c 100644 --- a/lib/yard/cli/display.rb +++ b/lib/yard/cli/display.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module CLI # Display one object diff --git a/lib/yard/cli/gems.rb b/lib/yard/cli/gems.rb index 22743f054..7b4c48b12 100644 --- a/lib/yard/cli/gems.rb +++ b/lib/yard/cli/gems.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module CLI # @since 0.6.0 diff --git a/lib/yard/cli/graph.rb b/lib/yard/cli/graph.rb index 2b308435f..863d61acc 100644 --- a/lib/yard/cli/graph.rb +++ b/lib/yard/cli/graph.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module CLI # Options to pass to the {Graph} CLI. diff --git a/lib/yard/cli/help.rb b/lib/yard/cli/help.rb index 47de8641b..3367c2521 100644 --- a/lib/yard/cli/help.rb +++ b/lib/yard/cli/help.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module CLI # Handles help for commands diff --git a/lib/yard/cli/i18n.rb b/lib/yard/cli/i18n.rb index 0f39376c1..92d713e46 100644 --- a/lib/yard/cli/i18n.rb +++ b/lib/yard/cli/i18n.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "pathname" module YARD diff --git a/lib/yard/cli/list.rb b/lib/yard/cli/list.rb index 1eb5619a8..d8b66b8f7 100644 --- a/lib/yard/cli/list.rb +++ b/lib/yard/cli/list.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module CLI # Lists all constant and method names in the codebase. Uses {Yardoc} --list. diff --git a/lib/yard/cli/markup_types.rb b/lib/yard/cli/markup_types.rb index 339d46abf..46fd1a3bf 100644 --- a/lib/yard/cli/markup_types.rb +++ b/lib/yard/cli/markup_types.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module CLI # Lists all markup types diff --git a/lib/yard/cli/server.rb b/lib/yard/cli/server.rb index 0af8e8471..91b22f6bc 100644 --- a/lib/yard/cli/server.rb +++ b/lib/yard/cli/server.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module CLI # A local documentation server diff --git a/lib/yard/cli/stats.rb b/lib/yard/cli/stats.rb index c8a863490..00c3b6a45 100644 --- a/lib/yard/cli/stats.rb +++ b/lib/yard/cli/stats.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module CLI # @since 0.6.0 diff --git a/lib/yard/cli/yardoc.rb b/lib/yard/cli/yardoc.rb index 2d3c37489..5f90a2dce 100644 --- a/lib/yard/cli/yardoc.rb +++ b/lib/yard/cli/yardoc.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'digest/sha1' require 'fileutils' diff --git a/lib/yard/cli/yardopts_command.rb b/lib/yard/cli/yardopts_command.rb index 00babb7de..b86497e85 100644 --- a/lib/yard/cli/yardopts_command.rb +++ b/lib/yard/cli/yardopts_command.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'optparse' module YARD diff --git a/lib/yard/cli/yri.rb b/lib/yard/cli/yri.rb index 4770010ca..970660804 100644 --- a/lib/yard/cli/yri.rb +++ b/lib/yard/cli/yri.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rbconfig' module YARD diff --git a/lib/yard/code_objects/base.rb b/lib/yard/code_objects/base.rb index 58d7a663f..6e5f9da36 100644 --- a/lib/yard/code_objects/base.rb +++ b/lib/yard/code_objects/base.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module CodeObjects # A list of code objects. This array acts like a set (no unique items) @@ -580,7 +581,7 @@ def copyable_attributes # @param [String] source the source code to format # @return [String] formatted source def format_source(source) - source.chomp! + source = source.chomp last = source.split(/\r?\n/).last indent = last ? last[/^([ \t]*)/, 1].length : 0 source.gsub(/^[ \t]{#{indent}}/, '') diff --git a/lib/yard/code_objects/class_object.rb b/lib/yard/code_objects/class_object.rb index 5fe4b0170..125cc9760 100644 --- a/lib/yard/code_objects/class_object.rb +++ b/lib/yard/code_objects/class_object.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD::CodeObjects register_separator NSEP, :class diff --git a/lib/yard/code_objects/class_variable_object.rb b/lib/yard/code_objects/class_variable_object.rb index 0fc54a2a4..ddd2ffa4b 100644 --- a/lib/yard/code_objects/class_variable_object.rb +++ b/lib/yard/code_objects/class_variable_object.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD::CodeObjects register_separator NSEP, :class_variable diff --git a/lib/yard/code_objects/constant_object.rb b/lib/yard/code_objects/constant_object.rb index a831189f2..b7904648b 100644 --- a/lib/yard/code_objects/constant_object.rb +++ b/lib/yard/code_objects/constant_object.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD::CodeObjects register_separator NSEP, :constant diff --git a/lib/yard/code_objects/extended_method_object.rb b/lib/yard/code_objects/extended_method_object.rb index dd339c490..b96794076 100644 --- a/lib/yard/code_objects/extended_method_object.rb +++ b/lib/yard/code_objects/extended_method_object.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD::CodeObjects # Represents an instance method of a module that was mixed into the class # scope of another namespace. diff --git a/lib/yard/code_objects/extra_file_object.rb b/lib/yard/code_objects/extra_file_object.rb index 499de1c52..952335f60 100644 --- a/lib/yard/code_objects/extra_file_object.rb +++ b/lib/yard/code_objects/extra_file_object.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD::CodeObjects # An ExtraFileObject represents an extra documentation file (README or other # file). It is not strictly a CodeObject (does not inherit from `Base`) although diff --git a/lib/yard/code_objects/macro_object.rb b/lib/yard/code_objects/macro_object.rb index 6cfc9755a..235de4207 100644 --- a/lib/yard/code_objects/macro_object.rb +++ b/lib/yard/code_objects/macro_object.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'ostruct' module YARD diff --git a/lib/yard/code_objects/method_object.rb b/lib/yard/code_objects/method_object.rb index ee3db3c9c..9a7dbed35 100644 --- a/lib/yard/code_objects/method_object.rb +++ b/lib/yard/code_objects/method_object.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD::CodeObjects register_separator CSEP, :method register_separator ISEP, :method diff --git a/lib/yard/code_objects/module_object.rb b/lib/yard/code_objects/module_object.rb index 3dd01cbea..838933e6a 100644 --- a/lib/yard/code_objects/module_object.rb +++ b/lib/yard/code_objects/module_object.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD::CodeObjects register_separator NSEP, :module diff --git a/lib/yard/code_objects/namespace_mapper.rb b/lib/yard/code_objects/namespace_mapper.rb index 18f651580..d5a6a2ff4 100644 --- a/lib/yard/code_objects/namespace_mapper.rb +++ b/lib/yard/code_objects/namespace_mapper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module CodeObjects # This module controls registration and accessing of namespace separators diff --git a/lib/yard/code_objects/namespace_object.rb b/lib/yard/code_objects/namespace_object.rb index 5c1eca8eb..7cc7cd971 100644 --- a/lib/yard/code_objects/namespace_object.rb +++ b/lib/yard/code_objects/namespace_object.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD::CodeObjects register_separator NSEP, :namespace default_separator NSEP diff --git a/lib/yard/code_objects/proxy.rb b/lib/yard/code_objects/proxy.rb index c6a499959..4cce57963 100644 --- a/lib/yard/code_objects/proxy.rb +++ b/lib/yard/code_objects/proxy.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module CodeObjects # A special type of +NoMethodError+ when raised from a {Proxy} diff --git a/lib/yard/code_objects/root_object.rb b/lib/yard/code_objects/root_object.rb index bb25ad730..871178798 100644 --- a/lib/yard/code_objects/root_object.rb +++ b/lib/yard/code_objects/root_object.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module CodeObjects # Represents the root namespace object (the invisible Ruby module that diff --git a/lib/yard/config.rb b/lib/yard/config.rb index 3e664c144..0c8b6ad6a 100644 --- a/lib/yard/config.rb +++ b/lib/yard/config.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD # This class maintains all system-wide configuration for YARD and handles # the loading of plugins. To access options call {options}, and to load diff --git a/lib/yard/core_ext/array.rb b/lib/yard/core_ext/array.rb index c4d1edeb9..acbfea36b 100644 --- a/lib/yard/core_ext/array.rb +++ b/lib/yard/core_ext/array.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Array # Places values before or after another object (by value) in # an array. This is used in tandem with the before and after diff --git a/lib/yard/core_ext/file.rb b/lib/yard/core_ext/file.rb index 35ace92e5..3902f2bd3 100644 --- a/lib/yard/core_ext/file.rb +++ b/lib/yard/core_ext/file.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'fileutils' class File diff --git a/lib/yard/core_ext/hash.rb b/lib/yard/core_ext/hash.rb index 967c93c4c..6de7e080c 100644 --- a/lib/yard/core_ext/hash.rb +++ b/lib/yard/core_ext/hash.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Hash class << self def create(*args) diff --git a/lib/yard/core_ext/insertion.rb b/lib/yard/core_ext/insertion.rb index 797378552..13efd0142 100644 --- a/lib/yard/core_ext/insertion.rb +++ b/lib/yard/core_ext/insertion.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # The Insertion class inserts a value before or after another # value in a list. # diff --git a/lib/yard/core_ext/module.rb b/lib/yard/core_ext/module.rb index 2a828f0c7..6f0b95105 100644 --- a/lib/yard/core_ext/module.rb +++ b/lib/yard/core_ext/module.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Module # Returns the class name of a full module namespace path # diff --git a/lib/yard/core_ext/string.rb b/lib/yard/core_ext/string.rb index 3069c8398..17d3709e5 100644 --- a/lib/yard/core_ext/string.rb +++ b/lib/yard/core_ext/string.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class String # Splits text into tokens the way a shell would, handling quoted # text as a single token. Use '\"' and "\'" to escape quotes and @@ -5,16 +6,16 @@ class String # # @return [Array] an array representing the tokens def shell_split - out = [""] + out = [String.new("")] state = :none escape_next = false - quote = "" + quote = String.new("") strip.split(//).each do |char| case state when :none, :space case char when /\s/ - out << "" unless state == :space + out << String.new("") unless state == :space state = :space escape_next = false when "\\" @@ -30,7 +31,7 @@ def shell_split escape_next = false else state = char - quote = "" + quote = String.new("") end else state = :none diff --git a/lib/yard/core_ext/symbol_hash.rb b/lib/yard/core_ext/symbol_hash.rb index a3cd00eb0..b93742a32 100644 --- a/lib/yard/core_ext/symbol_hash.rb +++ b/lib/yard/core_ext/symbol_hash.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # A subclass of Hash where all keys are converted into Symbols, and # optionally, all String values are converted into Symbols. class SymbolHash < Hash diff --git a/lib/yard/docstring.rb b/lib/yard/docstring.rb index 0f4416198..b2350bf72 100644 --- a/lib/yard/docstring.rb +++ b/lib/yard/docstring.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD # A documentation string, or "docstring" for short, encapsulates the # comments and metadata, or "tags", of an object. Meta-data is expressed diff --git a/lib/yard/docstring_parser.rb b/lib/yard/docstring_parser.rb index 8d210f84b..125746a8e 100644 --- a/lib/yard/docstring_parser.rb +++ b/lib/yard/docstring_parser.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'ostruct' module YARD @@ -129,7 +130,7 @@ def parse(content, object = nil, handler = nil) def parse_content(content) content = content.split(/\r?\n/) if content.is_a?(String) return '' if !content || content.empty? - docstring = "" + docstring = String.new("") indent = content.first[/^\s*/].length last_indent = 0 @@ -175,7 +176,8 @@ def parse_content(content) tag_buf << line.gsub(/^[ \t]{#{orig_indent}}/, '') elsif !tag_name # Regular docstring text - docstring << line << "\n" + docstring << line + docstring << "\n" end last_indent = indent diff --git a/lib/yard/globals.rb b/lib/yard/globals.rb index d2ae37df7..041465872 100644 --- a/lib/yard/globals.rb +++ b/lib/yard/globals.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # @group Global Convenience Methods # Shortcut for creating a YARD::CodeObjects::Proxy via a path diff --git a/lib/yard/handlers/base.rb b/lib/yard/handlers/base.rb index 71995daaf..ee5ac12fc 100644 --- a/lib/yard/handlers/base.rb +++ b/lib/yard/handlers/base.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Handlers # Raise this error when a handler should exit before completing. diff --git a/lib/yard/handlers/c/alias_handler.rb b/lib/yard/handlers/c/alias_handler.rb index 8a62f6871..85a99bd75 100644 --- a/lib/yard/handlers/c/alias_handler.rb +++ b/lib/yard/handlers/c/alias_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class YARD::Handlers::C::AliasHandler < YARD::Handlers::C::Base MATCH = /rb_define_alias \s*\(\s*([\w\.]+), diff --git a/lib/yard/handlers/c/attribute_handler.rb b/lib/yard/handlers/c/attribute_handler.rb index cc20ea088..537ea12e7 100644 --- a/lib/yard/handlers/c/attribute_handler.rb +++ b/lib/yard/handlers/c/attribute_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class YARD::Handlers::C::AttributeHandler < YARD::Handlers::C::Base MATCH = /rb_define_attr\s*\(\s*([\w\.]+),\s*"([^"]+)",\s*(0|1)\s*,\s*(0|1)\s*\)/ handles MATCH diff --git a/lib/yard/handlers/c/base.rb b/lib/yard/handlers/c/base.rb index e5a711d3a..af36f8a68 100644 --- a/lib/yard/handlers/c/base.rb +++ b/lib/yard/handlers/c/base.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Handlers module C diff --git a/lib/yard/handlers/c/class_handler.rb b/lib/yard/handlers/c/class_handler.rb index ba1affcf2..63cc650f8 100644 --- a/lib/yard/handlers/c/class_handler.rb +++ b/lib/yard/handlers/c/class_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class YARD::Handlers::C::ClassHandler < YARD::Handlers::C::Base MATCH1 = /([\w\.]+)\s* = \s*(?:rb_define_class|boot_defclass)\s* \( diff --git a/lib/yard/handlers/c/constant_handler.rb b/lib/yard/handlers/c/constant_handler.rb index d08e67d76..e98d279f4 100644 --- a/lib/yard/handlers/c/constant_handler.rb +++ b/lib/yard/handlers/c/constant_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class YARD::Handlers::C::ConstantHandler < YARD::Handlers::C::Base MATCH = /\brb_define_((?:readonly_)?variable|(?:global_)?const) \s*\((?:\s*(\w+),)?\s*"(\w+)",\s*(.*?)\s*\)\s*;/xm diff --git a/lib/yard/handlers/c/handler_methods.rb b/lib/yard/handlers/c/handler_methods.rb index 0a7404101..47b9397a2 100644 --- a/lib/yard/handlers/c/handler_methods.rb +++ b/lib/yard/handlers/c/handler_methods.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Handlers module C diff --git a/lib/yard/handlers/c/init_handler.rb b/lib/yard/handlers/c/init_handler.rb index 50d0e42ce..792bbbbd8 100644 --- a/lib/yard/handlers/c/init_handler.rb +++ b/lib/yard/handlers/c/init_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Handles the Init_Libname() method class YARD::Handlers::C::InitHandler < YARD::Handlers::C::Base MATCH = /\A\s*(?:\S+\s+)*void\s+(?:[Ii]nit_)?(\w+)\s*/ diff --git a/lib/yard/handlers/c/method_handler.rb b/lib/yard/handlers/c/method_handler.rb index b13fe8660..1ac605f33 100644 --- a/lib/yard/handlers/c/method_handler.rb +++ b/lib/yard/handlers/c/method_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class YARD::Handlers::C::MethodHandler < YARD::Handlers::C::Base MATCH1 = /rb_define_ ( diff --git a/lib/yard/handlers/c/mixin_handler.rb b/lib/yard/handlers/c/mixin_handler.rb index 65fcad8ef..7688326db 100644 --- a/lib/yard/handlers/c/mixin_handler.rb +++ b/lib/yard/handlers/c/mixin_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class YARD::Handlers::C::MixinHandler < YARD::Handlers::C::Base MATCH = /rb_include_module\s*\(\s*(\w+?),\s*(\w+?)\s*\)/ handles MATCH diff --git a/lib/yard/handlers/c/module_handler.rb b/lib/yard/handlers/c/module_handler.rb index 3ec698168..aaf5998df 100644 --- a/lib/yard/handlers/c/module_handler.rb +++ b/lib/yard/handlers/c/module_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class YARD::Handlers::C::ModuleHandler < YARD::Handlers::C::Base MATCH1 = /([\w\.]+)\s* = \s*rb_define_module\s*\(\s*"([\w:]+)"\s*\)/mx MATCH2 = /([\w\.]+)\s* = \s*rb_define_module_under\s*\(\s*(\w+),\s*"(\w+)"\s*\)/mx diff --git a/lib/yard/handlers/c/override_comment_handler.rb b/lib/yard/handlers/c/override_comment_handler.rb index 91d00bf34..0af2afdf6 100644 --- a/lib/yard/handlers/c/override_comment_handler.rb +++ b/lib/yard/handlers/c/override_comment_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Parses comments class YARD::Handlers::C::OverrideCommentHandler < YARD::Handlers::C::Base handles(/./) diff --git a/lib/yard/handlers/c/path_handler.rb b/lib/yard/handlers/c/path_handler.rb index 6df1d1a91..63cf8e34a 100644 --- a/lib/yard/handlers/c/path_handler.rb +++ b/lib/yard/handlers/c/path_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class YARD::Handlers::C::PathHandler < YARD::Handlers::C::Base MATCH = /([\w\.]+)\s* = \s*rb_path2class\s*\(\s*"([\w:]+)"\)/mx handles MATCH diff --git a/lib/yard/handlers/c/struct_handler.rb b/lib/yard/handlers/c/struct_handler.rb index d071ef6ab..37092d3e0 100644 --- a/lib/yard/handlers/c/struct_handler.rb +++ b/lib/yard/handlers/c/struct_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class YARD::Handlers::C::StructHandler < YARD::Handlers::C::Base MATCH = /([\w\.]+)\s*=\s*(?:rb_struct_define_without_accessor)\s* \(\s*"([\w:]+)"\s*,\s*(\w+)\s*/mx diff --git a/lib/yard/handlers/c/symbol_handler.rb b/lib/yard/handlers/c/symbol_handler.rb index ac0c1588b..4d12b1a0e 100644 --- a/lib/yard/handlers/c/symbol_handler.rb +++ b/lib/yard/handlers/c/symbol_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Keeps track of function bodies for symbol lookup during Ruby method declarations class YARD::Handlers::C::SymbolHandler < YARD::Handlers::C::Base MATCH = /\A\s*(?:(?:\w+)\s+)?(?:intern\s+)?VALUE\s+(\w+)\s*\(/ diff --git a/lib/yard/handlers/processor.rb b/lib/yard/handlers/processor.rb index 5e090b4e1..41a3fea04 100644 --- a/lib/yard/handlers/processor.rb +++ b/lib/yard/handlers/processor.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'ostruct' module YARD diff --git a/lib/yard/handlers/ruby/alias_handler.rb b/lib/yard/handlers/ruby/alias_handler.rb index 70df242ff..ca08af1fe 100644 --- a/lib/yard/handlers/ruby/alias_handler.rb +++ b/lib/yard/handlers/ruby/alias_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Handles alias and alias_method calls class YARD::Handlers::Ruby::AliasHandler < YARD::Handlers::Ruby::Base handles :alias, method_call(:alias_method) diff --git a/lib/yard/handlers/ruby/attribute_handler.rb b/lib/yard/handlers/ruby/attribute_handler.rb index 0104525f0..0c68024e2 100644 --- a/lib/yard/handlers/ruby/attribute_handler.rb +++ b/lib/yard/handlers/ruby/attribute_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Handles +attr_*+ statements in modules/classes class YARD::Handlers::Ruby::AttributeHandler < YARD::Handlers::Ruby::Base handles method_call(:attr) diff --git a/lib/yard/handlers/ruby/base.rb b/lib/yard/handlers/ruby/base.rb index 8df0af356..f33420767 100644 --- a/lib/yard/handlers/ruby/base.rb +++ b/lib/yard/handlers/ruby/base.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Handlers module Ruby diff --git a/lib/yard/handlers/ruby/class_condition_handler.rb b/lib/yard/handlers/ruby/class_condition_handler.rb index cd3a16dd7..6968859bb 100644 --- a/lib/yard/handlers/ruby/class_condition_handler.rb +++ b/lib/yard/handlers/ruby/class_condition_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Matches if/unless conditions inside classes and attempts to process only # one branch (by evaluating the condition if possible). # diff --git a/lib/yard/handlers/ruby/class_handler.rb b/lib/yard/handlers/ruby/class_handler.rb index 0c8cd0f4f..6b0159fe0 100644 --- a/lib/yard/handlers/ruby/class_handler.rb +++ b/lib/yard/handlers/ruby/class_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Handles class declarations class YARD::Handlers::Ruby::ClassHandler < YARD::Handlers::Ruby::Base include YARD::Handlers::Ruby::StructHandlerMethods diff --git a/lib/yard/handlers/ruby/class_variable_handler.rb b/lib/yard/handlers/ruby/class_variable_handler.rb index e84ea05ea..290beb48d 100644 --- a/lib/yard/handlers/ruby/class_variable_handler.rb +++ b/lib/yard/handlers/ruby/class_variable_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Handles a class variable (@@variable) class YARD::Handlers::Ruby::ClassVariableHandler < YARD::Handlers::Ruby::Base handles :assign diff --git a/lib/yard/handlers/ruby/comment_handler.rb b/lib/yard/handlers/ruby/comment_handler.rb index cafbe5d99..19733b440 100644 --- a/lib/yard/handlers/ruby/comment_handler.rb +++ b/lib/yard/handlers/ruby/comment_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Handles any lone comment statement in a Ruby file class YARD::Handlers::Ruby::CommentHandler < YARD::Handlers::Ruby::Base handles :comment, :void_stmt diff --git a/lib/yard/handlers/ruby/constant_handler.rb b/lib/yard/handlers/ruby/constant_handler.rb index 9653bb23d..ded5c0431 100644 --- a/lib/yard/handlers/ruby/constant_handler.rb +++ b/lib/yard/handlers/ruby/constant_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Handles any constant assignment class YARD::Handlers::Ruby::ConstantHandler < YARD::Handlers::Ruby::Base include YARD::Handlers::Ruby::StructHandlerMethods diff --git a/lib/yard/handlers/ruby/decorator_handler_methods.rb b/lib/yard/handlers/ruby/decorator_handler_methods.rb index d9d6a1b44..840bf735e 100644 --- a/lib/yard/handlers/ruby/decorator_handler_methods.rb +++ b/lib/yard/handlers/ruby/decorator_handler_methods.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Helper methods to assist with processing decorators. module YARD::Handlers::Ruby::DecoratorHandlerMethods # @overload process_decorator(*nodes, opts = {}, &block) diff --git a/lib/yard/handlers/ruby/dsl_handler.rb b/lib/yard/handlers/ruby/dsl_handler.rb index 36787e404..dec24a2f9 100644 --- a/lib/yard/handlers/ruby/dsl_handler.rb +++ b/lib/yard/handlers/ruby/dsl_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Handlers module Ruby diff --git a/lib/yard/handlers/ruby/dsl_handler_methods.rb b/lib/yard/handlers/ruby/dsl_handler_methods.rb index f49532fa5..af3c42097 100644 --- a/lib/yard/handlers/ruby/dsl_handler_methods.rb +++ b/lib/yard/handlers/ruby/dsl_handler_methods.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Handlers module Ruby diff --git a/lib/yard/handlers/ruby/exception_handler.rb b/lib/yard/handlers/ruby/exception_handler.rb index 9dbcc2372..8e4d1cf93 100644 --- a/lib/yard/handlers/ruby/exception_handler.rb +++ b/lib/yard/handlers/ruby/exception_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Handles 'raise' calls inside methods class YARD::Handlers::Ruby::ExceptionHandler < YARD::Handlers::Ruby::Base handles method_call(:raise) diff --git a/lib/yard/handlers/ruby/extend_handler.rb b/lib/yard/handlers/ruby/extend_handler.rb index 0b3622eba..e07f49878 100644 --- a/lib/yard/handlers/ruby/extend_handler.rb +++ b/lib/yard/handlers/ruby/extend_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Handles 'extend' call to include modules into the class scope of another # @see MixinHandler class YARD::Handlers::Ruby::ExtendHandler < YARD::Handlers::Ruby::MixinHandler diff --git a/lib/yard/handlers/ruby/legacy/alias_handler.rb b/lib/yard/handlers/ruby/legacy/alias_handler.rb index 594059e44..a1947fc89 100644 --- a/lib/yard/handlers/ruby/legacy/alias_handler.rb +++ b/lib/yard/handlers/ruby/legacy/alias_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # (see Ruby::AliasHandler) class YARD::Handlers::Ruby::Legacy::AliasHandler < YARD::Handlers::Ruby::Legacy::Base handles(/\Aalias(_method)?(\s|\()/) diff --git a/lib/yard/handlers/ruby/legacy/attribute_handler.rb b/lib/yard/handlers/ruby/legacy/attribute_handler.rb index bb3395756..74a7b9db5 100644 --- a/lib/yard/handlers/ruby/legacy/attribute_handler.rb +++ b/lib/yard/handlers/ruby/legacy/attribute_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # (see Ruby::AttributeHandler) class YARD::Handlers::Ruby::Legacy::AttributeHandler < YARD::Handlers::Ruby::Legacy::Base handles(/\Aattr(?:_(?:reader|writer|accessor))?(?:\s|\()/) diff --git a/lib/yard/handlers/ruby/legacy/base.rb b/lib/yard/handlers/ruby/legacy/base.rb index bedfc5bbe..f6c327fda 100644 --- a/lib/yard/handlers/ruby/legacy/base.rb +++ b/lib/yard/handlers/ruby/legacy/base.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Handlers module Ruby::Legacy diff --git a/lib/yard/handlers/ruby/legacy/class_condition_handler.rb b/lib/yard/handlers/ruby/legacy/class_condition_handler.rb index 49e4bdf79..5ef57eec1 100644 --- a/lib/yard/handlers/ruby/legacy/class_condition_handler.rb +++ b/lib/yard/handlers/ruby/legacy/class_condition_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # (see Ruby::ClassConditionHandler) # @since 0.5.4 class YARD::Handlers::Ruby::Legacy::ClassConditionHandler < YARD::Handlers::Ruby::Legacy::Base diff --git a/lib/yard/handlers/ruby/legacy/class_handler.rb b/lib/yard/handlers/ruby/legacy/class_handler.rb index ecdd3e32c..b0729b8e4 100644 --- a/lib/yard/handlers/ruby/legacy/class_handler.rb +++ b/lib/yard/handlers/ruby/legacy/class_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # (see Ruby::ClassHandler) class YARD::Handlers::Ruby::Legacy::ClassHandler < YARD::Handlers::Ruby::Legacy::Base include YARD::Handlers::Ruby::StructHandlerMethods diff --git a/lib/yard/handlers/ruby/legacy/class_variable_handler.rb b/lib/yard/handlers/ruby/legacy/class_variable_handler.rb index c1c9b2618..79b586dfa 100644 --- a/lib/yard/handlers/ruby/legacy/class_variable_handler.rb +++ b/lib/yard/handlers/ruby/legacy/class_variable_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # (see Ruby::ClassVariableHandler) class YARD::Handlers::Ruby::Legacy::ClassVariableHandler < YARD::Handlers::Ruby::Legacy::Base HANDLER_MATCH = /\A@@\w+\s*=\s*/m diff --git a/lib/yard/handlers/ruby/legacy/comment_handler.rb b/lib/yard/handlers/ruby/legacy/comment_handler.rb index 203b78b3e..1a0be2c9b 100644 --- a/lib/yard/handlers/ruby/legacy/comment_handler.rb +++ b/lib/yard/handlers/ruby/legacy/comment_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # (see Ruby::CommentHandler) class YARD::Handlers::Ruby::Legacy::CommentHandler < YARD::Handlers::Ruby::Legacy::Base handles TkCOMMENT diff --git a/lib/yard/handlers/ruby/legacy/constant_handler.rb b/lib/yard/handlers/ruby/legacy/constant_handler.rb index 90579fd5f..aedfc2462 100644 --- a/lib/yard/handlers/ruby/legacy/constant_handler.rb +++ b/lib/yard/handlers/ruby/legacy/constant_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # (see Ruby::ConstantHandler) class YARD::Handlers::Ruby::Legacy::ConstantHandler < YARD::Handlers::Ruby::Legacy::Base include YARD::Handlers::Ruby::StructHandlerMethods diff --git a/lib/yard/handlers/ruby/legacy/dsl_handler.rb b/lib/yard/handlers/ruby/legacy/dsl_handler.rb index 18c0d93f4..502fca34d 100644 --- a/lib/yard/handlers/ruby/legacy/dsl_handler.rb +++ b/lib/yard/handlers/ruby/legacy/dsl_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Handlers module Ruby diff --git a/lib/yard/handlers/ruby/legacy/exception_handler.rb b/lib/yard/handlers/ruby/legacy/exception_handler.rb index 755589b86..4c2f9c6e7 100644 --- a/lib/yard/handlers/ruby/legacy/exception_handler.rb +++ b/lib/yard/handlers/ruby/legacy/exception_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # (see Ruby::ExceptionHandler) class YARD::Handlers::Ruby::Legacy::ExceptionHandler < YARD::Handlers::Ruby::Legacy::Base handles(/\Araise(\s|\(|\Z)/) diff --git a/lib/yard/handlers/ruby/legacy/extend_handler.rb b/lib/yard/handlers/ruby/legacy/extend_handler.rb index b0c74efa0..dfb0f8cf8 100644 --- a/lib/yard/handlers/ruby/legacy/extend_handler.rb +++ b/lib/yard/handlers/ruby/legacy/extend_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # (see Ruby::ExtendHandler) class YARD::Handlers::Ruby::Legacy::ExtendHandler < YARD::Handlers::Ruby::Legacy::MixinHandler handles(/\Aextend(\s|\()/) diff --git a/lib/yard/handlers/ruby/legacy/method_handler.rb b/lib/yard/handlers/ruby/legacy/method_handler.rb index ddc5e2cda..aac740422 100644 --- a/lib/yard/handlers/ruby/legacy/method_handler.rb +++ b/lib/yard/handlers/ruby/legacy/method_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # (see Ruby::MethodHandler) class YARD::Handlers::Ruby::Legacy::MethodHandler < YARD::Handlers::Ruby::Legacy::Base handles TkDEF diff --git a/lib/yard/handlers/ruby/legacy/mixin_handler.rb b/lib/yard/handlers/ruby/legacy/mixin_handler.rb index edb642b74..718d3807c 100644 --- a/lib/yard/handlers/ruby/legacy/mixin_handler.rb +++ b/lib/yard/handlers/ruby/legacy/mixin_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # (see Ruby::MixinHandler) class YARD::Handlers::Ruby::Legacy::MixinHandler < YARD::Handlers::Ruby::Legacy::Base handles(/\Ainclude(\s|\()/) diff --git a/lib/yard/handlers/ruby/legacy/module_function_handler.rb b/lib/yard/handlers/ruby/legacy/module_function_handler.rb index d42209f11..e245a3d42 100644 --- a/lib/yard/handlers/ruby/legacy/module_function_handler.rb +++ b/lib/yard/handlers/ruby/legacy/module_function_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # (see Ruby::ModuleFunctionHandler) class YARD::Handlers::Ruby::Legacy::ModuleFunctionHandler < YARD::Handlers::Ruby::Legacy::Base handles(/\A(module_function)(\s|\(|$)/) diff --git a/lib/yard/handlers/ruby/legacy/module_handler.rb b/lib/yard/handlers/ruby/legacy/module_handler.rb index 1d87e6b44..ed1b48f93 100644 --- a/lib/yard/handlers/ruby/legacy/module_handler.rb +++ b/lib/yard/handlers/ruby/legacy/module_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # (see Ruby::ModuleHandler) class YARD::Handlers::Ruby::Legacy::ModuleHandler < YARD::Handlers::Ruby::Legacy::Base handles TkMODULE diff --git a/lib/yard/handlers/ruby/legacy/private_class_method_handler.rb b/lib/yard/handlers/ruby/legacy/private_class_method_handler.rb index ef0b31271..da41c3f4c 100644 --- a/lib/yard/handlers/ruby/legacy/private_class_method_handler.rb +++ b/lib/yard/handlers/ruby/legacy/private_class_method_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # (see Ruby::PrivateClassMethodHandler) class YARD::Handlers::Ruby::Legacy::PrivateClassMethodHandler < YARD::Handlers::Ruby::Legacy::Base handles(/\Aprivate_class_method(\s|\(|$)/) diff --git a/lib/yard/handlers/ruby/legacy/private_constant_handler.rb b/lib/yard/handlers/ruby/legacy/private_constant_handler.rb index 257496d5f..52b1aa2b7 100644 --- a/lib/yard/handlers/ruby/legacy/private_constant_handler.rb +++ b/lib/yard/handlers/ruby/legacy/private_constant_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # (see Ruby::PrivateConstantHandler) class YARD::Handlers::Ruby::Legacy::PrivateConstantHandler < YARD::Handlers::Ruby::Legacy::Base handles(/\Aprivate_constant(\s|\(|$)/) diff --git a/lib/yard/handlers/ruby/legacy/visibility_handler.rb b/lib/yard/handlers/ruby/legacy/visibility_handler.rb index 21de3ba36..62ec9e381 100644 --- a/lib/yard/handlers/ruby/legacy/visibility_handler.rb +++ b/lib/yard/handlers/ruby/legacy/visibility_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # (see Ruby::VisibilityHandler) class YARD::Handlers::Ruby::Legacy::VisibilityHandler < YARD::Handlers::Ruby::Legacy::Base handles(/\A(protected|private|public)(\s|\(|$)/) diff --git a/lib/yard/handlers/ruby/legacy/yield_handler.rb b/lib/yard/handlers/ruby/legacy/yield_handler.rb index a58bdbba3..61933ab8b 100644 --- a/lib/yard/handlers/ruby/legacy/yield_handler.rb +++ b/lib/yard/handlers/ruby/legacy/yield_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # (see Ruby::YieldHandler) class YARD::Handlers::Ruby::Legacy::YieldHandler < YARD::Handlers::Ruby::Legacy::Base handles TkYIELD diff --git a/lib/yard/handlers/ruby/method_condition_handler.rb b/lib/yard/handlers/ruby/method_condition_handler.rb index c42fbfe75..952b9af86 100644 --- a/lib/yard/handlers/ruby/method_condition_handler.rb +++ b/lib/yard/handlers/ruby/method_condition_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Handles a conditional inside a method class YARD::Handlers::Ruby::MethodConditionHandler < YARD::Handlers::Ruby::Base handles :if_mod, :unless_mod diff --git a/lib/yard/handlers/ruby/method_handler.rb b/lib/yard/handlers/ruby/method_handler.rb index cb278a492..66a7a368d 100644 --- a/lib/yard/handlers/ruby/method_handler.rb +++ b/lib/yard/handlers/ruby/method_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Handles a method definition class YARD::Handlers::Ruby::MethodHandler < YARD::Handlers::Ruby::Base handles :def, :defs diff --git a/lib/yard/handlers/ruby/mixin_handler.rb b/lib/yard/handlers/ruby/mixin_handler.rb index 9982aa7ce..090c60d33 100644 --- a/lib/yard/handlers/ruby/mixin_handler.rb +++ b/lib/yard/handlers/ruby/mixin_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Handles the 'include' statement to mixin a module in the instance scope class YARD::Handlers::Ruby::MixinHandler < YARD::Handlers::Ruby::Base handles method_call(:include) diff --git a/lib/yard/handlers/ruby/module_function_handler.rb b/lib/yard/handlers/ruby/module_function_handler.rb index 33233c3d2..9d4030f58 100644 --- a/lib/yard/handlers/ruby/module_function_handler.rb +++ b/lib/yard/handlers/ruby/module_function_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Handles module_function calls to turn methods into public class methods. # Also creates a private instance copy of the method. class YARD::Handlers::Ruby::ModuleFunctionHandler < YARD::Handlers::Ruby::Base diff --git a/lib/yard/handlers/ruby/module_handler.rb b/lib/yard/handlers/ruby/module_handler.rb index 483ad1167..d66d3efe3 100644 --- a/lib/yard/handlers/ruby/module_handler.rb +++ b/lib/yard/handlers/ruby/module_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Handles the declaration of a module class YARD::Handlers::Ruby::ModuleHandler < YARD::Handlers::Ruby::Base handles :module diff --git a/lib/yard/handlers/ruby/private_class_method_handler.rb b/lib/yard/handlers/ruby/private_class_method_handler.rb index 68c5e7f29..ea5365abc 100644 --- a/lib/yard/handlers/ruby/private_class_method_handler.rb +++ b/lib/yard/handlers/ruby/private_class_method_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Sets visibility of a class method to private. class YARD::Handlers::Ruby::PrivateClassMethodHandler < YARD::Handlers::Ruby::Base include YARD::Handlers::Ruby::DecoratorHandlerMethods diff --git a/lib/yard/handlers/ruby/private_constant_handler.rb b/lib/yard/handlers/ruby/private_constant_handler.rb index 398e0d625..2f7cbb275 100644 --- a/lib/yard/handlers/ruby/private_constant_handler.rb +++ b/lib/yard/handlers/ruby/private_constant_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Handlers module Ruby diff --git a/lib/yard/handlers/ruby/public_class_method_handler.rb b/lib/yard/handlers/ruby/public_class_method_handler.rb index 480ea3ba1..83c527165 100644 --- a/lib/yard/handlers/ruby/public_class_method_handler.rb +++ b/lib/yard/handlers/ruby/public_class_method_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Sets visibility of a class method to public. class YARD::Handlers::Ruby::PublicClassMethodHandler < YARD::Handlers::Ruby::Base include YARD::Handlers::Ruby::DecoratorHandlerMethods diff --git a/lib/yard/handlers/ruby/struct_handler_methods.rb b/lib/yard/handlers/ruby/struct_handler_methods.rb index 3b7378982..d23b2ad3a 100644 --- a/lib/yard/handlers/ruby/struct_handler_methods.rb +++ b/lib/yard/handlers/ruby/struct_handler_methods.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Helper methods to parse @attr_* tags on a class. # # @deprecated The use of +@attr+ tags are deprecated since 0.8.0 in favour of diff --git a/lib/yard/handlers/ruby/visibility_handler.rb b/lib/yard/handlers/ruby/visibility_handler.rb index 06b0b8343..0d13d5127 100644 --- a/lib/yard/handlers/ruby/visibility_handler.rb +++ b/lib/yard/handlers/ruby/visibility_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Handles 'private', 'protected', and 'public' calls. class YARD::Handlers::Ruby::VisibilityHandler < YARD::Handlers::Ruby::Base include YARD::Handlers::Ruby::DecoratorHandlerMethods diff --git a/lib/yard/handlers/ruby/yield_handler.rb b/lib/yard/handlers/ruby/yield_handler.rb index 93188e3c8..a9e5f81c4 100644 --- a/lib/yard/handlers/ruby/yield_handler.rb +++ b/lib/yard/handlers/ruby/yield_handler.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Handles 'yield' calls class YARD::Handlers::Ruby::YieldHandler < YARD::Handlers::Ruby::Base handles :yield, :yield0 diff --git a/lib/yard/i18n/locale.rb b/lib/yard/i18n/locale.rb index f83c68822..6a6cd5ced 100644 --- a/lib/yard/i18n/locale.rb +++ b/lib/yard/i18n/locale.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module I18n # +Locale+ is a unit of translation. It has {#name} and a set of diff --git a/lib/yard/i18n/message.rb b/lib/yard/i18n/message.rb index d21fb51e1..fa811efa8 100644 --- a/lib/yard/i18n/message.rb +++ b/lib/yard/i18n/message.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "set" module YARD diff --git a/lib/yard/i18n/messages.rb b/lib/yard/i18n/messages.rb index 9afcea022..7a5a455ca 100644 --- a/lib/yard/i18n/messages.rb +++ b/lib/yard/i18n/messages.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module I18n # Acts as a container for {Message} objects. diff --git a/lib/yard/i18n/po_parser.rb b/lib/yard/i18n/po_parser.rb index cbc0e8eb8..bc8eb87a3 100644 --- a/lib/yard/i18n/po_parser.rb +++ b/lib/yard/i18n/po_parser.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module I18n # +Locale+ is a wrapper for gettext's PO parsing feature. It hides diff --git a/lib/yard/i18n/pot_generator.rb b/lib/yard/i18n/pot_generator.rb index 3baeb2a95..627daf437 100644 --- a/lib/yard/i18n/pot_generator.rb +++ b/lib/yard/i18n/pot_generator.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "stringio" module YARD @@ -119,7 +120,7 @@ def parse_files(files) # # @return [String] POT format string def generate - pot = header + pot = String.new(header) sorted_messages = @messages.sort_by do |message| sorted_locations = message.locations.sort sorted_locations.first || [] @@ -246,7 +247,7 @@ def extract_tag_name(tag) tag.object.files.each do |path, line| message.add_location(path, line) end - tag_label = "@#{tag.tag_name}" + tag_label = String.new("@#{tag.tag_name}") tag_label << " [#{tag.types.join(', ')}]" if tag.types message.add_comment(tag_label) end @@ -258,7 +259,7 @@ def extract_tag_text(tag) tag.object.files.each do |path, line| message.add_location(path, line) end - tag_label = "@#{tag.tag_name}" + tag_label = String.new("@#{tag.tag_name}") tag_label << " [#{tag.types.join(', ')}]" if tag.types tag_label << " #{tag.name}" if tag.name message.add_comment(tag_label) diff --git a/lib/yard/i18n/text.rb b/lib/yard/i18n/text.rb index 7bb05add9..79f37e03d 100644 --- a/lib/yard/i18n/text.rb +++ b/lib/yard/i18n/text.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module I18n # Provides some convenient features for translating a text. @@ -49,7 +50,7 @@ def extract_messages # @param [Locale] locale the translation target locale. # @return [String] translated text. def translate(locale) - translated_text = "" + translated_text = String.new("") parse do |part| case part[:type] when :markup @@ -73,7 +74,7 @@ def translate(locale) private def parse(&block) - paragraph = "" + paragraph = String.new("") paragraph_start_line = 0 line_no = 0 in_header = @options[:have_header] @@ -108,7 +109,7 @@ def parse(&block) paragraph << line emit_paragraph_event(paragraph, paragraph_start_line, line_no, &block) - paragraph = "" + paragraph = String.new("") end else paragraph_start_line = line_no if paragraph.empty? diff --git a/lib/yard/logging.rb b/lib/yard/logging.rb index 522a2e82b..ae0c2ea3d 100644 --- a/lib/yard/logging.rb +++ b/lib/yard/logging.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'logger' require 'thread' diff --git a/lib/yard/options.rb b/lib/yard/options.rb index ccb3a2346..ac734e9b1 100644 --- a/lib/yard/options.rb +++ b/lib/yard/options.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD # Generalized options class for passing around large amounts of options between objects. # diff --git a/lib/yard/parser/base.rb b/lib/yard/parser/base.rb index 286a3f0ee..fdfe2e35f 100644 --- a/lib/yard/parser/base.rb +++ b/lib/yard/parser/base.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Parser # Represents the abstract base parser class that parses source code in diff --git a/lib/yard/parser/c/c_parser.rb b/lib/yard/parser/c/c_parser.rb index 20eeeddf7..c5cc7ef2e 100644 --- a/lib/yard/parser/c/c_parser.rb +++ b/lib/yard/parser/c/c_parser.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Parser module C @@ -134,7 +135,7 @@ def consume_comment(add_comment = true) line = @line type = nextchar == '*' ? :multi : :line advance(2) - comment = "" + comment = String.new("") advance_loop do comment << char if type == :multi diff --git a/lib/yard/parser/c/comment_parser.rb b/lib/yard/parser/c/comment_parser.rb index 270810b7c..6984907fd 100644 --- a/lib/yard/parser/c/comment_parser.rb +++ b/lib/yard/parser/c/comment_parser.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Parser module C diff --git a/lib/yard/parser/c/statement.rb b/lib/yard/parser/c/statement.rb index cdc38da4a..fcd2a06b8 100644 --- a/lib/yard/parser/c/statement.rb +++ b/lib/yard/parser/c/statement.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Parser module C diff --git a/lib/yard/parser/ruby/ast_node.rb b/lib/yard/parser/ruby/ast_node.rb index b42930aee..dbfd4aca6 100644 --- a/lib/yard/parser/ruby/ast_node.rb +++ b/lib/yard/parser/ruby/ast_node.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Parser module Ruby diff --git a/lib/yard/parser/ruby/legacy/ruby_lex.rb b/lib/yard/parser/ruby/legacy/ruby_lex.rb index 8886ab909..9ef59fa83 100644 --- a/lib/yard/parser/ruby/legacy/ruby_lex.rb +++ b/lib/yard/parser/ruby/legacy/ruby_lex.rb @@ -352,7 +352,7 @@ def initialize(content) line end .join("\n") end - @content = content + @content = String.new(content) @content << "\n" unless @content[-1, 1] == "\n" @size = @content.size @offset = 0 @@ -610,11 +610,11 @@ def lex_init() end @OP.def_rule("=begin", proc { @prev_char_no == 0 && peek(0) =~ /\s/ }) do |op, _io| - str = op + str = String.new(op) @ltype = "=" begin - line = "" + line = String.new begin ch = getc line << ch @@ -695,7 +695,7 @@ def lex_init() @lex_state = EXPR_BEG Token(TkQUESTION).set_text(op) else - str = op + str = String.new(op) str << ch if ch == '\\' #' str << read_escape @@ -951,7 +951,7 @@ def lex_int2 def identify_gvar @lex_state = EXPR_END - str = "$" + str = String.new("$") tk = case ch = getc when %r{[~_*$?!@/\\;,=:<>".]} @@ -1088,7 +1088,7 @@ def identify_here_document end ltback, @ltype = @ltype, lt - reserve = "" + reserve = String.new while ch = getc reserve << ch @@ -1100,7 +1100,7 @@ def identify_here_document end end - str = "" + str = String.new while (l = gets) l.chomp! l.strip! if indent @@ -1201,7 +1201,7 @@ def identify_string(ltype, quoted = ltype, opener = nil, initial_char = nil) @quoted = quoted subtype = nil - str = "" + str = String.new str << initial_char if initial_char str << (opener || quoted) @@ -1247,7 +1247,7 @@ def identify_string(ltype, quoted = ltype, opener = nil, initial_char = nil) end def skip_inner_expression - res = "" + res = String.new nest = 0 while (ch = getc) res << ch @@ -1263,7 +1263,7 @@ def skip_inner_expression def identify_comment @ltype = "#" - comment = "#" + comment = String.new("#") while ch = getc if ch == "\\" ch = getc @@ -1285,7 +1285,7 @@ def identify_comment end def read_escape - res = "" + res = String.new case ch = getc when /[0-7]/ ungetc ch diff --git a/lib/yard/parser/ruby/legacy/ruby_parser.rb b/lib/yard/parser/ruby/legacy/ruby_parser.rb index d5f41c0ff..9b12efeca 100644 --- a/lib/yard/parser/ruby/legacy/ruby_parser.rb +++ b/lib/yard/parser/ruby/legacy/ruby_parser.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Parser module Ruby diff --git a/lib/yard/parser/ruby/legacy/statement.rb b/lib/yard/parser/ruby/legacy/statement.rb index 7079cb441..b65abbdb5 100644 --- a/lib/yard/parser/ruby/legacy/statement.rb +++ b/lib/yard/parser/ruby/legacy/statement.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Parser::Ruby::Legacy class Statement diff --git a/lib/yard/parser/ruby/legacy/statement_list.rb b/lib/yard/parser/ruby/legacy/statement_list.rb index a4a76dfba..bc7876f1f 100644 --- a/lib/yard/parser/ruby/legacy/statement_list.rb +++ b/lib/yard/parser/ruby/legacy/statement_list.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Parser::Ruby::Legacy class StatementList < Array diff --git a/lib/yard/parser/ruby/legacy/token_list.rb b/lib/yard/parser/ruby/legacy/token_list.rb index 24a6fbdb0..05e15a892 100644 --- a/lib/yard/parser/ruby/legacy/token_list.rb +++ b/lib/yard/parser/ruby/legacy/token_list.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Parser::Ruby::Legacy class TokenList < Array diff --git a/lib/yard/parser/ruby/ruby_parser.rb b/lib/yard/parser/ruby/ruby_parser.rb index b599aeec7..8d6d5b468 100644 --- a/lib/yard/parser/ruby/ruby_parser.rb +++ b/lib/yard/parser/ruby/ruby_parser.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'ripper'; rescue LoadError; nil end module YARD @@ -545,7 +546,7 @@ def on_comment(comment) def on_embdoc_beg(text) visit_ns_token(:embdoc_beg, text) @embdoc_start = charno - text.length - @embdoc = "" + @embdoc = String.new("") end def on_embdoc(text) diff --git a/lib/yard/parser/ruby/token_resolver.rb b/lib/yard/parser/ruby/token_resolver.rb index 812f101dc..d0eacae38 100644 --- a/lib/yard/parser/ruby/token_resolver.rb +++ b/lib/yard/parser/ruby/token_resolver.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Parser module Ruby diff --git a/lib/yard/parser/source_parser.rb b/lib/yard/parser/source_parser.rb index f8616648c..a52fabdd1 100644 --- a/lib/yard/parser/source_parser.rb +++ b/lib/yard/parser/source_parser.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'stringio' require 'ostruct' @@ -72,7 +73,7 @@ class SourceParser # Byte order marks for various encodings # @since 0.7.0 ENCODING_BYTE_ORDER_MARKS = { - 'utf-8' => "\xEF\xBB\xBF", + 'utf-8' => String.new("\xEF\xBB\xBF"), # Not yet supported # 'utf-16be' => "\xFE\xFF", # 'utf-16le' => "\xFF\xFE", @@ -418,7 +419,7 @@ def parse(content = __FILE__) case content when String @file = File.cleanpath(content) - content = convert_encoding(File.read_binary(file)) + content = convert_encoding(String.new(File.read_binary(file))) checksum = Registry.checksum_for(content) return if Registry.checksums[file] == checksum diff --git a/lib/yard/rake/yardoc_task.rb b/lib/yard/rake/yardoc_task.rb index 1ebc4e541..a1597f5f9 100644 --- a/lib/yard/rake/yardoc_task.rb +++ b/lib/yard/rake/yardoc_task.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rake' require 'rake/tasklib' diff --git a/lib/yard/registry.rb b/lib/yard/registry.rb index e00166c08..14bfd774f 100644 --- a/lib/yard/registry.rb +++ b/lib/yard/registry.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'fileutils' require 'digest/sha1' diff --git a/lib/yard/registry_resolver.rb b/lib/yard/registry_resolver.rb index 879ff34a2..c362e8f38 100644 --- a/lib/yard/registry_resolver.rb +++ b/lib/yard/registry_resolver.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD # Handles all logic for complex lexical and inherited object resolution. # Used by {Registry.resolve}, so there is no need to use this class diff --git a/lib/yard/registry_store.rb b/lib/yard/registry_store.rb index 967a8a443..69a3345c2 100644 --- a/lib/yard/registry_store.rb +++ b/lib/yard/registry_store.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'fileutils' module YARD diff --git a/lib/yard/rubygems/backports.rb b/lib/yard/rubygems/backports.rb index a3f8e731e..8d915e2da 100644 --- a/lib/yard/rubygems/backports.rb +++ b/lib/yard/rubygems/backports.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'rubygems' if defined?(Gem::VERSION) && Gem::VERSION >= '1.8.0' diff --git a/lib/yard/rubygems/backports/gem.rb b/lib/yard/rubygems/backports/gem.rb index c36e9a5db..391fca894 100644 --- a/lib/yard/rubygems/backports/gem.rb +++ b/lib/yard/rubygems/backports/gem.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Gem class << self undef source_index if method_defined?(:source_index) diff --git a/lib/yard/rubygems/backports/source_index.rb b/lib/yard/rubygems/backports/source_index.rb index ed2a4607b..c3159503c 100644 --- a/lib/yard/rubygems/backports/source_index.rb +++ b/lib/yard/rubygems/backports/source_index.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true #-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. diff --git a/lib/yard/rubygems/doc_manager.rb b/lib/yard/rubygems/doc_manager.rb index 87f918df9..e33f442ab 100644 --- a/lib/yard/rubygems/doc_manager.rb +++ b/lib/yard/rubygems/doc_manager.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true begin require 'rubygems/user_interaction' require 'rubygems/doc_manager' diff --git a/lib/yard/rubygems/hook.rb b/lib/yard/rubygems/hook.rb index 4d41e5397..8c1c562b3 100644 --- a/lib/yard/rubygems/hook.rb +++ b/lib/yard/rubygems/hook.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rubygems' require 'rubygems/user_interaction' require 'fileutils' diff --git a/lib/yard/rubygems/specification.rb b/lib/yard/rubygems/specification.rb index 5685aa347..16bbb7eac 100644 --- a/lib/yard/rubygems/specification.rb +++ b/lib/yard/rubygems/specification.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rubygems/specification' class Gem::Specification diff --git a/lib/yard/serializers/base.rb b/lib/yard/serializers/base.rb index 69825c1ab..101ee0197 100644 --- a/lib/yard/serializers/base.rb +++ b/lib/yard/serializers/base.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Serializers # The abstract base serializer. Serializers allow templates to be diff --git a/lib/yard/serializers/file_system_serializer.rb b/lib/yard/serializers/file_system_serializer.rb index 3f0fcd7fb..c95f585f1 100644 --- a/lib/yard/serializers/file_system_serializer.rb +++ b/lib/yard/serializers/file_system_serializer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Serializers # Implements a serializer that reads from and writes to the filesystem. @@ -110,7 +111,7 @@ def mapped_name(object) def encode_path_components(*components) components.map! do |p| p.gsub(/[^\w\.-]/) do |x| - encoded = '_' + encoded = String.new('_') x.each_byte {|b| encoded << ("%X" % b) } encoded diff --git a/lib/yard/serializers/process_serializer.rb b/lib/yard/serializers/process_serializer.rb index 35638a952..8c5a626f1 100644 --- a/lib/yard/serializers/process_serializer.rb +++ b/lib/yard/serializers/process_serializer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Serializers # Serializes an object to a process (like less) diff --git a/lib/yard/serializers/stdout_serializer.rb b/lib/yard/serializers/stdout_serializer.rb index a6adb0a34..343b6ef7d 100644 --- a/lib/yard/serializers/stdout_serializer.rb +++ b/lib/yard/serializers/stdout_serializer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Serializers # A serializer that writes data to standard output. diff --git a/lib/yard/serializers/yardoc_serializer.rb b/lib/yard/serializers/yardoc_serializer.rb index 63ab2be32..a6fbb4062 100644 --- a/lib/yard/serializers/yardoc_serializer.rb +++ b/lib/yard/serializers/yardoc_serializer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD # Stubs marshal dumps and acts a delegate class for an object by path # diff --git a/lib/yard/server.rb b/lib/yard/server.rb index ea0d3c2d9..b8f323a0e 100644 --- a/lib/yard/server.rb +++ b/lib/yard/server.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Server # Registers a static path to be used in static asset lookup. diff --git a/lib/yard/server/adapter.rb b/lib/yard/server/adapter.rb index 3fc63ad14..0dced5f80 100644 --- a/lib/yard/server/adapter.rb +++ b/lib/yard/server/adapter.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Server # Short circuits a request by raising an error. This exception is caught diff --git a/lib/yard/server/commands/base.rb b/lib/yard/server/commands/base.rb index db6a084dd..d32662651 100644 --- a/lib/yard/server/commands/base.rb +++ b/lib/yard/server/commands/base.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'fileutils' module YARD diff --git a/lib/yard/server/commands/display_file_command.rb b/lib/yard/server/commands/display_file_command.rb index a7723b8a8..859aa5d90 100644 --- a/lib/yard/server/commands/display_file_command.rb +++ b/lib/yard/server/commands/display_file_command.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Server module Commands diff --git a/lib/yard/server/commands/display_object_command.rb b/lib/yard/server/commands/display_object_command.rb index 4a70c84d0..3f2e7e246 100644 --- a/lib/yard/server/commands/display_object_command.rb +++ b/lib/yard/server/commands/display_object_command.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Server module Commands diff --git a/lib/yard/server/commands/frames_command.rb b/lib/yard/server/commands/frames_command.rb index 53251e72f..a895e25f2 100644 --- a/lib/yard/server/commands/frames_command.rb +++ b/lib/yard/server/commands/frames_command.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Server module Commands diff --git a/lib/yard/server/commands/library_command.rb b/lib/yard/server/commands/library_command.rb index 275801ebe..34b84d89b 100644 --- a/lib/yard/server/commands/library_command.rb +++ b/lib/yard/server/commands/library_command.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'thread' module YARD diff --git a/lib/yard/server/commands/library_index_command.rb b/lib/yard/server/commands/library_index_command.rb index 88b5a1689..b26eae19b 100644 --- a/lib/yard/server/commands/library_index_command.rb +++ b/lib/yard/server/commands/library_index_command.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Server module Commands diff --git a/lib/yard/server/commands/list_command.rb b/lib/yard/server/commands/list_command.rb index 86718b7c7..cdaacd256 100644 --- a/lib/yard/server/commands/list_command.rb +++ b/lib/yard/server/commands/list_command.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Server module Commands diff --git a/lib/yard/server/commands/root_request_command.rb b/lib/yard/server/commands/root_request_command.rb index 8d4085318..c6164dac0 100644 --- a/lib/yard/server/commands/root_request_command.rb +++ b/lib/yard/server/commands/root_request_command.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Server module Commands diff --git a/lib/yard/server/commands/search_command.rb b/lib/yard/server/commands/search_command.rb index fb631c644..433514b47 100644 --- a/lib/yard/server/commands/search_command.rb +++ b/lib/yard/server/commands/search_command.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Server module Commands diff --git a/lib/yard/server/commands/static_file_command.rb b/lib/yard/server/commands/static_file_command.rb index 2c91b5afc..c7f4b7e68 100644 --- a/lib/yard/server/commands/static_file_command.rb +++ b/lib/yard/server/commands/static_file_command.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Server module Commands diff --git a/lib/yard/server/commands/static_file_helpers.rb b/lib/yard/server/commands/static_file_helpers.rb index 29a2d2918..9576b9b2d 100644 --- a/lib/yard/server/commands/static_file_helpers.rb +++ b/lib/yard/server/commands/static_file_helpers.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'webrick/httputils' module YARD diff --git a/lib/yard/server/doc_server_helper.rb b/lib/yard/server/doc_server_helper.rb index e3f27df79..9256afcaf 100644 --- a/lib/yard/server/doc_server_helper.rb +++ b/lib/yard/server/doc_server_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Server # A module that is mixed into {Templates::Template} in order to customize diff --git a/lib/yard/server/doc_server_serializer.rb b/lib/yard/server/doc_server_serializer.rb index 90426d1fb..131cda807 100644 --- a/lib/yard/server/doc_server_serializer.rb +++ b/lib/yard/server/doc_server_serializer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Server # A custom {Serializers::Base serializer} which returns resource URLs instead of diff --git a/lib/yard/server/library_version.rb b/lib/yard/server/library_version.rb index 49f90cda2..d5f552149 100644 --- a/lib/yard/server/library_version.rb +++ b/lib/yard/server/library_version.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'fileutils' require 'thread' diff --git a/lib/yard/server/rack_adapter.rb b/lib/yard/server/rack_adapter.rb index 0f689444f..0fadf8ede 100644 --- a/lib/yard/server/rack_adapter.rb +++ b/lib/yard/server/rack_adapter.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rack' require 'webrick/httputils' diff --git a/lib/yard/server/router.rb b/lib/yard/server/router.rb index 8950d0295..c12753ceb 100644 --- a/lib/yard/server/router.rb +++ b/lib/yard/server/router.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Server # A router class implements the logic used to recognize a request for a specific diff --git a/lib/yard/server/static_caching.rb b/lib/yard/server/static_caching.rb index f78563187..ca43b15ac 100644 --- a/lib/yard/server/static_caching.rb +++ b/lib/yard/server/static_caching.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Server # Implements static caching for requests. diff --git a/lib/yard/server/templates/default/layout/html/setup.rb b/lib/yard/server/templates/default/layout/html/setup.rb index ff5aa2f56..e81992a9f 100644 --- a/lib/yard/server/templates/default/layout/html/setup.rb +++ b/lib/yard/server/templates/default/layout/html/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true def javascripts super + %w(js/autocomplete.js) end diff --git a/lib/yard/server/templates/default/method_details/html/setup.rb b/lib/yard/server/templates/default/method_details/html/setup.rb index 8b27de139..42520913b 100644 --- a/lib/yard/server/templates/default/method_details/html/setup.rb +++ b/lib/yard/server/templates/default/method_details/html/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true def init super sections.place(:permalink).after_any(:method_signature) diff --git a/lib/yard/server/templates/doc_server/library_list/html/setup.rb b/lib/yard/server/templates/doc_server/library_list/html/setup.rb index cb8c3c217..a13cdeac6 100644 --- a/lib/yard/server/templates/doc_server/library_list/html/setup.rb +++ b/lib/yard/server/templates/doc_server/library_list/html/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true include T('default/layout/html') def init diff --git a/lib/yard/server/templates/doc_server/processing/html/setup.rb b/lib/yard/server/templates/doc_server/processing/html/setup.rb index c36b9fcdf..3d200ef00 100644 --- a/lib/yard/server/templates/doc_server/processing/html/setup.rb +++ b/lib/yard/server/templates/doc_server/processing/html/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true def init sections :processing end diff --git a/lib/yard/server/templates/doc_server/search/html/setup.rb b/lib/yard/server/templates/doc_server/search/html/setup.rb index 2687a41f8..d4483a5da 100644 --- a/lib/yard/server/templates/doc_server/search/html/setup.rb +++ b/lib/yard/server/templates/doc_server/search/html/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true def init sections :search, [T('../default/layout')] end diff --git a/lib/yard/server/webrick_adapter.rb b/lib/yard/server/webrick_adapter.rb index 63ba733ae..568e22fd8 100644 --- a/lib/yard/server/webrick_adapter.rb +++ b/lib/yard/server/webrick_adapter.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'webrick' module YARD diff --git a/lib/yard/tags/default_factory.rb b/lib/yard/tags/default_factory.rb index b1d3357ca..5bb69da9e 100644 --- a/lib/yard/tags/default_factory.rb +++ b/lib/yard/tags/default_factory.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Tags class DefaultFactory @@ -136,8 +137,8 @@ def extract_types_and_name_from_text(text, opening_types = TYPELIST_OPENING_CHAR def extract_types_and_name_from_text_unstripped(text, opening_types = TYPELIST_OPENING_CHARS, closing_types = TYPELIST_CLOSING_CHARS) e = 0 - before = '' - list = [''] + before = String.new("") + list = [String.new("")] level = 0 seen_space = false i = 0 @@ -163,7 +164,7 @@ def extract_types_and_name_from_text_unstripped(text, opening_types = TYPELIST_O break e = i if level == 0 list.last << c elsif c == ',' && level == 1 - list.push '' + list.push String.new("") elsif c =~ /\S/ && level == 0 break e = i if seen_space && list == [''] before << c diff --git a/lib/yard/tags/default_tag.rb b/lib/yard/tags/default_tag.rb index 4c3bf41bc..c04f59df0 100644 --- a/lib/yard/tags/default_tag.rb +++ b/lib/yard/tags/default_tag.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Tags class DefaultTag < Tag diff --git a/lib/yard/tags/directives.rb b/lib/yard/tags/directives.rb index 65bf8af17..a635bc3d7 100644 --- a/lib/yard/tags/directives.rb +++ b/lib/yard/tags/directives.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'ostruct' module YARD diff --git a/lib/yard/tags/library.rb b/lib/yard/tags/library.rb index 0bc5b53d9..9cfc1d3e1 100644 --- a/lib/yard/tags/library.rb +++ b/lib/yard/tags/library.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Tags # Keeps track of all the registered meta-data tags and directives. diff --git a/lib/yard/tags/option_tag.rb b/lib/yard/tags/option_tag.rb index 5c478cfa1..a63c8a96d 100644 --- a/lib/yard/tags/option_tag.rb +++ b/lib/yard/tags/option_tag.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Tags class OptionTag < Tag diff --git a/lib/yard/tags/overload_tag.rb b/lib/yard/tags/overload_tag.rb index bf1b29173..2d7ec6ae1 100644 --- a/lib/yard/tags/overload_tag.rb +++ b/lib/yard/tags/overload_tag.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Tags class OverloadTag < Tag @@ -42,7 +43,7 @@ def is_a?(other) def parse_tag(text) @signature, text = *text.split(/\r?\n/, 2) @signature.strip! - text ||= "" + text ||= String.new("") numspaces = text[/\A(\s*)/, 1].length text.gsub!(/^[ \t]{#{numspaces}}/, '') text.strip! diff --git a/lib/yard/tags/ref_tag.rb b/lib/yard/tags/ref_tag.rb index 8d7d7f9c3..0d1ebd744 100644 --- a/lib/yard/tags/ref_tag.rb +++ b/lib/yard/tags/ref_tag.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Tags module RefTag diff --git a/lib/yard/tags/ref_tag_list.rb b/lib/yard/tags/ref_tag_list.rb index 46381dbf5..933e9e6e3 100644 --- a/lib/yard/tags/ref_tag_list.rb +++ b/lib/yard/tags/ref_tag_list.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Tags class RefTagList diff --git a/lib/yard/tags/tag.rb b/lib/yard/tags/tag.rb index e9c0556e6..516b2910b 100644 --- a/lib/yard/tags/tag.rb +++ b/lib/yard/tags/tag.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Tags # Represents a metadata tag value (+@tag+). Tags can have any combination of diff --git a/lib/yard/tags/tag_format_error.rb b/lib/yard/tags/tag_format_error.rb index b86662f10..51f276f81 100644 --- a/lib/yard/tags/tag_format_error.rb +++ b/lib/yard/tags/tag_format_error.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Tags class TagFormatError < RuntimeError diff --git a/lib/yard/tags/types_explainer.rb b/lib/yard/tags/types_explainer.rb index da0862cb9..1ac5c4dca 100644 --- a/lib/yard/tags/types_explainer.rb +++ b/lib/yard/tags/types_explainer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'strscan' module YARD @@ -43,7 +44,7 @@ def to_s(singular = true) def list_join(list) index = 0 - list.inject("") do |acc, el| + list.inject(String.new) do |acc, el| acc << el.to_s acc << ", " if index < list.size - 2 acc << " or " if index == list.size - 2 diff --git a/lib/yard/templates/engine.rb b/lib/yard/templates/engine.rb index 7001bd096..1f5570700 100644 --- a/lib/yard/templates/engine.rb +++ b/lib/yard/templates/engine.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'ostruct' module YARD diff --git a/lib/yard/templates/erb_cache.rb b/lib/yard/templates/erb_cache.rb index 199df571c..ffdf34e30 100644 --- a/lib/yard/templates/erb_cache.rb +++ b/lib/yard/templates/erb_cache.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Templates # @since 0.5.4 diff --git a/lib/yard/templates/helpers/base_helper.rb b/lib/yard/templates/helpers/base_helper.rb index 07292d9c0..42c4e6b0c 100644 --- a/lib/yard/templates/helpers/base_helper.rb +++ b/lib/yard/templates/helpers/base_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD::Templates::Helpers # The base helper module included in all templates. module BaseHelper diff --git a/lib/yard/templates/helpers/filter_helper.rb b/lib/yard/templates/helpers/filter_helper.rb index 532e2ed00..707fb0cee 100644 --- a/lib/yard/templates/helpers/filter_helper.rb +++ b/lib/yard/templates/helpers/filter_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Templates::Helpers # Helpers for various object types diff --git a/lib/yard/templates/helpers/html_helper.rb b/lib/yard/templates/helpers/html_helper.rb index 73a0883a2..4d24d95ae 100644 --- a/lib/yard/templates/helpers/html_helper.rb +++ b/lib/yard/templates/helpers/html_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'cgi' module YARD @@ -25,6 +26,7 @@ def h(text) # @param [String] text the URL # @return [String] the escaped URL def urlencode(text) + text = text.dup enc = nil if text.respond_to?(:force_encoding) enc = text.encoding @@ -54,7 +56,7 @@ def htmlify(text, markup = options.markup) return text unless respond_to?(markup_meth) return "" unless text return text unless markup - html = send(markup_meth, text) + html = send(markup_meth, text).dup if html.respond_to?(:encode) html = html.force_encoding(text.encoding) # for libs that mess with encoding html = html.encode(:invalid => :replace, :replace => '?') @@ -308,7 +310,7 @@ def link_object(obj, title = nil, anchor = nil, relative = true) # (see BaseHelper#link_url) def link_url(url, title = nil, params = {}) title ||= url - title.gsub!(/[\r\n]/, ' ') + title = title.gsub(/[\r\n]/, ' ') params = SymbolHash.new(false).update( :href => url, :title => h(title) diff --git a/lib/yard/templates/helpers/html_syntax_highlight_helper.rb b/lib/yard/templates/helpers/html_syntax_highlight_helper.rb index 9c035ca73..fc5c60cee 100644 --- a/lib/yard/templates/helpers/html_syntax_highlight_helper.rb +++ b/lib/yard/templates/helpers/html_syntax_highlight_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Templates module Helpers @@ -20,7 +21,7 @@ def html_syntax_highlight_ruby(source) def html_syntax_highlight_ruby_ripper(source) resolver = Parser::Ruby::TokenResolver.new(source, object) - output = "" + output = String.new("") resolver.each do |s, token_obj| token_obj = clean_token_object(token_obj) output << "" if [:tstring_beg, :regexp_beg].include?(s[0]) diff --git a/lib/yard/templates/helpers/markup/rdoc_markdown.rb b/lib/yard/templates/helpers/markup/rdoc_markdown.rb index 771625e82..03f9645fb 100644 --- a/lib/yard/templates/helpers/markup/rdoc_markdown.rb +++ b/lib/yard/templates/helpers/markup/rdoc_markdown.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Templates module Helpers diff --git a/lib/yard/templates/helpers/markup/rdoc_markup.rb b/lib/yard/templates/helpers/markup/rdoc_markup.rb index 62d583984..e3b986dac 100644 --- a/lib/yard/templates/helpers/markup/rdoc_markup.rb +++ b/lib/yard/templates/helpers/markup/rdoc_markup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'thread' module YARD diff --git a/lib/yard/templates/helpers/markup_helper.rb b/lib/yard/templates/helpers/markup_helper.rb index b9344d3eb..5ff0c1824 100644 --- a/lib/yard/templates/helpers/markup_helper.rb +++ b/lib/yard/templates/helpers/markup_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rubygems' module YARD diff --git a/lib/yard/templates/helpers/method_helper.rb b/lib/yard/templates/helpers/method_helper.rb index f7495b7e5..2bae46602 100644 --- a/lib/yard/templates/helpers/method_helper.rb +++ b/lib/yard/templates/helpers/method_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Templates::Helpers # Helper methods for method objects. diff --git a/lib/yard/templates/helpers/module_helper.rb b/lib/yard/templates/helpers/module_helper.rb index df53c7a1f..e464b9459 100644 --- a/lib/yard/templates/helpers/module_helper.rb +++ b/lib/yard/templates/helpers/module_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Templates module Helpers diff --git a/lib/yard/templates/helpers/text_helper.rb b/lib/yard/templates/helpers/text_helper.rb index c5eacddc3..7d829afda 100644 --- a/lib/yard/templates/helpers/text_helper.rb +++ b/lib/yard/templates/helpers/text_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Templates module Helpers @@ -5,7 +6,7 @@ module Helpers module TextHelper # @return [String] escapes text def h(text) - out = "" + out = String.new("") text = resolve_links(text) text = text.split(/\n/) text.each_with_index do |line, i| diff --git a/lib/yard/templates/helpers/uml_helper.rb b/lib/yard/templates/helpers/uml_helper.rb index 5557ea9f0..a295ace17 100644 --- a/lib/yard/templates/helpers/uml_helper.rb +++ b/lib/yard/templates/helpers/uml_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Templates::Helpers # Helpers for UML template format diff --git a/lib/yard/templates/section.rb b/lib/yard/templates/section.rb index 2e28b2736..e8674efe5 100644 --- a/lib/yard/templates/section.rb +++ b/lib/yard/templates/section.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD module Templates # Abstracts the structure for a section and its subsections into an ordered diff --git a/lib/yard/templates/template.rb b/lib/yard/templates/template.rb index 0d699243d..2ba4c3e12 100644 --- a/lib/yard/templates/template.rb +++ b/lib/yard/templates/template.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'erb' module YARD @@ -247,7 +248,7 @@ def init # @yieldparam [Hash] opts any extra options to yield # @return [String] the rendered sections joined together def run(opts = nil, sects = sections, start_at = 0, break_first = false, &block) - out = "" + out = String.new("") return out if sects.nil? sects = sects[start_at..-1] if start_at > 0 sects = Section.new(nil, sects) unless sects.is_a?(Section) diff --git a/lib/yard/templates/template_options.rb b/lib/yard/templates/template_options.rb index 5fcf55c86..98cee3458 100644 --- a/lib/yard/templates/template_options.rb +++ b/lib/yard/templates/template_options.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'ostruct' module YARD diff --git a/lib/yard/verifier.rb b/lib/yard/verifier.rb index 8f40437a2..f58e1e23c 100644 --- a/lib/yard/verifier.rb +++ b/lib/yard/verifier.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD # Similar to a Proc, but runs a set of Ruby expressions using a small # DSL to make tag lookups easier. diff --git a/lib/yard/version.rb b/lib/yard/version.rb index 1fd0dd3cc..6c067f36a 100644 --- a/lib/yard/version.rb +++ b/lib/yard/version.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module YARD VERSION = '0.9.5' end diff --git a/spec/cli/command_parser_spec.rb b/spec/cli/command_parser_spec.rb index 0aa5ccdc1..dc3ca3797 100644 --- a/spec/cli/command_parser_spec.rb +++ b/spec/cli/command_parser_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe YARD::CLI::CommandParser do diff --git a/spec/cli/command_spec.rb b/spec/cli/command_spec.rb index 273edc0e1..2bb3f0d46 100644 --- a/spec/cli/command_spec.rb +++ b/spec/cli/command_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + "/../spec_helper" require 'optparse' diff --git a/spec/cli/config_spec.rb b/spec/cli/config_spec.rb index 7910a0b66..4bd40121a 100644 --- a/spec/cli/config_spec.rb +++ b/spec/cli/config_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' require 'yaml' diff --git a/spec/cli/diff_spec.rb b/spec/cli/diff_spec.rb index 147e2d8cc..cb4027e19 100644 --- a/spec/cli/diff_spec.rb +++ b/spec/cli/diff_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' require 'stringio' require 'open-uri' diff --git a/spec/cli/display_spec.rb b/spec/cli/display_spec.rb index bbe10c8f3..a5359da96 100644 --- a/spec/cli/display_spec.rb +++ b/spec/cli/display_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe YARD::CLI::Display do diff --git a/spec/cli/gems_spec.rb b/spec/cli/gems_spec.rb index 2906ba0a1..0ed824902 100644 --- a/spec/cli/gems_spec.rb +++ b/spec/cli/gems_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' require 'ostruct' require 'rubygems' diff --git a/spec/cli/graph_spec.rb b/spec/cli/graph_spec.rb index 442a85864..f46f4286c 100644 --- a/spec/cli/graph_spec.rb +++ b/spec/cli/graph_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe YARD::CLI::Graph do diff --git a/spec/cli/help_spec.rb b/spec/cli/help_spec.rb index f4b0572a7..92e2b20a6 100644 --- a/spec/cli/help_spec.rb +++ b/spec/cli/help_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe YARD::CLI::Help do diff --git a/spec/cli/i18n_spec.rb b/spec/cli/i18n_spec.rb index c496c6ef1..889d0716c 100644 --- a/spec/cli/i18n_spec.rb +++ b/spec/cli/i18n_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe YARD::CLI::I18n do diff --git a/spec/cli/list_spec.rb b/spec/cli/list_spec.rb index fd9c6f6ab..5852e2b0b 100644 --- a/spec/cli/list_spec.rb +++ b/spec/cli/list_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe YARD::CLI::List do diff --git a/spec/cli/markup_types_spec.rb b/spec/cli/markup_types_spec.rb index 6f876ee0b..9e3290706 100644 --- a/spec/cli/markup_types_spec.rb +++ b/spec/cli/markup_types_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe YARD::CLI::MarkupTypes do diff --git a/spec/cli/server_spec.rb b/spec/cli/server_spec.rb index 81c5be9fc..e64777bb6 100644 --- a/spec/cli/server_spec.rb +++ b/spec/cli/server_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' class Server::WebrickAdapter; def start; end end diff --git a/spec/cli/stats_spec.rb b/spec/cli/stats_spec.rb index 5ee80ad3c..e7603522a 100644 --- a/spec/cli/stats_spec.rb +++ b/spec/cli/stats_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' require 'stringio' diff --git a/spec/cli/yardoc_spec.rb b/spec/cli/yardoc_spec.rb index 20793fb60..4fc17d8a9 100644 --- a/spec/cli/yardoc_spec.rb +++ b/spec/cli/yardoc_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe YARD::CLI::Yardoc do @@ -507,7 +508,7 @@ def foo; end end it "uses String#shell_split to split .yardopts tokens" do - optsdata = "foo bar" + optsdata = String.new("foo bar") expect(optsdata).to receive(:shell_split) expect(File).to receive(:read_binary).with("test").and_return(optsdata) @yardoc.options_file = "test" diff --git a/spec/cli/yri_spec.rb b/spec/cli/yri_spec.rb index a0650634e..0a98e3ead 100644 --- a/spec/cli/yri_spec.rb +++ b/spec/cli/yri_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' class TestYRI < YARD::CLI::YRI diff --git a/spec/code_objects/base_spec.rb b/spec/code_objects/base_spec.rb index 383f70c7b..b4f7ae187 100644 --- a/spec/code_objects/base_spec.rb +++ b/spec/code_objects/base_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::CodeObjects::Base do diff --git a/spec/code_objects/class_object_spec.rb b/spec/code_objects/class_object_spec.rb index 1f02164b1..8f8fbe07f 100644 --- a/spec/code_objects/class_object_spec.rb +++ b/spec/code_objects/class_object_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::CodeObjects::ClassObject do diff --git a/spec/code_objects/code_object_list_spec.rb b/spec/code_objects/code_object_list_spec.rb index 6167cefab..4f98ba4d4 100644 --- a/spec/code_objects/code_object_list_spec.rb +++ b/spec/code_objects/code_object_list_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::CodeObjects::CodeObjectList do diff --git a/spec/code_objects/constants_spec.rb b/spec/code_objects/constants_spec.rb index 0efb8b14b..5bda7f879 100644 --- a/spec/code_objects/constants_spec.rb +++ b/spec/code_objects/constants_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::CodeObjects do diff --git a/spec/code_objects/extra_file_object_spec.rb b/spec/code_objects/extra_file_object_spec.rb index 1ccf2412d..330392618 100644 --- a/spec/code_objects/extra_file_object_spec.rb +++ b/spec/code_objects/extra_file_object_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::CodeObjects::ExtraFileObject do @@ -80,7 +81,7 @@ it "forces encoding to @encoding attribute if present" do expect(log).not_to receive(:warn) - data = "# @encoding sjis\nFOO" + data = String.new("# @encoding sjis\nFOO") data.force_encoding('binary') file = ExtraFileObject.new('file.txt', data) expect(['Shift_JIS', 'Windows-31J']).to include(file.contents.encoding.to_s) @@ -88,7 +89,7 @@ it "warns if @encoding is invalid" do expect(log).to receive(:warn).with("Invalid encoding `INVALID' in file.txt") - data = "# @encoding INVALID\nFOO" + data = String.new("# @encoding INVALID\nFOO") encoding = data.encoding file = ExtraFileObject.new('file.txt', data) expect(file.contents.encoding).to eq encoding @@ -101,7 +102,7 @@ it "attempts to re-parse data as 8-bit ascii if parsing fails" do expect(log).not_to receive(:warn) - str, out = *(["\xB0"] * 2) + str, out = *([String.new("\xB0")] * 2) if str.respond_to?(:force_encoding) str.force_encoding('utf-8') out.force_encoding('binary') diff --git a/spec/code_objects/macro_object_spec.rb b/spec/code_objects/macro_object_spec.rb index c619dd387..bcbe59442 100644 --- a/spec/code_objects/macro_object_spec.rb +++ b/spec/code_objects/macro_object_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::CodeObjects::MacroObject do diff --git a/spec/code_objects/method_object_spec.rb b/spec/code_objects/method_object_spec.rb index 2a4657257..7d9e832a8 100644 --- a/spec/code_objects/method_object_spec.rb +++ b/spec/code_objects/method_object_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::CodeObjects::MethodObject do diff --git a/spec/code_objects/module_object_spec.rb b/spec/code_objects/module_object_spec.rb index ba67a17b0..bbf0aa582 100644 --- a/spec/code_objects/module_object_spec.rb +++ b/spec/code_objects/module_object_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::CodeObjects::ModuleObject do diff --git a/spec/code_objects/namespace_object_spec.rb b/spec/code_objects/namespace_object_spec.rb index 963eb54df..3a496d7d9 100644 --- a/spec/code_objects/namespace_object_spec.rb +++ b/spec/code_objects/namespace_object_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::CodeObjects::NamespaceObject do diff --git a/spec/code_objects/proxy_spec.rb b/spec/code_objects/proxy_spec.rb index b958444ec..32a7a18f5 100644 --- a/spec/code_objects/proxy_spec.rb +++ b/spec/code_objects/proxy_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::CodeObjects::Proxy do diff --git a/spec/code_objects/spec_helper.rb b/spec/code_objects/spec_helper.rb index 5473dc3d8..5f0a2ee7b 100644 --- a/spec/code_objects/spec_helper.rb +++ b/spec/code_objects/spec_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.join(File.dirname(__FILE__), "..", "spec_helper") include CodeObjects diff --git a/spec/config_spec.rb b/spec/config_spec.rb index f3c29a076..3103ee7b1 100644 --- a/spec/config_spec.rb +++ b/spec/config_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.join(File.dirname(__FILE__), "spec_helper") require 'yaml' diff --git a/spec/core_ext/array_spec.rb b/spec/core_ext/array_spec.rb index a979722dd..869f703e7 100644 --- a/spec/core_ext/array_spec.rb +++ b/spec/core_ext/array_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe Array do diff --git a/spec/core_ext/file_spec.rb b/spec/core_ext/file_spec.rb index 06e733814..0aa8d8867 100644 --- a/spec/core_ext/file_spec.rb +++ b/spec/core_ext/file_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe File do diff --git a/spec/core_ext/hash_spec.rb b/spec/core_ext/hash_spec.rb index 6be0035c8..1116475bf 100644 --- a/spec/core_ext/hash_spec.rb +++ b/spec/core_ext/hash_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe Hash do diff --git a/spec/core_ext/insertion_spec.rb b/spec/core_ext/insertion_spec.rb index 05dfe91a3..661b72bbd 100644 --- a/spec/core_ext/insertion_spec.rb +++ b/spec/core_ext/insertion_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe Insertion do diff --git a/spec/core_ext/module_spec.rb b/spec/core_ext/module_spec.rb index 18d568320..97737ef8a 100644 --- a/spec/core_ext/module_spec.rb +++ b/spec/core_ext/module_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe Module do diff --git a/spec/core_ext/string_spec.rb b/spec/core_ext/string_spec.rb index f06fdc12c..fbc49f3fc 100644 --- a/spec/core_ext/string_spec.rb +++ b/spec/core_ext/string_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' # described_in_docs String, '#camelcase' diff --git a/spec/core_ext/symbol_hash_spec.rb b/spec/core_ext/symbol_hash_spec.rb index 160cb6318..02304ce98 100644 --- a/spec/core_ext/symbol_hash_spec.rb +++ b/spec/core_ext/symbol_hash_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.join(File.dirname(__FILE__), '..', 'spec_helper') describe SymbolHash do diff --git a/spec/docstring_parser_spec.rb b/spec/docstring_parser_spec.rb index f5b35e342..948750664 100644 --- a/spec/docstring_parser_spec.rb +++ b/spec/docstring_parser_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + "/spec_helper" describe YARD::DocstringParser do diff --git a/spec/docstring_spec.rb b/spec/docstring_spec.rb index 5fc4efc46..48aa2c47b 100644 --- a/spec/docstring_spec.rb +++ b/spec/docstring_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::Docstring do diff --git a/spec/handlers/alias_handler_spec.rb b/spec/handlers/alias_handler_spec.rb index 41f89ccab..1e1a319a2 100644 --- a/spec/handlers/alias_handler_spec.rb +++ b/spec/handlers/alias_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}AliasHandler" do diff --git a/spec/handlers/attribute_handler_spec.rb b/spec/handlers/attribute_handler_spec.rb index 0148987a1..c56af6160 100644 --- a/spec/handlers/attribute_handler_spec.rb +++ b/spec/handlers/attribute_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}AttributeHandler" do diff --git a/spec/handlers/base_spec.rb b/spec/handlers/base_spec.rb index 664c419e4..4f4143243 100644 --- a/spec/handlers/base_spec.rb +++ b/spec/handlers/base_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' require 'ostruct' diff --git a/spec/handlers/c/alias_handler_spec.rb b/spec/handlers/c/alias_handler_spec.rb index 50d6ed71f..479c94933 100644 --- a/spec/handlers/c/alias_handler_spec.rb +++ b/spec/handlers/c/alias_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + "/spec_helper" describe YARD::Handlers::C::AliasHandler do diff --git a/spec/handlers/c/attribute_handler_spec.rb b/spec/handlers/c/attribute_handler_spec.rb index 36c1103ef..6dab510fd 100644 --- a/spec/handlers/c/attribute_handler_spec.rb +++ b/spec/handlers/c/attribute_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + "/spec_helper" describe YARD::Handlers::C::AttributeHandler do diff --git a/spec/handlers/c/class_handler_spec.rb b/spec/handlers/c/class_handler_spec.rb index 4a9843d6f..57e3e808e 100644 --- a/spec/handlers/c/class_handler_spec.rb +++ b/spec/handlers/c/class_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + "/spec_helper" describe YARD::Handlers::C::ClassHandler do diff --git a/spec/handlers/c/constant_handler_spec.rb b/spec/handlers/c/constant_handler_spec.rb index 0bc7acaa8..6b4cf3b9e 100644 --- a/spec/handlers/c/constant_handler_spec.rb +++ b/spec/handlers/c/constant_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + "/spec_helper" describe YARD::Handlers::C::ConstantHandler do diff --git a/spec/handlers/c/init_handler_spec.rb b/spec/handlers/c/init_handler_spec.rb index 7d83245fa..efde82f02 100644 --- a/spec/handlers/c/init_handler_spec.rb +++ b/spec/handlers/c/init_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + "/spec_helper" describe YARD::Handlers::C::InitHandler do diff --git a/spec/handlers/c/method_handler_spec.rb b/spec/handlers/c/method_handler_spec.rb index 7a16b21ad..0bb32b26d 100644 --- a/spec/handlers/c/method_handler_spec.rb +++ b/spec/handlers/c/method_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + "/spec_helper" describe YARD::Handlers::C::MethodHandler do diff --git a/spec/handlers/c/mixin_handler_spec.rb b/spec/handlers/c/mixin_handler_spec.rb index ed31c2640..cc152f0b0 100644 --- a/spec/handlers/c/mixin_handler_spec.rb +++ b/spec/handlers/c/mixin_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + "/spec_helper" describe YARD::Handlers::C::MixinHandler do diff --git a/spec/handlers/c/module_handler_spec.rb b/spec/handlers/c/module_handler_spec.rb index 44f9921a8..ebb8079f6 100644 --- a/spec/handlers/c/module_handler_spec.rb +++ b/spec/handlers/c/module_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + "/spec_helper" describe YARD::Handlers::C::ClassHandler do diff --git a/spec/handlers/c/override_comment_handler_spec.rb b/spec/handlers/c/override_comment_handler_spec.rb index 862d34ff7..adc390a8f 100644 --- a/spec/handlers/c/override_comment_handler_spec.rb +++ b/spec/handlers/c/override_comment_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + "/spec_helper" describe YARD::Handlers::C::OverrideCommentHandler do diff --git a/spec/handlers/c/path_handler_spec.rb b/spec/handlers/c/path_handler_spec.rb index fe7108cf2..ca57e1b80 100644 --- a/spec/handlers/c/path_handler_spec.rb +++ b/spec/handlers/c/path_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + "/spec_helper" describe YARD::Handlers::C::PathHandler do diff --git a/spec/handlers/c/spec_helper.rb b/spec/handlers/c/spec_helper.rb index 7b454a93e..4b5df9cb3 100644 --- a/spec/handlers/c/spec_helper.rb +++ b/spec/handlers/c/spec_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + "/../spec_helper" def parse(src, file = '(stdin)') diff --git a/spec/handlers/c/struct_handler_spec.rb b/spec/handlers/c/struct_handler_spec.rb index e030cb6c6..b59fcefb5 100644 --- a/spec/handlers/c/struct_handler_spec.rb +++ b/spec/handlers/c/struct_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::Handlers::C::StructHandler do diff --git a/spec/handlers/class_condition_handler_spec.rb b/spec/handlers/class_condition_handler_spec.rb index eb5503919..f374cd673 100644 --- a/spec/handlers/class_condition_handler_spec.rb +++ b/spec/handlers/class_condition_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}ClassConditionHandler" do diff --git a/spec/handlers/class_handler_spec.rb b/spec/handlers/class_handler_spec.rb index 6e093ee88..a0f625009 100644 --- a/spec/handlers/class_handler_spec.rb +++ b/spec/handlers/class_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}ClassHandler" do diff --git a/spec/handlers/class_method_handler_shared_examples.rb b/spec/handlers/class_method_handler_shared_examples.rb index eb176a8e6..6d13ac7ee 100644 --- a/spec/handlers/class_method_handler_shared_examples.rb +++ b/spec/handlers/class_method_handler_shared_examples.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true shared_examples "class method visibility decorator" do # Use let(:visibility) to specify the name of the x_class_method # visibility decorator to test. diff --git a/spec/handlers/class_variable_handler_spec.rb b/spec/handlers/class_variable_handler_spec.rb index 117807fc8..7b0812617 100644 --- a/spec/handlers/class_variable_handler_spec.rb +++ b/spec/handlers/class_variable_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}ClassVariableHandler" do diff --git a/spec/handlers/constant_handler_spec.rb b/spec/handlers/constant_handler_spec.rb index c92e19370..345652c18 100644 --- a/spec/handlers/constant_handler_spec.rb +++ b/spec/handlers/constant_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}ConstantHandler" do diff --git a/spec/handlers/decorator_handler_methods_spec.rb b/spec/handlers/decorator_handler_methods_spec.rb index 0533b2fa8..b87e75889 100644 --- a/spec/handlers/decorator_handler_methods_spec.rb +++ b/spec/handlers/decorator_handler_methods_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe "YARD::Handlers::Ruby::DecoratorHandlerMethods" do diff --git a/spec/handlers/dsl_handler_spec.rb b/spec/handlers/dsl_handler_spec.rb index 83dc21db2..21c40bede 100644 --- a/spec/handlers/dsl_handler_spec.rb +++ b/spec/handlers/dsl_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' require 'ostruct' diff --git a/spec/handlers/exception_handler_spec.rb b/spec/handlers/exception_handler_spec.rb index 2a4fa2adb..aac4f7378 100644 --- a/spec/handlers/exception_handler_spec.rb +++ b/spec/handlers/exception_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}ExceptionHandler" do diff --git a/spec/handlers/extend_handler_spec.rb b/spec/handlers/extend_handler_spec.rb index 3fde2616e..13bfedbf4 100644 --- a/spec/handlers/extend_handler_spec.rb +++ b/spec/handlers/extend_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}ExtendHandler" do diff --git a/spec/handlers/legacy_base_spec.rb b/spec/handlers/legacy_base_spec.rb index e6fbfd7a0..d7d1a793c 100644 --- a/spec/handlers/legacy_base_spec.rb +++ b/spec/handlers/legacy_base_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' include Parser::Ruby::Legacy diff --git a/spec/handlers/method_condition_handler_spec.rb b/spec/handlers/method_condition_handler_spec.rb index 111ecfcb4..53d48f534 100644 --- a/spec/handlers/method_condition_handler_spec.rb +++ b/spec/handlers/method_condition_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}MethodConditionHandler" do diff --git a/spec/handlers/method_handler_spec.rb b/spec/handlers/method_handler_spec.rb index 4c524248d..da46ca04c 100644 --- a/spec/handlers/method_handler_spec.rb +++ b/spec/handlers/method_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}MethodHandler" do diff --git a/spec/handlers/mixin_handler_spec.rb b/spec/handlers/mixin_handler_spec.rb index 32fa6307e..f8dd7366e 100644 --- a/spec/handlers/mixin_handler_spec.rb +++ b/spec/handlers/mixin_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}MixinHandler" do diff --git a/spec/handlers/module_function_handler_spec.rb b/spec/handlers/module_function_handler_spec.rb index c2037e093..8adc0109a 100644 --- a/spec/handlers/module_function_handler_spec.rb +++ b/spec/handlers/module_function_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}VisibilityHandler" do diff --git a/spec/handlers/module_handler_spec.rb b/spec/handlers/module_handler_spec.rb index 940bad849..8d2af51d3 100644 --- a/spec/handlers/module_handler_spec.rb +++ b/spec/handlers/module_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}ModuleHandler" do diff --git a/spec/handlers/private_class_method_handler_spec.rb b/spec/handlers/private_class_method_handler_spec.rb index 22d54fdff..6a9b73ec1 100644 --- a/spec/handlers/private_class_method_handler_spec.rb +++ b/spec/handlers/private_class_method_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' require File.dirname(__FILE__) + '/class_method_handler_shared_examples' diff --git a/spec/handlers/private_constant_handler_spec.rb b/spec/handlers/private_constant_handler_spec.rb index 27de4fdc5..460ee1f9c 100644 --- a/spec/handlers/private_constant_handler_spec.rb +++ b/spec/handlers/private_constant_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}PrivateConstantHandler" do diff --git a/spec/handlers/processor_spec.rb b/spec/handlers/processor_spec.rb index 17d573211..273e06caa 100644 --- a/spec/handlers/processor_spec.rb +++ b/spec/handlers/processor_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::Handlers::Processor do diff --git a/spec/handlers/public_class_method_handler_spec.rb b/spec/handlers/public_class_method_handler_spec.rb index a3520ca17..f8dd5c629 100644 --- a/spec/handlers/public_class_method_handler_spec.rb +++ b/spec/handlers/public_class_method_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' require File.dirname(__FILE__) + '/class_method_handler_shared_examples' diff --git a/spec/handlers/ruby/base_spec.rb b/spec/handlers/ruby/base_spec.rb index a8a252040..e58facdbb 100644 --- a/spec/handlers/ruby/base_spec.rb +++ b/spec/handlers/ruby/base_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe YARD::Handlers::Ruby::Base, '#valid_handler?' do diff --git a/spec/handlers/ruby/legacy/base_spec.rb b/spec/handlers/ruby/legacy/base_spec.rb index b5cedd13b..55525a528 100644 --- a/spec/handlers/ruby/legacy/base_spec.rb +++ b/spec/handlers/ruby/legacy/base_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../../spec_helper' include Parser::Ruby::Legacy diff --git a/spec/handlers/spec_helper.rb b/spec/handlers/spec_helper.rb index 4fa818a93..7ccbee45d 100644 --- a/spec/handlers/spec_helper.rb +++ b/spec/handlers/spec_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.join(File.dirname(__FILE__), "..", "spec_helper") require 'stringio' diff --git a/spec/handlers/visibility_handler_spec.rb b/spec/handlers/visibility_handler_spec.rb index e9c44bdd5..7dfe52185 100644 --- a/spec/handlers/visibility_handler_spec.rb +++ b/spec/handlers/visibility_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}VisibilityHandler" do diff --git a/spec/handlers/yield_handler_spec.rb b/spec/handlers/yield_handler_spec.rb index affd65983..52a8a63f3 100644 --- a/spec/handlers/yield_handler_spec.rb +++ b/spec/handlers/yield_handler_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe "YARD::Handlers::Ruby::#{LEGACY_PARSER ? "Legacy::" : ""}YieldHandler" do diff --git a/spec/i18n/locale_spec.rb b/spec/i18n/locale_spec.rb index df0bc657b..ed67111f4 100644 --- a/spec/i18n/locale_spec.rb +++ b/spec/i18n/locale_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe YARD::I18n::Locale do @@ -57,7 +58,7 @@ def locale(name) expect(GetText::POParser).to receive(:new).and_return(parser) expect(parser).to receive(:parse_file) do |file, hash| expect(file).to eq 'foo/fr.po' - parser.parse(data, hash) + parser.parse(String.new(data), hash) end expect(@locale.load('foo')).to be true expect(@locale.translate('Hello')).to eq "Bonjour" diff --git a/spec/i18n/message_spec.rb b/spec/i18n/message_spec.rb index 64f1e8e98..a5474b331 100644 --- a/spec/i18n/message_spec.rb +++ b/spec/i18n/message_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe YARD::I18n::Message do diff --git a/spec/i18n/messages_spec.rb b/spec/i18n/messages_spec.rb index 4140a2f52..7e6bc1356 100644 --- a/spec/i18n/messages_spec.rb +++ b/spec/i18n/messages_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe YARD::I18n::Messages do diff --git a/spec/i18n/pot_generator_spec.rb b/spec/i18n/pot_generator_spec.rb index 353770db2..bc46980b4 100644 --- a/spec/i18n/pot_generator_spec.rb +++ b/spec/i18n/pot_generator_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe YARD::I18n::PotGenerator do @@ -85,7 +86,7 @@ def add_messages(yard_messages, messages) describe "Escape" do def generate_message_pot(message_id) - pot = "" + pot = String.new("") message = YARD::I18n::Message.new(message_id) @generator.send(:generate_message, pot, message) pot diff --git a/spec/i18n/text_spec.rb b/spec/i18n/text_spec.rb index 13fb688fa..277dcc9bd 100644 --- a/spec/i18n/text_spec.rb +++ b/spec/i18n/text_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe YARD::I18n::Text do diff --git a/spec/logging_spec.rb b/spec/logging_spec.rb index 2159c3585..361aa84b0 100644 --- a/spec/logging_spec.rb +++ b/spec/logging_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.join(File.dirname(__FILE__), "spec_helper") describe YARD::Logger do diff --git a/spec/options_spec.rb b/spec/options_spec.rb index f2539b4b0..d44be5443 100644 --- a/spec/options_spec.rb +++ b/spec/options_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::Options do diff --git a/spec/parser/base_spec.rb b/spec/parser/base_spec.rb index 4c1bbbb24..f6970c40b 100644 --- a/spec/parser/base_spec.rb +++ b/spec/parser/base_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.join(File.dirname(__FILE__), '..', 'spec_helper') describe YARD::Parser::Base do diff --git a/spec/parser/c_parser_spec.rb b/spec/parser/c_parser_spec.rb index c63402d1e..bdf0f2437 100644 --- a/spec/parser/c_parser_spec.rb +++ b/spec/parser/c_parser_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.join(File.dirname(__FILE__), '..', 'spec_helper') describe YARD::Parser::C::CParser do diff --git a/spec/parser/ruby/ast_node_spec.rb b/spec/parser/ruby/ast_node_spec.rb index 65b07bc1a..0e756457e 100644 --- a/spec/parser/ruby/ast_node_spec.rb +++ b/spec/parser/ruby/ast_node_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper') require 'pp' require 'stringio' diff --git a/spec/parser/ruby/legacy/statement_list_spec.rb b/spec/parser/ruby/legacy/statement_list_spec.rb index d8fd6109d..71c5bd6c9 100644 --- a/spec/parser/ruby/legacy/statement_list_spec.rb +++ b/spec/parser/ruby/legacy/statement_list_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper') describe YARD::Parser::Ruby::Legacy::StatementList do diff --git a/spec/parser/ruby/legacy/token_list_spec.rb b/spec/parser/ruby/legacy/token_list_spec.rb index 84d29ef13..20d3fc41f 100644 --- a/spec/parser/ruby/legacy/token_list_spec.rb +++ b/spec/parser/ruby/legacy/token_list_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.join(File.dirname(__FILE__), '..', '..', '..', 'spec_helper') include YARD::Parser::Ruby::Legacy diff --git a/spec/parser/ruby/ruby_parser_spec.rb b/spec/parser/ruby/ruby_parser_spec.rb index ece28c572..9ac923816 100644 --- a/spec/parser/ruby/ruby_parser_spec.rb +++ b/spec/parser/ruby/ruby_parser_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper') describe YARD::Parser::Ruby::RubyParser do diff --git a/spec/parser/ruby/token_resolver_spec.rb b/spec/parser/ruby/token_resolver_spec.rb index 6ec87e210..26073dcc5 100644 --- a/spec/parser/ruby/token_resolver_spec.rb +++ b/spec/parser/ruby/token_resolver_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper') describe YARD::Parser::Ruby::TokenResolver do diff --git a/spec/parser/source_parser_spec.rb b/spec/parser/source_parser_spec.rb index efeafbc3b..4a431671a 100644 --- a/spec/parser/source_parser_spec.rb +++ b/spec/parser/source_parser_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.join(File.dirname(__FILE__), '..', 'spec_helper') class MyParser < Parser::Base; end @@ -582,7 +583,7 @@ class Foo < Bar Parser::SourceParser::ENCODING_BYTE_ORDER_MARKS.each do |encoding, bom| it "understands #{encoding.upcase} BOM" do parser = Parser::SourceParser.new - src = bom + "class FooBar; end".force_encoding('binary') + src = bom + String.new("class FooBar; end").force_encoding('binary') src.force_encoding('binary') expect(File).to receive(:read_binary).with('tmpfile').and_return(src) result = parser.parse('tmpfile') diff --git a/spec/parser/tag_parsing_spec.rb b/spec/parser/tag_parsing_spec.rb index 4f22f14b9..c1fb28a9e 100644 --- a/spec/parser/tag_parsing_spec.rb +++ b/spec/parser/tag_parsing_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.join(File.dirname(__FILE__), '..', 'spec_helper') describe YARD::Parser, "tag handling" do diff --git a/spec/rake/yardoc_task_spec.rb b/spec/rake/yardoc_task_spec.rb index 42d10fcf6..dadb70741 100644 --- a/spec/rake/yardoc_task_spec.rb +++ b/spec/rake/yardoc_task_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe YARD::Rake::YardocTask do diff --git a/spec/registry_spec.rb b/spec/registry_spec.rb index 4432c66e0..bcb6101ab 100644 --- a/spec/registry_spec.rb +++ b/spec/registry_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.join(File.dirname(__FILE__), "spec_helper") include CodeObjects diff --git a/spec/registry_store_spec.rb b/spec/registry_store_spec.rb index a4176ab8a..6b9217672 100644 --- a/spec/registry_store_spec.rb +++ b/spec/registry_store_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.join(File.dirname(__FILE__), "spec_helper") describe YARD::RegistryStore do diff --git a/spec/rubygems/doc_manager_spec.rb b/spec/rubygems/doc_manager_spec.rb index f42d7cf6b..a1b6a4bef 100644 --- a/spec/rubygems/doc_manager_spec.rb +++ b/spec/rubygems/doc_manager_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' require File.join(YARD::ROOT, 'rubygems_plugin') require 'fileutils' diff --git a/spec/serializers/file_system_serializer_spec.rb b/spec/serializers/file_system_serializer_spec.rb index c7e3c30e0..4ed1c3e03 100644 --- a/spec/serializers/file_system_serializer_spec.rb +++ b/spec/serializers/file_system_serializer_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.join(File.dirname(__FILE__), "spec_helper") require 'stringio' diff --git a/spec/serializers/spec_helper.rb b/spec/serializers/spec_helper.rb index a8324a8b8..16e87bf4f 100644 --- a/spec/serializers/spec_helper.rb +++ b/spec/serializers/spec_helper.rb @@ -1,2 +1,3 @@ +# frozen_string_literal: true require File.join(File.dirname(__FILE__), "..", "spec_helper") include YARD diff --git a/spec/serializers/yardoc_serializer_spec.rb b/spec/serializers/yardoc_serializer_spec.rb index f6fdd44b6..5c7432fc4 100644 --- a/spec/serializers/yardoc_serializer_spec.rb +++ b/spec/serializers/yardoc_serializer_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + "/spec_helper" instance_eval do diff --git a/spec/server/adapter_spec.rb b/spec/server/adapter_spec.rb index 049d8cb38..26fd53d49 100644 --- a/spec/server/adapter_spec.rb +++ b/spec/server/adapter_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::Server::Adapter do diff --git a/spec/server/commands/base_spec.rb b/spec/server/commands/base_spec.rb index 6a3a3cf79..10ad28a93 100644 --- a/spec/server/commands/base_spec.rb +++ b/spec/server/commands/base_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' class MyProcCommand < Base diff --git a/spec/server/commands/library_command_spec.rb b/spec/server/commands/library_command_spec.rb index 76f934997..6b3881278 100644 --- a/spec/server/commands/library_command_spec.rb +++ b/spec/server/commands/library_command_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' require 'ostruct' diff --git a/spec/server/doc_server_helper_spec.rb b/spec/server/doc_server_helper_spec.rb index e0dff63a7..350513ba6 100644 --- a/spec/server/doc_server_helper_spec.rb +++ b/spec/server/doc_server_helper_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + "/spec_helper" class MyDocServerSerializerRouter diff --git a/spec/server/doc_server_serializer_spec.rb b/spec/server/doc_server_serializer_spec.rb index 99f83a728..d2a6dcdee 100644 --- a/spec/server/doc_server_serializer_spec.rb +++ b/spec/server/doc_server_serializer_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::Server::DocServerSerializer do diff --git a/spec/server/rack_adapter_spec.rb b/spec/server/rack_adapter_spec.rb index 91054649b..2d8614107 100644 --- a/spec/server/rack_adapter_spec.rb +++ b/spec/server/rack_adapter_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + "/spec_helper" describe "YARD::Server::RackMiddleware" do diff --git a/spec/server/router_spec.rb b/spec/server/router_spec.rb index 4d6cf9ae6..81940780e 100644 --- a/spec/server/router_spec.rb +++ b/spec/server/router_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' class MyRouterSpecRouter < Router diff --git a/spec/server/spec_helper.rb b/spec/server/spec_helper.rb index ad0f931c7..4c6374ead 100644 --- a/spec/server/spec_helper.rb +++ b/spec/server/spec_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + "/../spec_helper" require 'ostruct' diff --git a/spec/server/static_caching_spec.rb b/spec/server/static_caching_spec.rb index acebec645..e8275aa1f 100644 --- a/spec/server/static_caching_spec.rb +++ b/spec/server/static_caching_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::Server::StaticCaching do diff --git a/spec/server/webrick_servlet_spec.rb b/spec/server/webrick_servlet_spec.rb index e1c731840..76d31fefc 100644 --- a/spec/server/webrick_servlet_spec.rb +++ b/spec/server/webrick_servlet_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::Server::WebrickServlet do diff --git a/spec/server_spec.rb b/spec/server_spec.rb index 3b7518981..f96395628 100644 --- a/spec/server_spec.rb +++ b/spec/server_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + "/spec_helper" describe YARD::Server do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 30b9a080f..a0ba8244c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "rubygems" begin require "rspec" diff --git a/spec/tags/default_factory_spec.rb b/spec/tags/default_factory_spec.rb index e87fd8d73..328d6a423 100644 --- a/spec/tags/default_factory_spec.rb +++ b/spec/tags/default_factory_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe YARD::Tags::DefaultFactory do diff --git a/spec/tags/default_tag_spec.rb b/spec/tags/default_tag_spec.rb index 33d86b997..1c29b9e71 100644 --- a/spec/tags/default_tag_spec.rb +++ b/spec/tags/default_tag_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe YARD::Tags::DefaultTag do diff --git a/spec/tags/directives_spec.rb b/spec/tags/directives_spec.rb index 4c63fc9b3..fed8e489b 100644 --- a/spec/tags/directives_spec.rb +++ b/spec/tags/directives_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + "/../spec_helper" def tag_parse(content, object = nil, handler = nil) @@ -36,7 +37,7 @@ class A eval "def foo; end" end eof - parser = Parser::SourceParser.new + parser = YARD::Parser::SourceParser.new parser.file = "myfile.rb" parser.parse(StringIO.new(src)) expect(Registry.at('A#foo').file).to eq 'myfile.rb' diff --git a/spec/tags/library_spec.rb b/spec/tags/library_spec.rb index eac57f53e..756b70a28 100644 --- a/spec/tags/library_spec.rb +++ b/spec/tags/library_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe YARD::Tags::Library do diff --git a/spec/tags/overload_tag_spec.rb b/spec/tags/overload_tag_spec.rb index 433a4857f..889eff371 100644 --- a/spec/tags/overload_tag_spec.rb +++ b/spec/tags/overload_tag_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe YARD::Tags::OverloadTag do diff --git a/spec/tags/ref_tag_list_spec.rb b/spec/tags/ref_tag_list_spec.rb index 87b2fd1d9..4b83c0023 100644 --- a/spec/tags/ref_tag_list_spec.rb +++ b/spec/tags/ref_tag_list_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe YARD::Tags::RefTagList do diff --git a/spec/tags/types_explainer_spec.rb b/spec/tags/types_explainer_spec.rb index adde2202a..572bbde5b 100644 --- a/spec/tags/types_explainer_spec.rb +++ b/spec/tags/types_explainer_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe YARD::Tags::TypesExplainer do diff --git a/spec/templates/class_spec.rb b/spec/templates/class_spec.rb index 2a481be7a..bec9ff1f3 100644 --- a/spec/templates/class_spec.rb +++ b/spec/templates/class_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::Templates::Engine.template(:default, :docstring) do diff --git a/spec/templates/constant_spec.rb b/spec/templates/constant_spec.rb index b57cf037f..ee9fb1383 100644 --- a/spec/templates/constant_spec.rb +++ b/spec/templates/constant_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + "/spec_helper" describe YARD::Templates::Engine.template(:default, :constant) do diff --git a/spec/templates/engine_spec.rb b/spec/templates/engine_spec.rb index e77a2c520..78ad4ad92 100644 --- a/spec/templates/engine_spec.rb +++ b/spec/templates/engine_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::Templates::Engine do diff --git a/spec/templates/helpers/base_helper_spec.rb b/spec/templates/helpers/base_helper_spec.rb index bcba79882..5f15260cd 100644 --- a/spec/templates/helpers/base_helper_spec.rb +++ b/spec/templates/helpers/base_helper_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe YARD::Templates::Helpers::BaseHelper do diff --git a/spec/templates/helpers/html_helper_spec.rb b/spec/templates/helpers/html_helper_spec.rb index 16a588b6c..459b311ca 100644 --- a/spec/templates/helpers/html_helper_spec.rb +++ b/spec/templates/helpers/html_helper_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../../spec_helper' require File.dirname(__FILE__) + "/shared_signature_examples" require 'ostruct' @@ -43,7 +44,7 @@ def options end it "takes file encoding if there is a file" do - @file = OpenStruct.new(:contents => 'foo'.force_encoding('sjis')) + @file = OpenStruct.new(:contents => String.new('foo').force_encoding('sjis')) # not the correct charset name, but good enough expect(['Shift_JIS', 'Windows-31J']).to include(charset) end if YARD.ruby19? @@ -118,7 +119,7 @@ def options it "handles various encodings" do allow(self).to receive(:object).and_return(Registry.root) - text = "\xB0\xB1" + text = String.new("\xB0\xB1") if defined?(Encoding) Encoding.default_internal = 'utf-8' text = text.force_encoding('binary') diff --git a/spec/templates/helpers/html_syntax_highlight_helper_spec.rb b/spec/templates/helpers/html_syntax_highlight_helper_spec.rb index 3b89418fd..567a02d0f 100644 --- a/spec/templates/helpers/html_syntax_highlight_helper_spec.rb +++ b/spec/templates/helpers/html_syntax_highlight_helper_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' describe YARD::Templates::Helpers::HtmlSyntaxHighlightHelper do diff --git a/spec/templates/helpers/markup/rdoc_markup_spec.rb b/spec/templates/helpers/markup/rdoc_markup_spec.rb index a08c22345..6a0edf9d2 100644 --- a/spec/templates/helpers/markup/rdoc_markup_spec.rb +++ b/spec/templates/helpers/markup/rdoc_markup_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + "/../../spec_helper" describe YARD::Templates::Helpers::Markup::RDocMarkup do diff --git a/spec/templates/helpers/markup_helper_spec.rb b/spec/templates/helpers/markup_helper_spec.rb index d970bfa2a..ea36ab711 100644 --- a/spec/templates/helpers/markup_helper_spec.rb +++ b/spec/templates/helpers/markup_helper_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../../spec_helper' module YARD::Templates::Helpers::MarkupHelper diff --git a/spec/templates/helpers/method_helper_spec.rb b/spec/templates/helpers/method_helper_spec.rb index 01273c2e9..afd6aa2a1 100644 --- a/spec/templates/helpers/method_helper_spec.rb +++ b/spec/templates/helpers/method_helper_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + "/../spec_helper" describe YARD::Templates::Helpers::MethodHelper do diff --git a/spec/templates/helpers/module_helper_spec.rb b/spec/templates/helpers/module_helper_spec.rb index 27fec2488..874520982 100644 --- a/spec/templates/helpers/module_helper_spec.rb +++ b/spec/templates/helpers/module_helper_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + "/../spec_helper" describe YARD::Templates::Helpers::ModuleHelper do diff --git a/spec/templates/helpers/shared_signature_examples.rb b/spec/templates/helpers/shared_signature_examples.rb index 9478ec753..26851136c 100644 --- a/spec/templates/helpers/shared_signature_examples.rb +++ b/spec/templates/helpers/shared_signature_examples.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true shared_examples_for "signature" do before do YARD::Registry.clear diff --git a/spec/templates/helpers/text_helper_spec.rb b/spec/templates/helpers/text_helper_spec.rb index f5766d46a..230743a29 100644 --- a/spec/templates/helpers/text_helper_spec.rb +++ b/spec/templates/helpers/text_helper_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../../spec_helper' require File.dirname(__FILE__) + "/shared_signature_examples" diff --git a/spec/templates/method_spec.rb b/spec/templates/method_spec.rb index 8715c8372..4d54b4a8c 100644 --- a/spec/templates/method_spec.rb +++ b/spec/templates/method_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' # $COPY = :method001 diff --git a/spec/templates/module_spec.rb b/spec/templates/module_spec.rb index 1ae648321..8950a432b 100644 --- a/spec/templates/module_spec.rb +++ b/spec/templates/module_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::Templates::Engine.template(:default, :module) do diff --git a/spec/templates/onefile_spec.rb b/spec/templates/onefile_spec.rb index e2050a4b9..c76edcb26 100644 --- a/spec/templates/onefile_spec.rb +++ b/spec/templates/onefile_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' class StringSerializer < YARD::Serializers::Base @@ -33,7 +34,7 @@ def serialize(object, data) def render @files = [] - @output = '' + @output = String.new("") YARD.parse_string <<-eof class A # Foo method diff --git a/spec/templates/section_spec.rb b/spec/templates/section_spec.rb index 3f7daa6b2..f554b2727 100644 --- a/spec/templates/section_spec.rb +++ b/spec/templates/section_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::Templates::Section do diff --git a/spec/templates/spec_helper.rb b/spec/templates/spec_helper.rb index 19094aeb4..108a03ca2 100644 --- a/spec/templates/spec_helper.rb +++ b/spec/templates/spec_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/../spec_helper' include YARD::Templates @@ -24,6 +25,8 @@ def html_equals(result, expected_example) end def html_equals_string(result, expected) + result = String.new(result) + expected = String.new(expected) [expected, result].each do |value| value.gsub!(/(>)\s+|\s+(<)/, '\1\2') value.gsub!(/'/, "'") diff --git a/spec/templates/tag_spec.rb b/spec/templates/tag_spec.rb index 21e6fab24..16b63ea68 100644 --- a/spec/templates/tag_spec.rb +++ b/spec/templates/tag_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::Templates::Engine.template(:default, :tags) do diff --git a/spec/templates/template_spec.rb b/spec/templates/template_spec.rb index fd7137d70..bcfac91c6 100644 --- a/spec/templates/template_spec.rb +++ b/spec/templates/template_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::Templates::Template do @@ -61,7 +62,7 @@ def template(path) describe ".load_setup_rb" do it "loads setup.rb file for module" do expect(File).to receive(:file?).with('/full/path/e/setup.rb').and_return(true) - expect(File).to receive(:read).with('/full/path/e/setup.rb').and_return('def success; end') + expect(File).to receive(:read).with('/full/path/e/setup.rb').and_return(String.new('def success; end')) expect(template(:e).new).to respond_to(:success) end end @@ -155,8 +156,8 @@ def init; sections 1, 2, 3 end it "replaces {{{__super__}}} with inherited template contents if allow_inherited=true" do expect(File).to receive(:file?).with('/full/path/a/abc').twice.and_return(true) expect(File).to receive(:file?).with('/full/path/b/abc').and_return(true) - expect(IO).to receive(:read).with('/full/path/a/abc').and_return('foo {{{__super__}}}') - expect(IO).to receive(:read).with('/full/path/b/abc').and_return('bar') + expect(IO).to receive(:read).with('/full/path/a/abc').and_return(String.new('foo {{{__super__}}}')) + expect(IO).to receive(:read).with('/full/path/b/abc').and_return(String.new('bar')) expect(template(:a).new.file('abc', true)).to eq "foo bar" end diff --git a/spec/verifier_spec.rb b/spec/verifier_spec.rb index b9655f70e..23e932cd3 100644 --- a/spec/verifier_spec.rb +++ b/spec/verifier_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.dirname(__FILE__) + '/spec_helper' describe YARD::Verifier do diff --git a/templates/default/class/dot/setup.rb b/templates/default/class/dot/setup.rb index f2997d0d8..da92c4c72 100644 --- a/templates/default/class/dot/setup.rb +++ b/templates/default/class/dot/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true include T('default/module/dot') def init diff --git a/templates/default/class/html/setup.rb b/templates/default/class/html/setup.rb index 91e114a34..f1f8fe117 100644 --- a/templates/default/class/html/setup.rb +++ b/templates/default/class/html/setup.rb @@ -1 +1,2 @@ +# frozen_string_literal: true include T('default/module/html') diff --git a/templates/default/class/setup.rb b/templates/default/class/setup.rb index 8d37fc317..a4e0a71dc 100644 --- a/templates/default/class/setup.rb +++ b/templates/default/class/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true include T('default/module') def init diff --git a/templates/default/class/text/setup.rb b/templates/default/class/text/setup.rb index 9acccfcf0..b696807ed 100644 --- a/templates/default/class/text/setup.rb +++ b/templates/default/class/text/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true include T('default/module/text') def init diff --git a/templates/default/constant/text/setup.rb b/templates/default/constant/text/setup.rb index 06d9b41df..cbf2f4992 100644 --- a/templates/default/constant/text/setup.rb +++ b/templates/default/constant/text/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true def init sections :header, [T('docstring')] end diff --git a/templates/default/docstring/setup.rb b/templates/default/docstring/setup.rb index 1d0b381b3..1f1b0c97d 100644 --- a/templates/default/docstring/setup.rb +++ b/templates/default/docstring/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true def init return if object.docstring.blank? && !object.has_tag?(:api) sections :index, [:private, :deprecated, :abstract, :todo, :note, :returns_void, :text], T('tags') diff --git a/templates/default/fulldoc/html/setup.rb b/templates/default/fulldoc/html/setup.rb index 587515eff..15e1c5ab8 100644 --- a/templates/default/fulldoc/html/setup.rb +++ b/templates/default/fulldoc/html/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true include Helpers::ModuleHelper def init @@ -213,7 +214,7 @@ def next # @return [String] HTML output of the classes to be displayed in the # full_list_class template. def class_list(root = Registry.root, tree = TreeContext.new) - out = "" + out = String.new("") children = run_verifier(root.children) if root == Registry.root children += @items.select {|o| o.namespace.is_a?(CodeObjects::Proxy) } diff --git a/templates/default/layout/dot/setup.rb b/templates/default/layout/dot/setup.rb index 06f977e0e..ccdba6205 100644 --- a/templates/default/layout/dot/setup.rb +++ b/templates/default/layout/dot/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true attr_reader :contents def init diff --git a/templates/default/layout/html/setup.rb b/templates/default/layout/html/setup.rb index 9521f2a4a..8b35a0d50 100644 --- a/templates/default/layout/html/setup.rb +++ b/templates/default/layout/html/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true def init @breadcrumb = [] if @onefile diff --git a/templates/default/method/setup.rb b/templates/default/method/setup.rb index d8912c803..81c03d533 100644 --- a/templates/default/method/setup.rb +++ b/templates/default/method/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true def init sections :header, [T('method_details')] end diff --git a/templates/default/method_details/setup.rb b/templates/default/method_details/setup.rb index b933228cf..91b52fd7a 100644 --- a/templates/default/method_details/setup.rb +++ b/templates/default/method_details/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true def init sections :header, [:method_signature, T('docstring'), :source] end diff --git a/templates/default/method_details/text/setup.rb b/templates/default/method_details/text/setup.rb index 8f69b8e82..97704364d 100644 --- a/templates/default/method_details/text/setup.rb +++ b/templates/default/method_details/text/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true def init super sections.last.pop diff --git a/templates/default/module/dot/setup.rb b/templates/default/module/dot/setup.rb index 90017a6db..a9344eb9a 100644 --- a/templates/default/module/dot/setup.rb +++ b/templates/default/module/dot/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true def init @modules = object.children.select {|o| o.type == :module } @classes = object.children.select {|o| o.type == :class } diff --git a/templates/default/module/setup.rb b/templates/default/module/setup.rb index 4bc1bbf88..6ce286f13 100644 --- a/templates/default/module/setup.rb +++ b/templates/default/module/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true include Helpers::ModuleHelper def init diff --git a/templates/default/module/text/setup.rb b/templates/default/module/text/setup.rb index 730efe462..4f4dbf24e 100644 --- a/templates/default/module/text/setup.rb +++ b/templates/default/module/text/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true def init sections :header, [T('docstring')], :children, :includes, :extends, :class_meths_list, :instance_meths_list diff --git a/templates/default/onefile/html/setup.rb b/templates/default/onefile/html/setup.rb index 67d199062..f32a39192 100644 --- a/templates/default/onefile/html/setup.rb +++ b/templates/default/onefile/html/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true include T('default/layout/html') include YARD::Parser::Ruby::Legacy diff --git a/templates/default/root/dot/setup.rb b/templates/default/root/dot/setup.rb index 6a6e39d35..09e955732 100644 --- a/templates/default/root/dot/setup.rb +++ b/templates/default/root/dot/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true include T('default/module/dot') def format_path(_object) diff --git a/templates/default/root/html/setup.rb b/templates/default/root/html/setup.rb index 91e114a34..f1f8fe117 100644 --- a/templates/default/root/html/setup.rb +++ b/templates/default/root/html/setup.rb @@ -1 +1,2 @@ +# frozen_string_literal: true include T('default/module/html') diff --git a/templates/default/tags/setup.rb b/templates/default/tags/setup.rb index 9e782533a..1e1ada522 100644 --- a/templates/default/tags/setup.rb +++ b/templates/default/tags/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true def init tags = Tags::Library.visible_tags - [:abstract, :deprecated, :note, :todo] create_tag_methods(tags - [:example, :option, :overload, :see]) diff --git a/templates/guide/class/html/setup.rb b/templates/guide/class/html/setup.rb index ae6a63ac1..29dd77462 100644 --- a/templates/guide/class/html/setup.rb +++ b/templates/guide/class/html/setup.rb @@ -1 +1,2 @@ +# frozen_string_literal: true include T('guide/module/html') diff --git a/templates/guide/docstring/html/setup.rb b/templates/guide/docstring/html/setup.rb index 0e818bb93..8ac0a27ff 100644 --- a/templates/guide/docstring/html/setup.rb +++ b/templates/guide/docstring/html/setup.rb @@ -1 +1,2 @@ +# frozen_string_literal: true include T('default/docstring/html') diff --git a/templates/guide/fulldoc/html/setup.rb b/templates/guide/fulldoc/html/setup.rb index fc7b9e1cf..87d4b121b 100644 --- a/templates/guide/fulldoc/html/setup.rb +++ b/templates/guide/fulldoc/html/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true include T('default/fulldoc/html') module OverrideFileLinks diff --git a/templates/guide/layout/html/setup.rb b/templates/guide/layout/html/setup.rb index 7050a7a78..e6e236893 100644 --- a/templates/guide/layout/html/setup.rb +++ b/templates/guide/layout/html/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true include T('default/layout/html') def init diff --git a/templates/guide/method/html/setup.rb b/templates/guide/method/html/setup.rb index 596454516..e2888fea0 100644 --- a/templates/guide/method/html/setup.rb +++ b/templates/guide/method/html/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true def init sections :header, [T('docstring')] end diff --git a/templates/guide/module/html/setup.rb b/templates/guide/module/html/setup.rb index ac267cab4..9cb28a540 100644 --- a/templates/guide/module/html/setup.rb +++ b/templates/guide/module/html/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true include Helpers::ModuleHelper def init diff --git a/templates/guide/onefile/html/setup.rb b/templates/guide/onefile/html/setup.rb index 1b46886cb..6c2efd108 100644 --- a/templates/guide/onefile/html/setup.rb +++ b/templates/guide/onefile/html/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true include T('default/onefile/html') def init diff --git a/templates/guide/tags/html/setup.rb b/templates/guide/tags/html/setup.rb index 6c5c626d5..fe59cd75c 100644 --- a/templates/guide/tags/html/setup.rb +++ b/templates/guide/tags/html/setup.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true include T('default/tags/html') def init diff --git a/yard.gemspec b/yard.gemspec index 5706b35c1..8993abb72 100644 --- a/yard.gemspec +++ b/yard.gemspec @@ -1,3 +1,4 @@ +# frozen_string_literal: true require File.expand_path('../lib/yard/version', __FILE__) Gem::Specification.new do |s|