style: fix path checking.

Add all necessary files to the path, using globs when necessary.
This commit is contained in:
Mike McQuaid 2024-06-12 16:04:17 +01:00
parent af02d94f73
commit 9e863aa4a9
No known key found for this signature in database

View File

@ -44,9 +44,9 @@ module Homebrew
debug: false, verbose: false) debug: false, verbose: false)
raise ArgumentError, "Invalid output type: #{output_type.inspect}" if [:print, :json].exclude?(output_type) raise ArgumentError, "Invalid output type: #{output_type.inspect}" if [:print, :json].exclude?(output_type)
ruby_files = [] ruby_files = T.let([], T::Array[Pathname])
shell_files = [] shell_files = T.let([], T::Array[Pathname])
actionlint_files = [] actionlint_files = T.let([], T::Array[Pathname])
Array(files).map(&method(:Pathname)) Array(files).map(&method(:Pathname))
.each do |path| .each do |path|
case path.extname case path.extname
@ -57,8 +57,14 @@ module Homebrew
when ".yml" when ".yml"
actionlint_files << path if path.realpath.to_s.include?("/.github/workflows/") actionlint_files << path if path.realpath.to_s.include?("/.github/workflows/")
else else
ruby_files << path if path.tap? ruby_files << path
shell_files << path if path.realpath == HOMEBREW_BREW_FILE.realpath shell_files += if [HOMEBREW_PREFIX, HOMEBREW_REPOSITORY].include?(path)
shell_scripts
else
path.glob("**/*.sh")
.reject { |path| path.to_s.include?("/vendor/") }
end
actionlint_files += (path/".github/workflows").glob("*.y{,a}ml")
end end
end end