Repository: soutaro/steep (Ruby)

Issue:
Wildcard not expanding in Steepfile, affecting `steep stats`
## Summary
When running the `steep stats` command, if the `check` path specified in the `Steepfile` uses a wildcard (`*`), the wildcard is not expanded properly, and as a result, the file names do not match, which causes the `steep stats` results to not display the files.

## Steps to Reproduce
Apply the following commit to the `sample` project, and then execute `bundle exec steep stats` in the `sample` directory.

```diff
 sample/Steepfile           | 2 +-
 sample/lib/foo/bar/baz.rb  | 5 +++++
 sample/sig/foo/bar/baz.rbs | 3 +++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/sample/Steepfile b/sample/Steepfile
index aeb2e4c8..0e1798fe 100644
--- a/sample/Steepfile
+++ b/sample/Steepfile
@@ -3,7 +3,7 @@ D = Steep::Diagnostic
 target :lib do
   signature "sig"

-  check "lib"                       # Directory name
+  check "lib/*/bar"                       # Directory name

   library "rbs"

diff --git a/sample/lib/foo/bar/baz.rb b/sample/lib/foo/bar/baz.rb
new file mode 100644
index 00000000..cf47d591
--- /dev/null
+++ b/sample/lib/foo/bar/baz.rb
@@ -0,0 +1,5 @@
+class Baz
+  def hello
+    'hello'
+  end
+end

diff --git a/sample/sig/foo/bar/baz.rbs b/sample/sig/foo/bar/baz.rbs
new file mode 100644
index 00000000..e4b248bf
--- /dev/null
+++ b/sample/sig/foo/bar/baz.rbs
@@ -0,0 +1,3 @@
+class Baz
+  def hello: -> String
+end
```

## Expected Result
Only the statistics for `lib/foo/bar/baz.rb` should be displayed as follows:

```
[teppei@TeppeinoMacBook-Air] ~/workspace/src/github.com/euglena1215/steep/sample
% bundle exec steep stats
# Calculating stats:

 Target  File                  Status   Typed calls  Untyped calls  All calls  Typed %
---------------------------------------------------------------------------------------
 lib     lib/foo/bar/baz.rb    success            0              0          0     100%
```

## Actual Result
However, due to the wildcard not being expanded, the file `lib/foo/bar/baz.rb` does not appear in the `steep stats` results.

```
[teppei@TeppeinoMacBook-Air] ~/workspace/src/github.com/euglena1215/steep/sample
% bundle exec steep stats
# Calculating stats:

 Target  File  Status  Typed calls  Untyped calls  All calls  Typed %
----------------------------------------------------------------------
```


Discussion:

Patch:
diff --git a/lib/steep/project/pattern.rb b/lib/steep/project/pattern.rb
index 6b7295afb..2b5e5c76d 100644
--- a/lib/steep/project/pattern.rb
+++ b/lib/steep/project/pattern.rb
@@ -46,10 +46,9 @@ def ignore?(path)
 
       def test_string(path, patterns, prefixes)
         string = path.to_s
-        extension = path.extname
 
         patterns.any? {|pat| File.fnmatch(pat, string, File::FNM_PATHNAME) } ||
-          prefixes.any? {|prefix| string.start_with?(prefix) && extension == ext }
+          prefixes.any? {|prefix| File.fnmatch("#{prefix}**/*#{ext}", string, File::FNM_PATHNAME) }
       end
     end
   end


Test patch:
diff --git a/test/pattern_test.rb b/test/pattern_test.rb
index 0d2b91c77..e31a3149f 100644
--- a/test/pattern_test.rb
+++ b/test/pattern_test.rb
@@ -13,4 +13,14 @@ def test_pattern
     assert_operator pattern, :=~, "app/controllers/admin_controller.rb"
     assert_operator pattern, :=~, "app/controllers/api/v2/accounts_controller.rb"
   end
+
+  def test_pattern_with_glob
+    pattern = Project::Pattern.new(
+      patterns: ["app/models/*/bar"],
+      ext: ".rb"
+    )
+
+    assert_operator pattern, :=~, "app/models/foo/bar/baz.rb"
+    assert_operator pattern, :=~, "app/models/foo/bar/baz/qux.rb"
+  end
 end