a*: move to a/ subdirectory.#138921
a*: move to a/ subdirectory.#138921MikeMcQuaid merged 1 commit intoHomebrew:masterfrom MikeMcQuaid:shard_a
Conversation
|
Aliases need updating. The code for tracking style exceptions also needs to be modified to take sharding into account. It seems to me that a lot of this would be simplified if we had code for finding the repository root given a file. |
@carlocab Will do these, thanks 👍🏻.
Can you elaborate a bit on that? I think we might do. |
This is just following-up from my observation at Homebrew/brew#15740 (comment). It seems like there are a few places where we have a path but we want to know the tap repository it came from. Actually, I think we kind of already have one: diff --git a/Library/Homebrew/rubocops/extend/formula_cop.rb b/Library/Homebrew/rubocops/extend/formula_cop.rb
index 2ad09eaa4..59cdc38b8 100644
--- a/Library/Homebrew/rubocops/extend/formula_cop.rb
+++ b/Library/Homebrew/rubocops/extend/formula_cop.rb
@@ -159,19 +159,19 @@ module RuboCop
# Returns the formula tap.
def formula_tap
- return unless (match_obj = @file_path.match(%r{/(homebrew-\w+)/}))
+ return unless (file_tap = Tap.from_path(@file_path))
- match_obj[1]
+ file_tap
end
# Returns whether the given formula exists in the given style exception list.
# Defaults to the current formula being checked.
def tap_style_exception?(list, formula = nil)
- if @tap_style_exceptions.nil? && !formula_tap.nil?
+ if @tap_style_exceptions.nil? && formula_tap.present?
@tap_style_exceptions = {}
- style_exceptions_dir = "#{File.dirname(File.dirname(@file_path))}/style_exceptions/*.json"
- Pathname.glob(style_exceptions_dir).each do |exception_file|
+ style_exceptions_dir = "style_exceptions/*.json"
+ formula_tap.path.glob(style_exceptions_dir).each do |exception_file|
list_name = exception_file.basename.to_s.chomp(".json").to_sym
list_contents = begin
JSON.parse exception_file.readThe other callers of |
Almost certainly can't use
Generally agree but: see above 😁 |
Continuing the sharding work now that `ack.rb` was moved without issue.
Continuing the sharding work now that
ack.rbwas moved without issue.