Skip to content

Commit

Permalink
style: fix path checking.
Browse files Browse the repository at this point in the history
Add all necessary files to the path, using globs when necessary.
  • Loading branch information
MikeMcQuaid committed Jun 13, 2024
1 parent 2c6a5a6 commit 24483bb
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions Library/Homebrew/style.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def self.check_style_impl(files, output_type,
debug: false, verbose: false)
raise ArgumentError, "Invalid output type: #{output_type.inspect}" if [:print, :json].exclude?(output_type)

ruby_files = []
shell_files = []
actionlint_files = []
ruby_files = T.let([], T::Array[Pathname])
shell_files = T.let([], T::Array[Pathname])
actionlint_files = T.let([], T::Array[Pathname])
Array(files).map(&method(:Pathname))
.each do |path|
case path.extname
Expand All @@ -57,8 +57,14 @@ def self.check_style_impl(files, output_type,
when ".yml"
actionlint_files << path if path.realpath.to_s.include?("/.github/workflows/")
else
ruby_files << path if path.tap?
shell_files << path if path.realpath == HOMEBREW_BREW_FILE.realpath
ruby_files << path
shell_files += if [HOMEBREW_PREFIX, HOMEBREW_REPOSITORY].include?(path)

Check warning on line 61 in Library/Homebrew/style.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/style.rb#L61

Added line #L61 was not covered by tests
shell_scripts
else
path.glob("**/*.sh")
.reject { |path| path.to_s.include?("/vendor/") }

Check warning on line 65 in Library/Homebrew/style.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/style.rb#L65

Added line #L65 was not covered by tests
end
actionlint_files += (path/".github/workflows").glob("*.y{,a}ml")

Check warning on line 67 in Library/Homebrew/style.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/style.rb#L67

Added line #L67 was not covered by tests
end
end

Expand Down

0 comments on commit 24483bb

Please sign in to comment.