From af90f0858a03c4078bdc9eb7641d3398d87ebb89 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Sun, 21 Jan 2024 22:25:33 +0000 Subject: [PATCH] Fix RuboCop `Layout/` group offenses in docs example code --- docs/Adding-Software-to-Homebrew.md | 2 +- docs/Cask-Cookbook.md | 12 ++-- docs/Formula-Cookbook.md | 56 +++++++++---------- ...Homebrew-homebrew-core-Maintainer-Guide.md | 4 +- docs/License-Guidelines.md | 4 +- 5 files changed, 39 insertions(+), 39 deletions(-) diff --git a/docs/Adding-Software-to-Homebrew.md b/docs/Adding-Software-to-Homebrew.md index 342e900e0b..f084cbffea 100644 --- a/docs/Adding-Software-to-Homebrew.md +++ b/docs/Adding-Software-to-Homebrew.md @@ -242,7 +242,7 @@ Example: 1. So, the `app` stanza should include the subfolder as a relative path: ```ruby - app "Simple Floating Clock/SimpleFloatingClock.app" +app "Simple Floating Clock/SimpleFloatingClock.app" ``` ### Testing and auditing the cask diff --git a/docs/Cask-Cookbook.md b/docs/Cask-Cookbook.md index 48660d7bbd..0febfdd21e 100644 --- a/docs/Cask-Cookbook.md +++ b/docs/Cask-Cookbook.md @@ -846,12 +846,12 @@ An example, with commonly used signals in ascending order of severity: ```ruby uninstall signal: [ - ["TERM", "fr.madrau.switchresx.daemon"], - ["QUIT", "fr.madrau.switchresx.daemon"], - ["INT", "fr.madrau.switchresx.daemon"], - ["HUP", "fr.madrau.switchresx.daemon"], - ["KILL", "fr.madrau.switchresx.daemon"], - ] + ["TERM", "fr.madrau.switchresx.daemon"], + ["QUIT", "fr.madrau.switchresx.daemon"], + ["INT", "fr.madrau.switchresx.daemon"], + ["HUP", "fr.madrau.switchresx.daemon"], + ["KILL", "fr.madrau.switchresx.daemon"], +] ``` Note that when multiple running processes match the given bundle ID, all matching processes will be signaled. diff --git a/docs/Formula-Cookbook.md b/docs/Formula-Cookbook.md index 90cdecdf3c..03c05d3091 100644 --- a/docs/Formula-Cookbook.md +++ b/docs/Formula-Cookbook.md @@ -168,8 +168,8 @@ A `Hash` (e.g. `=>`) adds information to a dependency. Given a string or symbol, * `:recommended` (not allowed in `Homebrew/homebrew-core`) generates an implicit `without-foo` option, meaning that the dependency is enabled by default and the user must pass `--without-foo` to disable this dependency. The default description can be overridden using the [`option`](https://rubydoc.brew.sh/Formula#option-class_method) syntax (in this case, the [`option` declaration](#adding-optional-steps) must precede the dependency): ```ruby - option "with-foo", "Compile with foo bindings" # This overrides the generated description if you want to - depends_on "foo" => :optional # Generated description would otherwise be "Build with foo support" +option "with-foo", "Compile with foo bindings" # This overrides the generated description if you want to +depends_on "foo" => :optional # Generated description would otherwise be "Build with foo support" ``` * `""` (not allowed in `Homebrew/homebrew-core`) requires a dependency to have been built with the specified option. @@ -856,25 +856,25 @@ Several other utilities for Ruby's [`Pathname`](https://rubydoc.brew.sh/Pathname * To perform several operations within a directory, enclose them within a [`cd do`](https://rubydoc.brew.sh/Pathname#cd-instance_method) block: ```ruby - cd "src" do - system "./configure", "--disable-debug", "--prefix=#{prefix}" - system "make", "install" - end +cd "src" do + system "./configure", "--disable-debug", "--prefix=#{prefix}" + system "make", "install" +end ``` * To surface one or more binaries buried in `libexec` or a macOS `.app` package, use [`write_exec_script`](https://rubydoc.brew.sh/Pathname#write_exec_script-instance_method) or [`write_jar_script`](https://rubydoc.brew.sh/Pathname#write_jar_script-instance_method): ```ruby - bin.write_exec_script (libexec/"bin").children - bin.write_exec_script prefix/"Package.app/Contents/MacOS/package" - bin.write_jar_script libexec/jar_file, "jarfile", java_version: "11" +bin.write_exec_script (libexec/"bin").children +bin.write_exec_script prefix/"Package.app/Contents/MacOS/package" +bin.write_jar_script libexec/jar_file, "jarfile", java_version: "11" ``` * For binaries that require setting one or more environment variables to function properly, use [`write_env_script`](https://rubydoc.brew.sh/Pathname#write_env_script-instance_method) or [`env_script_all_files`](https://rubydoc.brew.sh/Pathname#env_script_all_files-instance_method): ```ruby - (bin/"package").write_env_script libexec/"package", PACKAGE_ROOT: libexec - bin.env_script_all_files(libexec/"bin", PERL5LIB: ENV["PERL5LIB"]) +(bin/"package").write_env_script libexec/"package", PACKAGE_ROOT: libexec +bin.env_script_all_files(libexec/"bin", PERL5LIB: ENV["PERL5LIB"]) ``` ### Rewriting a script shebang @@ -895,8 +895,8 @@ class Yourformula < Formula option "with-ham", "Description of the option" option "without-spam", "Another description" - depends_on "foo" => :optional # automatically adds a with-foo option - depends_on "bar" => :recommended # automatically adds a without-bar option + depends_on "foo" => :optional # automatically adds a with-foo option + depends_on "bar" => :recommended # automatically adds a without-bar option # ... end ``` @@ -943,10 +943,10 @@ There are two ways to add `launchd` plists and `systemd` services to a formula, 1. If the package already provides a service file the formula can reference it by name: ```ruby - service do - name macos: "custom.launchd.name", - linux: "custom.systemd.name" - end +service do + name macos: "custom.launchd.name", + linux: "custom.systemd.name" +end ``` To find the file we append `.plist` to the `launchd` service name and `.service` to the `systemd` service name internally. @@ -955,20 +955,20 @@ There are two ways to add `launchd` plists and `systemd` services to a formula, ```ruby # 1. An individual command - service do - run opt_bin/"script" - end +service do + run opt_bin/"script" +end # 2. A command with arguments - service do - run [opt_bin/"script", "--config", etc/"dir/config.yml"] - end +service do + run [opt_bin/"script", "--config", etc/"dir/config.yml"] +end # 3. OS specific commands (If you omit one, the service file won't get generated for that OS.) - service do - run macos: [opt_bin/"macos_script", "standalone"], - linux: var/"special_linux_script" - end +service do + run macos: [opt_bin/"macos_script", "standalone"], + linux: var/"special_linux_script" +end ``` #### Service block methods @@ -1159,7 +1159,7 @@ If a project's makefile will not run in parallel, try to deparallelize by adding ```ruby ENV.deparallelize -system "make" # separate compilation and installation steps +system "make" # separate compilation and installation steps system "make", "install" ``` diff --git a/docs/Homebrew-homebrew-core-Maintainer-Guide.md b/docs/Homebrew-homebrew-core-Maintainer-Guide.md index 1989e8cd1c..074cc2388c 100644 --- a/docs/Homebrew-homebrew-core-Maintainer-Guide.md +++ b/docs/Homebrew-homebrew-core-Maintainer-Guide.md @@ -158,9 +158,9 @@ Solution: ```ruby if OS.mac? - system ENV.cc, "-I#{include}", "-L#{lib}", "-lmagic", "test.c", "-o", "test" + system ENV.cc, "-I#{include}", "-L#{lib}", "-lmagic", "test.c", "-o", "test" else - system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-lmagic", "-o", "test" + system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-lmagic", "-o", "test" end ``` diff --git a/docs/License-Guidelines.md b/docs/License-Guidelines.md index dade76c70d..8811a14da0 100644 --- a/docs/License-Guidelines.md +++ b/docs/License-Guidelines.md @@ -68,8 +68,8 @@ These expressions can be nested as needed: license any_of: [ "MIT", :public_domain, - all_of: ["0BSD", "Zlib", "Artistic-1.0+"], - "Apache-2.0" => { with: "LLVM-exception" }, + { all_of: ["0BSD", "Zlib", "Artistic-1.0+"], + "Apache-2.0" => { with: "LLVM-exception" } }, ] ```