Match indent of templated items to pass brew audit#55
Merged
Justintime50 merged 7 commits intoJustintime50:mainfrom Apr 27, 2025
Merged
Match indent of templated items to pass brew audit#55Justintime50 merged 7 commits intoJustintime50:mainfrom
Justintime50 merged 7 commits intoJustintime50:mainfrom
Conversation
If templated strings are multiline, like `test` and `install`, then they should be adjusted to match the indent of the formula yaml, or `brew audit` will complain. Signed-off-by: Ross Williams <ross@ross-williams.net>
Owner
|
Awesome! Do you mind sharing a quick example of before the fix and after? Want to see it in action. |
Signed-off-by: Ross Williams <ross@ross-williams.net>
Signed-off-by: Ross Williams <ross@ross-williams.net>
Signed-off-by: Ross Williams <ross@ross-williams.net>
Contributor
Author
|
I pushed some unit tests that prompted me to fix an issue. The commit log is noisy, so let me know if you'd like me to squash before you merge. A comparison of output before and after the change: Diff of output: --- test/formulas/test_generate_formula_multiline_test.rb 2025-04-25 16:58:27
+++ test/formulas/test_generate_formula_multiline_test.rb 2025-04-25 16:57:31
@@ -18,10 +18,10 @@
test do
output = shell_output(%Q(
- for test_case in case1 case2 case3; do
- run_case $test_case
- done
-))
-assert_match("my script output", output)
+ for test_case in case1 case2 case3; do
+ run_case $test_case
+ done
+ ))
+ assert_match("my script output", output)
end
endBefore: # typed: true
# frozen_string_literal: true
# This file was generated by Homebrew Releaser. DO NOT EDIT.
class TestGenerateFormulaMultilineTest < Formula
desc "Release scripts, binaries, and executables to github"
homepage "https://github.com/Justintime50/test-generate-formula-multiline-test"
url "https://github.com/Justintime50/test-generate-formula-multiline-test/archive/refs/tags/v0.1.0.tar.gz"
sha256 "0000000000000000000000000000000000000000000000000000000000000000"
license "MIT"
depends_on "bash" => :build
depends_on "gcc"
def install
bin.install "src/secure-browser-kiosk.sh" => "secure-browser-kiosk"
end
test do
output = shell_output(%Q(
for test_case in case1 case2 case3; do
run_case $test_case
done
))
assert_match("my script output", output)
end
endAfter: # typed: true
# frozen_string_literal: true
# This file was generated by Homebrew Releaser. DO NOT EDIT.
class TestGenerateFormulaMultilineTest < Formula
desc "Release scripts, binaries, and executables to github"
homepage "https://github.com/Justintime50/test-generate-formula-multiline-test"
url "https://github.com/Justintime50/test-generate-formula-multiline-test/archive/refs/tags/v0.1.0.tar.gz"
sha256 "0000000000000000000000000000000000000000000000000000000000000000"
license "MIT"
depends_on "bash" => :build
depends_on "gcc"
def install
bin.install "src/secure-browser-kiosk.sh" => "secure-browser-kiosk"
end
test do
output = shell_output(%Q(
for test_case in case1 case2 case3; do
run_case $test_case
done
))
assert_match("my script output", output)
end
end |
Owner
Justintime50
left a comment
There was a problem hiding this comment.
praise: this is great work, thanks for putting up this PR and adding tests! I have a couple small items. Once addressed I'll merge in and release!
Contributor
Author
|
Right on with the feedback. I'm glad I've got you as a solid reviewer looking over this, because apparently I've got the Friday sloppies. Let me get some recharge, and I'll come back and tighten it up. |
Fix doc comment and type hints, also. Signed-off-by: Ross Williams <ross@ross-williams.net>
Signed-off-by: Ross Williams <ross@ross-williams.net>
`brew audit` didn't like `%Q()` when the quoted string did not contain both single and double quotes, so add some unnecessary shell quoting to the example, since it's just a non-working snippet to test string indent handling. Signed-off-by: Ross Williams <ross@ross-williams.net>
Justintime50
approved these changes
Apr 27, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If templated strings are multiline, like
testandinstall, then they should be adjusted to match the indent of the formula yaml, orbrew auditwill complain.