Skip to content

Commit

Permalink
Merge pull request #2233 from tk0miya/fix_typo
Browse files Browse the repository at this point in the history
Fix typos
  • Loading branch information
soutaro authored Jan 15, 2025
2 parents 5c48490 + 8d77b95 commit bb72136
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions lib/rbs/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ def run_prototype(args, options)
merge = true
end
opts.on("--todo", "Generates only undefined methods compared to objects") do
Warning.warn("Geneating prototypes with `--todo` option is experimental\n", category: :experimental)
Warning.warn("Generating prototypes with `--todo` option is experimental\n", category: :experimental)
todo = true
end
opts.on("--method-owner CLASS", "Generate method prototypes if the owner of the method is [CLASS]") do |klass|
Expand Down Expand Up @@ -1155,15 +1155,15 @@ def run_subtract(args, _)
# Generate RBS files from the codebase.
$ rbs prototype rb lib/ > generated.rbs
# Write more descrictive types by hand.
# Write more descriptive types by hand.
$ $EDITOR handwritten.rbs
# Remove hand-written method definitions from generated.rbs.
$ rbs subtract --write generated.rbs handwritten.rbs
Options:
HELP
opts.on('-w', '--write', 'Overwrite files directry') { write_to_file = true }
opts.on('-w', '--write', 'Overwrite files directory') { write_to_file = true }
opts.on('--subtrahend=PATH', '') { |path| subtrahend_paths << path }
opts.parse!(args)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rbs/collection/sources/rubygems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module RBS
module Collection
module Sources
# Signatures that are inclduded in gem package as sig/ directory.
# Signatures that are included in gem package as sig/ directory.
class Rubygems
include Base
include Singleton
Expand Down
6 changes: 3 additions & 3 deletions lib/rbs/subtractor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def call(minuend = @minuend, context: nil)
name = absolute_typename(decl.new_name, context: context)
decl unless @subtrahend.module_alias?(name) || @subtrahend.module_decl?(name)
else
raise "unknwon decl: #{(_ = decl).class}"
raise "unknown decl: #{(_ = decl).class}"
end
end.compact
end
Expand All @@ -51,7 +51,7 @@ def call(minuend = @minuend, context: nil)
context = _ = [context, decl.name]
children = call(decl.each_decl.to_a, context: context) +
decl.each_member.reject { |m| member_exist?(owner, m, context: context) }
children = filter_redundunt_access_modifiers(children)
children = filter_redundant_access_modifiers(children)
return nil if children.empty?

update_decl(decl, members: children)
Expand Down Expand Up @@ -145,7 +145,7 @@ def call(minuend = @minuend, context: nil)
end
end

private def filter_redundunt_access_modifiers(decls)
private def filter_redundant_access_modifiers(decls)
decls = decls.dup
decls.pop while access_modifier?(decls.last)
decls = decls.map.with_index do |decl, i|
Expand Down
4 changes: 2 additions & 2 deletions lib/rbs/test/hook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ module Hook
:! => "not",
:<< => "lshift",
:>> => "rshift",
:~ => "tilda",
:=~ => "eqtilda",
:~ => "tilde",
:=~ => "eqtilde",
:% => "percent",
:+@ => "unary_plus",
:-@ => "unary_minus"
Expand Down
2 changes: 1 addition & 1 deletion lib/rbs/types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ def initialize(all_fields: nil, fields: nil, location:)
end
end
else
raise ArgumentError, "only one of `:fields` or `:all_fields` is requireds"
raise ArgumentError, "only one of `:fields` or `:all_fields` is required"
end

@location = location
Expand Down
2 changes: 1 addition & 1 deletion sig/subtractor.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module RBS

private def mixin_exist?: (TypeName owner, AST::Members::Include | AST::Members::Extend | AST::Members::Prepend, context: Resolver::context) -> boolish

private def filter_redundunt_access_modifiers: (Array[AST::Declarations::t | AST::Members::t]) -> Array[AST::Declarations::t | AST::Members::t]
private def filter_redundant_access_modifiers: (Array[AST::Declarations::t | AST::Members::t]) -> Array[AST::Declarations::t | AST::Members::t]

private def access_modifier?: (AST::Declarations::t | AST::Members::t?) -> bool

Expand Down
4 changes: 2 additions & 2 deletions test/rbs/cli_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def stderr
# Run `rbs collection` with fresh bundler environment
#
# You need this method to test `rbs collection` features.
# `rbs collection` loads gems from Bundler context, so re-using the currenr Bundler context (used to develop rbs gem) causes issues.
# `rbs collection` loads gems from Bundler context, so re-using the current Bundler context (used to develop rbs gem) causes issues.
#
# - If `bundler: true` is given, it runs `rbs collection` command with `bundle exec`
# - If `bundler: false` is given, it runs `rbs collection` command without `bundle exec`
Expand Down Expand Up @@ -1127,7 +1127,7 @@ def test_prototype__runtime__todo
assert_equal <<~EOM, cli.stdout.string
EOM

assert_match Regexp.new(Regexp.escape "Geneating prototypes with `--todo` option is experimental"), cli.stderr.string
assert_match Regexp.new(Regexp.escape "Generating prototypes with `--todo` option is experimental"), cli.stderr.string
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions test/rbs/definition_builder_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1635,8 +1635,8 @@ def initialize: (String, Integer) -> void
builder = DefinitionBuilder.new(env: env)

builder.build_instance(type_name("::Hello")).tap do |definition|
initalize = definition.methods[:initialize]
assert_equal ["(::String, ::Integer) -> void"], initalize.method_types.map(&:to_s)
initialize = definition.methods[:initialize]
assert_equal ["(::String, ::Integer) -> void"], initialize.method_types.map(&:to_s)
end

builder.build_singleton(type_name("::Hello")).tap do |definition|
Expand Down Expand Up @@ -2687,7 +2687,7 @@ module Bar : Foo
end
end

def test_alias__to_module_self_indierect_method
def test_alias__to_module_self_indirect_method
SignatureManager.new(system_builtin: false) do |manager|
manager.add_file("foo.rbs", <<-EOF)
module Kernel
Expand Down
4 changes: 2 additions & 2 deletions test/rbs/parser_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def test_module_decl_nested
module Foo
type foo = bar
BAZ: Intger
BAZ: Integer
end
RBS

Expand Down Expand Up @@ -733,7 +733,7 @@ def test_parse_method_type2
end
end

def test_neline_inconsitency
def test_newline_inconsistency
code = "module Test\r\nend"

RBS::Parser.parse_signature(code)
Expand Down
2 changes: 1 addition & 1 deletion test/rbs/types_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def test_with_nonreturn_void?

[
"^() -> void",
"[Ineger, String]",
"[Integer, String]",
"Enumerator[Integer, void]"
].each do |str|
type = parse_type(str)
Expand Down

0 comments on commit bb72136

Please sign in to comment.