From ef9e0bc8a66fafafd896d27f754f42efbb08cf64 Mon Sep 17 00:00:00 2001 From: Razvan Azamfirei Date: Wed, 9 Aug 2023 14:52:30 -0400 Subject: [PATCH 1/3] cask/audit: audit for appropriate sharding directory --- Library/Homebrew/cask/audit.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index 70412cce30749..eb3f0b48e9965 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -717,6 +717,18 @@ def audit_https_availability strict: strict?) end + sig { void } + def audit_cask_path + return if cask.tap != "homebrew/cask" + + cask_subdir = cask.token[0].downcase + expected_path = "Casks/#{cask_subdir}/#{cask.token}.rb" + + return if cask.ruby_source_path.to_s.end_with?(expected_path) + + add_error "Cask should be located in '#{expected_path}'" + end + # sig { # params(url_to_check: T.any(String, URL), url_type: String, cask_token: String, tap: Tap, # options: T.untyped).void From a916d6184b8415bd252b207b66e3bd4ade7bc253 Mon Sep 17 00:00:00 2001 From: Razvan Azamfirei Date: Wed, 9 Aug 2023 15:26:47 -0400 Subject: [PATCH 2/3] Update Library/Homebrew/cask/audit.rb Co-authored-by: Mike McQuaid --- Library/Homebrew/cask/audit.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index eb3f0b48e9965..b6ad92b7f754e 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -721,8 +721,7 @@ def audit_https_availability def audit_cask_path return if cask.tap != "homebrew/cask" - cask_subdir = cask.token[0].downcase - expected_path = "Casks/#{cask_subdir}/#{cask.token}.rb" + expected_path = cask.tap.new_cask_path(cask.token) return if cask.ruby_source_path.to_s.end_with?(expected_path) From 72df964b33f588c2c1adb2f5963a5679775784eb Mon Sep 17 00:00:00 2001 From: Razvan Azamfirei Date: Wed, 9 Aug 2023 15:27:36 -0400 Subject: [PATCH 3/3] change path --- Library/Homebrew/cask/audit.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index b6ad92b7f754e..3a6569bd8b8bc 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -723,7 +723,7 @@ def audit_cask_path expected_path = cask.tap.new_cask_path(cask.token) - return if cask.ruby_source_path.to_s.end_with?(expected_path) + return if cask.sourcefile_path.to_s.end_with?(expected_path) add_error "Cask should be located in '#{expected_path}'" end