Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rbs/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ def run_annotate(args, options)
args.each do |file|
path = Pathname(file)
if path.directory?
Pathname.glob((path + "**/*.rbs").to_s).each do |path|
path.glob("**/*.rbs").each do |path|
stdout.puts "Processing #{path}..."
annotator.annotate_file(path)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rbs/file_finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def self.each_file(path, immediate: nil, skip_hidden:, &block)
yield path

when path.directory?
paths = Pathname.glob("#{path}/**/*.rbs")
paths = path.glob("**/*.rbs")

if skip_hidden
paths.select! do |child|
Expand Down
8 changes: 8 additions & 0 deletions test/rbs/file_finder_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,12 @@ def test_dir_path
assert_equal [tmpdir + "_private/app/x.rbs"], FileFinder.each_file(tmpdir + "_private", skip_hidden: true).to_a
assert_equal [tmpdir + "_private/_internal/y.rbs", tmpdir + "_private/app/x.rbs"], FileFinder.each_file(tmpdir + "_private", skip_hidden: false).to_a
end

def test_dir_path_with_glob_metacharacters
(tmpdir / "sig[1]").mkpath
(tmpdir / "sig[1]/c.rbs").write("")

assert_equal [tmpdir + "sig[1]/c.rbs"], FileFinder.each_file(tmpdir + "sig[1]", skip_hidden: true).to_a
assert_equal [tmpdir + "sig[1]/c.rbs"], FileFinder.each_file(tmpdir + "sig[1]", skip_hidden: false).to_a
end
end
Loading