diff --git a/.rubocop.yml b/.rubocop.yml index f38ff4393..099a61823 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -13,3 +13,8 @@ Lint/DuplicateMethods: Enabled: true Include: - 'test/**/*_test.rb' + +Style/FrozenStringLiteralComment: + Enabled: true + Include: + - 'lib/**/*.rb' diff --git a/lib/rbs.rb b/lib/rbs.rb index 9b4d65723..0559fa422 100644 --- a/lib/rbs.rb +++ b/lib/rbs.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "rbs/version" require "set" diff --git a/lib/rbs/ancestor_graph.rb b/lib/rbs/ancestor_graph.rb index ed7fb0da1..7c197746f 100644 --- a/lib/rbs/ancestor_graph.rb +++ b/lib/rbs/ancestor_graph.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class AncestorGraph InstanceNode = _ = Struct.new(:type_name, keyword_init: true) diff --git a/lib/rbs/annotate.rb b/lib/rbs/annotate.rb index 1256a7120..c55568470 100644 --- a/lib/rbs/annotate.rb +++ b/lib/rbs/annotate.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "rdoc" require "rbs/annotate/rdoc_annotator" diff --git a/lib/rbs/annotate/annotations.rb b/lib/rbs/annotate/annotations.rb index 797a8e889..0030b3046 100644 --- a/lib/rbs/annotate/annotations.rb +++ b/lib/rbs/annotate/annotations.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module Annotate class Annotations diff --git a/lib/rbs/annotate/formatter.rb b/lib/rbs/annotate/formatter.rb index 7e2251410..c53124e27 100644 --- a/lib/rbs/annotate/formatter.rb +++ b/lib/rbs/annotate/formatter.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + module RBS module Annotate class Formatter attr_reader :buffer def initialize() - @buffer = "" + @buffer = +"" @pending_separator = nil end @@ -14,7 +16,7 @@ def <<(s) s = self.class.translate(s) or raise end - s.rstrip! + s = s.rstrip unless s.empty? if ss = @pending_separator diff --git a/lib/rbs/annotate/rdoc_annotator.rb b/lib/rbs/annotate/rdoc_annotator.rb index eff74a57f..a1dffd518 100644 --- a/lib/rbs/annotate/rdoc_annotator.rb +++ b/lib/rbs/annotate/rdoc_annotator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module Annotate class RDocAnnotator diff --git a/lib/rbs/annotate/rdoc_source.rb b/lib/rbs/annotate/rdoc_source.rb index f0dd6622a..88a326585 100644 --- a/lib/rbs/annotate/rdoc_source.rb +++ b/lib/rbs/annotate/rdoc_source.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module Annotate class RDocSource diff --git a/lib/rbs/ast/annotation.rb b/lib/rbs/ast/annotation.rb index 4894bb944..8cf5c1c0e 100644 --- a/lib/rbs/ast/annotation.rb +++ b/lib/rbs/ast/annotation.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module AST class Annotation diff --git a/lib/rbs/ast/comment.rb b/lib/rbs/ast/comment.rb index 21041b3da..62db2c806 100644 --- a/lib/rbs/ast/comment.rb +++ b/lib/rbs/ast/comment.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module AST class Comment diff --git a/lib/rbs/ast/declarations.rb b/lib/rbs/ast/declarations.rb index e4c312712..b52f9e387 100644 --- a/lib/rbs/ast/declarations.rb +++ b/lib/rbs/ast/declarations.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module AST module Declarations diff --git a/lib/rbs/ast/members.rb b/lib/rbs/ast/members.rb index bfc466d56..9942eac52 100644 --- a/lib/rbs/ast/members.rb +++ b/lib/rbs/ast/members.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module AST module Members diff --git a/lib/rbs/ast/type_param.rb b/lib/rbs/ast/type_param.rb index 612030405..3775ba2e6 100644 --- a/lib/rbs/ast/type_param.rb +++ b/lib/rbs/ast/type_param.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module AST class TypeParam @@ -106,7 +108,7 @@ def self.rename(params, new_names:) end def to_s - s = "" + s = +"" if unchecked? s << "unchecked " diff --git a/lib/rbs/buffer.rb b/lib/rbs/buffer.rb index bc9a7c2ee..10f0273df 100644 --- a/lib/rbs/buffer.rb +++ b/lib/rbs/buffer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class Buffer attr_reader :name diff --git a/lib/rbs/builtin_names.rb b/lib/rbs/builtin_names.rb index cc6761af8..b36d898b0 100644 --- a/lib/rbs/builtin_names.rb +++ b/lib/rbs/builtin_names.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module BuiltinNames class Name diff --git a/lib/rbs/cli.rb b/lib/rbs/cli.rb index 28e49055e..592e380f1 100644 --- a/lib/rbs/cli.rb +++ b/lib/rbs/cli.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "open3" require "optparse" require "shellwords" diff --git a/lib/rbs/collection.rb b/lib/rbs/collection.rb index aca483d1f..78d096d16 100644 --- a/lib/rbs/collection.rb +++ b/lib/rbs/collection.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'yaml' require 'bundler' diff --git a/lib/rbs/collection/cleaner.rb b/lib/rbs/collection/cleaner.rb index 834f94c51..1d126d659 100644 --- a/lib/rbs/collection/cleaner.rb +++ b/lib/rbs/collection/cleaner.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module Collection class Cleaner diff --git a/lib/rbs/collection/config.rb b/lib/rbs/collection/config.rb index 230aae7af..566f72a74 100644 --- a/lib/rbs/collection/config.rb +++ b/lib/rbs/collection/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module Collection diff --git a/lib/rbs/collection/config/lockfile_generator.rb b/lib/rbs/collection/config/lockfile_generator.rb index 608bdd93a..c2db175f3 100644 --- a/lib/rbs/collection/config/lockfile_generator.rb +++ b/lib/rbs/collection/config/lockfile_generator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module Collection diff --git a/lib/rbs/collection/installer.rb b/lib/rbs/collection/installer.rb index fa375c65b..0e3e98779 100644 --- a/lib/rbs/collection/installer.rb +++ b/lib/rbs/collection/installer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module Collection class Installer diff --git a/lib/rbs/collection/sources.rb b/lib/rbs/collection/sources.rb index bd0ad252c..1af76f642 100644 --- a/lib/rbs/collection/sources.rb +++ b/lib/rbs/collection/sources.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative './sources/base' require_relative './sources/git' require_relative './sources/stdlib' diff --git a/lib/rbs/collection/sources/base.rb b/lib/rbs/collection/sources/base.rb index 9e77f25ba..7c7836f1f 100644 --- a/lib/rbs/collection/sources/base.rb +++ b/lib/rbs/collection/sources/base.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module Collection module Sources diff --git a/lib/rbs/collection/sources/git.rb b/lib/rbs/collection/sources/git.rb index 714090e65..99f86ce9d 100644 --- a/lib/rbs/collection/sources/git.rb +++ b/lib/rbs/collection/sources/git.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'digest/sha2' require 'open3' require 'find' diff --git a/lib/rbs/collection/sources/rubygems.rb b/lib/rbs/collection/sources/rubygems.rb index 6b6d80279..5a47bf749 100644 --- a/lib/rbs/collection/sources/rubygems.rb +++ b/lib/rbs/collection/sources/rubygems.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'singleton' module RBS diff --git a/lib/rbs/collection/sources/stdlib.rb b/lib/rbs/collection/sources/stdlib.rb index 2276dd5ee..f2bb11b5d 100644 --- a/lib/rbs/collection/sources/stdlib.rb +++ b/lib/rbs/collection/sources/stdlib.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'singleton' module RBS diff --git a/lib/rbs/constant.rb b/lib/rbs/constant.rb index ddebfff93..ec60af075 100644 --- a/lib/rbs/constant.rb +++ b/lib/rbs/constant.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class Constant attr_reader :name diff --git a/lib/rbs/constant_table.rb b/lib/rbs/constant_table.rb index 58eaf86dc..d51dc9660 100644 --- a/lib/rbs/constant_table.rb +++ b/lib/rbs/constant_table.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class ConstantTable attr_reader :definition_builder diff --git a/lib/rbs/definition.rb b/lib/rbs/definition.rb index 270979e3c..da3af8331 100644 --- a/lib/rbs/definition.rb +++ b/lib/rbs/definition.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class Definition class Variable diff --git a/lib/rbs/definition_builder.rb b/lib/rbs/definition_builder.rb index f5766b3ae..f44f4c4cd 100644 --- a/lib/rbs/definition_builder.rb +++ b/lib/rbs/definition_builder.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class DefinitionBuilder attr_reader :env diff --git a/lib/rbs/definition_builder/ancestor_builder.rb b/lib/rbs/definition_builder/ancestor_builder.rb index 204ed8bb6..62448acc2 100644 --- a/lib/rbs/definition_builder/ancestor_builder.rb +++ b/lib/rbs/definition_builder/ancestor_builder.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class DefinitionBuilder class AncestorBuilder diff --git a/lib/rbs/definition_builder/method_builder.rb b/lib/rbs/definition_builder/method_builder.rb index 2c3283c95..27adb2422 100644 --- a/lib/rbs/definition_builder/method_builder.rb +++ b/lib/rbs/definition_builder/method_builder.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class DefinitionBuilder class MethodBuilder diff --git a/lib/rbs/environment.rb b/lib/rbs/environment.rb index 56403164c..4aa35d5f3 100644 --- a/lib/rbs/environment.rb +++ b/lib/rbs/environment.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class Environment attr_reader :declarations diff --git a/lib/rbs/environment_loader.rb b/lib/rbs/environment_loader.rb index 858cc4604..c399ca1fa 100644 --- a/lib/rbs/environment_loader.rb +++ b/lib/rbs/environment_loader.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class EnvironmentLoader class UnknownLibraryError < StandardError diff --git a/lib/rbs/environment_walker.rb b/lib/rbs/environment_walker.rb index 384da066c..7b9674591 100644 --- a/lib/rbs/environment_walker.rb +++ b/lib/rbs/environment_walker.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class EnvironmentWalker InstanceNode = _ = Struct.new(:type_name, keyword_init: true) diff --git a/lib/rbs/errors.rb b/lib/rbs/errors.rb index 246dbe9d9..2e1450518 100644 --- a/lib/rbs/errors.rb +++ b/lib/rbs/errors.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module MethodNameHelper def method_name_string() @@ -216,7 +218,7 @@ def initialize(type:, method_name:, members:) @method_name = method_name @members = members - message = "#{Location.to_string location}: #{qualified_method_name} has duplicated definitions" + message = +"#{Location.to_string location}: #{qualified_method_name} has duplicated definitions" if members.size > 1 message << " in #{other_locations.map { |loc| Location.to_string loc }.join(', ')}" end diff --git a/lib/rbs/factory.rb b/lib/rbs/factory.rb index 6822e8f46..a224ebd76 100644 --- a/lib/rbs/factory.rb +++ b/lib/rbs/factory.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class Factory def type_name(string) diff --git a/lib/rbs/location_aux.rb b/lib/rbs/location_aux.rb index 73e2d013e..769f91c5c 100644 --- a/lib/rbs/location_aux.rb +++ b/lib/rbs/location_aux.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class Location def inspect diff --git a/lib/rbs/locator.rb b/lib/rbs/locator.rb index 539f01c0a..42d6b17e2 100644 --- a/lib/rbs/locator.rb +++ b/lib/rbs/locator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class Locator attr_reader :decls diff --git a/lib/rbs/method_type.rb b/lib/rbs/method_type.rb index 0ddb92875..e07d75e5e 100644 --- a/lib/rbs/method_type.rb +++ b/lib/rbs/method_type.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class MethodType attr_reader :type_params diff --git a/lib/rbs/namespace.rb b/lib/rbs/namespace.rb index a2899689a..d41496436 100644 --- a/lib/rbs/namespace.rb +++ b/lib/rbs/namespace.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class Namespace attr_reader :path diff --git a/lib/rbs/parser_aux.rb b/lib/rbs/parser_aux.rb index d18eaa7da..1b9e41324 100644 --- a/lib/rbs/parser_aux.rb +++ b/lib/rbs/parser_aux.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class Parser def self.parse_type(source, line: 1, column: 0, variables: []) diff --git a/lib/rbs/parser_compat/lexer_error.rb b/lib/rbs/parser_compat/lexer_error.rb index fd150dd2f..0ed6cb3cc 100644 --- a/lib/rbs/parser_compat/lexer_error.rb +++ b/lib/rbs/parser_compat/lexer_error.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RBS.print_warning { "RBS::Parser::LexerError is deprecated and will be deleted in RBS 2.0." } diff --git a/lib/rbs/parser_compat/located_value.rb b/lib/rbs/parser_compat/located_value.rb index 6ccabaf06..99ad57a1b 100644 --- a/lib/rbs/parser_compat/located_value.rb +++ b/lib/rbs/parser_compat/located_value.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RBS.print_warning { "RBS::Parser::LocatedValue is deprecated and will be deleted in RBS 2.0." } diff --git a/lib/rbs/parser_compat/semantics_error.rb b/lib/rbs/parser_compat/semantics_error.rb index 14c9c2017..1a40743d1 100644 --- a/lib/rbs/parser_compat/semantics_error.rb +++ b/lib/rbs/parser_compat/semantics_error.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RBS.print_warning { "RBS::Parser::SemanticsError is deprecated and will be deleted in RBS 2.0." } diff --git a/lib/rbs/parser_compat/syntax_error.rb b/lib/rbs/parser_compat/syntax_error.rb index be7f68f1c..5ae5df62c 100644 --- a/lib/rbs/parser_compat/syntax_error.rb +++ b/lib/rbs/parser_compat/syntax_error.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RBS.print_warning { "RBS::Parser::SyntaxError is deprecated and will be deleted in RBS 2.0." } diff --git a/lib/rbs/prototype/helpers.rb b/lib/rbs/prototype/helpers.rb index 044243847..10baa0679 100644 --- a/lib/rbs/prototype/helpers.rb +++ b/lib/rbs/prototype/helpers.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module Prototype module Helpers diff --git a/lib/rbs/prototype/rb.rb b/lib/rbs/prototype/rb.rb index cbdc3893e..d6b37ca7c 100644 --- a/lib/rbs/prototype/rb.rb +++ b/lib/rbs/prototype/rb.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module Prototype class RB diff --git a/lib/rbs/prototype/rbi.rb b/lib/rbs/prototype/rbi.rb index cb50956fa..4d92154c4 100644 --- a/lib/rbs/prototype/rbi.rb +++ b/lib/rbs/prototype/rbi.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module Prototype class RBI diff --git a/lib/rbs/prototype/runtime.rb b/lib/rbs/prototype/runtime.rb index 87b27dd79..460e2b447 100644 --- a/lib/rbs/prototype/runtime.rb +++ b/lib/rbs/prototype/runtime.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module Prototype class Runtime diff --git a/lib/rbs/repository.rb b/lib/rbs/repository.rb index 86ce45c0a..49285975d 100644 --- a/lib/rbs/repository.rb +++ b/lib/rbs/repository.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class Repository DEFAULT_STDLIB_ROOT = Pathname(_ = __dir__) + "../../stdlib" diff --git a/lib/rbs/resolver/constant_resolver.rb b/lib/rbs/resolver/constant_resolver.rb index e6fe19dff..7c75de218 100644 --- a/lib/rbs/resolver/constant_resolver.rb +++ b/lib/rbs/resolver/constant_resolver.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module Resolver class ConstantResolver diff --git a/lib/rbs/resolver/type_name_resolver.rb b/lib/rbs/resolver/type_name_resolver.rb index 26896b4a5..25893a9bb 100644 --- a/lib/rbs/resolver/type_name_resolver.rb +++ b/lib/rbs/resolver/type_name_resolver.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module Resolver class TypeNameResolver diff --git a/lib/rbs/sorter.rb b/lib/rbs/sorter.rb index 0a2f46208..f03e6613a 100644 --- a/lib/rbs/sorter.rb +++ b/lib/rbs/sorter.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class Sorter include RBS::AST diff --git a/lib/rbs/substitution.rb b/lib/rbs/substitution.rb index faa35feaf..86ca12ca8 100644 --- a/lib/rbs/substitution.rb +++ b/lib/rbs/substitution.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class Substitution attr_reader :mapping diff --git a/lib/rbs/test.rb b/lib/rbs/test.rb index cb999b9de..e24e1e412 100644 --- a/lib/rbs/test.rb +++ b/lib/rbs/test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "securerandom" require "rbs/test/observer" require "rbs/test/spy" diff --git a/lib/rbs/test/errors.rb b/lib/rbs/test/errors.rb index 8fe8f7fbb..b3c186d54 100644 --- a/lib/rbs/test/errors.rb +++ b/lib/rbs/test/errors.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module Test module Errors diff --git a/lib/rbs/test/hook.rb b/lib/rbs/test/hook.rb index b0b02f339..ed6026a13 100644 --- a/lib/rbs/test/hook.rb +++ b/lib/rbs/test/hook.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "rbs" require "pp" diff --git a/lib/rbs/test/observer.rb b/lib/rbs/test/observer.rb index 710d4c171..ff023871a 100644 --- a/lib/rbs/test/observer.rb +++ b/lib/rbs/test/observer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module Test module Observer diff --git a/lib/rbs/test/setup.rb b/lib/rbs/test/setup.rb index 71e2c51bf..df6581626 100644 --- a/lib/rbs/test/setup.rb +++ b/lib/rbs/test/setup.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "rbs" require "rbs/test" require "optparse" diff --git a/lib/rbs/test/setup_helper.rb b/lib/rbs/test/setup_helper.rb index 58edb60f5..03ca94773 100644 --- a/lib/rbs/test/setup_helper.rb +++ b/lib/rbs/test/setup_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module Test module SetupHelper diff --git a/lib/rbs/test/spy.rb b/lib/rbs/test/spy.rb index 2a086064f..766b02bc9 100644 --- a/lib/rbs/test/spy.rb +++ b/lib/rbs/test/spy.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module Test end diff --git a/lib/rbs/test/tester.rb b/lib/rbs/test/tester.rb index 32c588687..4fd3b517c 100644 --- a/lib/rbs/test/tester.rb +++ b/lib/rbs/test/tester.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module Test class Tester diff --git a/lib/rbs/test/type_check.rb b/lib/rbs/test/type_check.rb index 8dfcbd63b..8c4c9b42c 100644 --- a/lib/rbs/test/type_check.rb +++ b/lib/rbs/test/type_check.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module Test class TypeCheck diff --git a/lib/rbs/type_alias_dependency.rb b/lib/rbs/type_alias_dependency.rb index e581866bb..95cf96430 100644 --- a/lib/rbs/type_alias_dependency.rb +++ b/lib/rbs/type_alias_dependency.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class TypeAliasDependency attr_reader :env diff --git a/lib/rbs/type_alias_regularity.rb b/lib/rbs/type_alias_regularity.rb index 66f85d4f9..fbe4b98c7 100644 --- a/lib/rbs/type_alias_regularity.rb +++ b/lib/rbs/type_alias_regularity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class TypeAliasRegularity class Diagnostic diff --git a/lib/rbs/type_name.rb b/lib/rbs/type_name.rb index ceead6a1c..c9245c3f9 100644 --- a/lib/rbs/type_name.rb +++ b/lib/rbs/type_name.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class TypeName attr_reader :namespace diff --git a/lib/rbs/type_name_resolver.rb b/lib/rbs/type_name_resolver.rb index 0e43aec5a..87d1059ed 100644 --- a/lib/rbs/type_name_resolver.rb +++ b/lib/rbs/type_name_resolver.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class TypeNameResolver Query = _ = Struct.new(:type_name, :context, keyword_init: true) diff --git a/lib/rbs/types.rb b/lib/rbs/types.rb index 7cc4617ba..1f5699344 100644 --- a/lib/rbs/types.rb +++ b/lib/rbs/types.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS module Types module NoFreeVariables diff --git a/lib/rbs/validator.rb b/lib/rbs/validator.rb index fae5c78da..77adfd1ca 100644 --- a/lib/rbs/validator.rb +++ b/lib/rbs/validator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class Validator attr_reader :env diff --git a/lib/rbs/variance_calculator.rb b/lib/rbs/variance_calculator.rb index 257189fd8..2c02e6f96 100644 --- a/lib/rbs/variance_calculator.rb +++ b/lib/rbs/variance_calculator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class VarianceCalculator class Result diff --git a/lib/rbs/vendorer.rb b/lib/rbs/vendorer.rb index c374ca664..9e3a35961 100644 --- a/lib/rbs/vendorer.rb +++ b/lib/rbs/vendorer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class Vendorer attr_reader :vendor_dir diff --git a/lib/rbs/version.rb b/lib/rbs/version.rb index 21cf0b4a1..6bc8c93a5 100644 --- a/lib/rbs/version.rb +++ b/lib/rbs/version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS VERSION = "2.6.0" end diff --git a/lib/rbs/writer.rb b/lib/rbs/writer.rb index 22b33314d..8c1c0af3e 100644 --- a/lib/rbs/writer.rb +++ b/lib/rbs/writer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RBS class Writer attr_reader :out @@ -280,7 +282,7 @@ def write_def(member) "self.#{method_name(member.name)}" end - string = "" + string = +"" prefix = "#{visibility}def #{name}:" padding = " " * (prefix.size-1) diff --git a/lib/rdoc/discover.rb b/lib/rdoc/discover.rb index 06b13cd37..1cb9d82cf 100644 --- a/lib/rdoc/discover.rb +++ b/lib/rdoc/discover.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + begin gem 'rdoc', '~> 6.4.0' require 'rdoc_plugin/parser' diff --git a/test/assets/test-gem/amber.gemspec b/test/assets/test-gem/amber.gemspec index 6669094d4..59374af34 100644 --- a/test/assets/test-gem/amber.gemspec +++ b/test/assets/test-gem/amber.gemspec @@ -1,4 +1,5 @@ # coding: utf-8 + lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)