Skip to content

Commit

Permalink
Merge pull request #178913 from Homebrew/s-rubocop-no-rmrf
Browse files Browse the repository at this point in the history
s*: Fix `Homebrew/NoFileutilsRmrf` RuboCop offenses
  • Loading branch information
BrewTestBot authored Jul 31, 2024
2 parents 53d2869 + 825c442 commit b998361
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Formula/s/savana.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Savana < Formula

def install
# Remove Windows files
rm_rf Dir["bin/*.{bat,cmd}"]
rm_r(Dir["bin/*.{bat,cmd}"])

prefix.install %w[COPYING COPYING.LESSER licenses svn-hooks]

Expand Down
2 changes: 1 addition & 1 deletion Formula/s/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ScalaAT212 < Formula
def install
inreplace Dir["man/man1/scala{,c}.1"], "/usr/local", HOMEBREW_PREFIX

rm_f Dir["bin/*.bat"]
rm(Dir["bin/*.bat"])
doc.install Dir["doc/*"]
share.install "man"
libexec.install "bin", "lib"
Expand Down
2 changes: 1 addition & 1 deletion Formula/s/scikit-image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def install
# cleanup leftover .pyc files from previous installs which can cause problems
# see https://github.com/Homebrew/homebrew-python/issues/185#issuecomment-67534979
def post_install
rm_f Dir["#{HOMEBREW_PREFIX}/lib/python*.*/site-packages/skimage/**/*.pyc"]
rm(Dir["#{HOMEBREW_PREFIX}/lib/python*.*/site-packages/skimage/**/*.pyc"])
end

test do
Expand Down
2 changes: 1 addition & 1 deletion Formula/s/scipy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def install
# cleanup leftover .pyc files from previous installs which can cause problems
# see https://github.com/Homebrew/homebrew-python/issues/185#issuecomment-67534979
def post_install
rm_f Dir["#{HOMEBREW_PREFIX}/lib/python*.*/site-packages/scipy/**/*.pyc"]
rm(Dir["#{HOMEBREW_PREFIX}/lib/python*.*/site-packages/scipy/**/*.pyc"])
end

test do
Expand Down
4 changes: 2 additions & 2 deletions Formula/s/scummvm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def install
"--with-sdl-prefix=#{Formula["sdl2"].opt_prefix}"
system "make"
system "make", "install"
(share/"pixmaps").rmtree
(share/"icons").rmtree
rm_r(share/"pixmaps")
rm_r(share/"icons")
end

test do
Expand Down
4 changes: 2 additions & 2 deletions Formula/s/sfml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ def install
# Fix "fatal error: 'os/availability.h' file not found" on 10.11 and
# "error: expected function body after function declarator" on 10.12
# Requires the CLT to be the active developer directory if Xcode is installed
ENV["SDKROOT"] = MacOS.sdk_path if OS.mac? && version <= :high_sierra
ENV["SDKROOT"] = MacOS.sdk_path if OS.mac? && MacOS.version <= :high_sierra

# Always remove the "extlibs" to avoid install_name_tool failure
# (https://github.com/Homebrew/homebrew/pull/35279) but leave the
# headers that were moved there in https://github.com/SFML/SFML/pull/795
rm_rf Dir["extlibs/*"] - ["extlibs/headers"]
rm_r(Dir["extlibs/*"] - ["extlibs/headers"])

args = ["-DCMAKE_INSTALL_RPATH=#{lib}",
"-DSFML_MISC_INSTALL_PREFIX=#{share}/SFML",
Expand Down
10 changes: 4 additions & 6 deletions Formula/s/shared-mime-info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,18 @@ def install
system "meson", "compile", "-C", "build", "--verbose"
system "meson", "install", "-C", "build"
pkgshare.install share/"mime/packages"
rmdir share/"mime"
rm_r(share/"mime") if (share/"mime").exist?
end

def post_install
global_mime = HOMEBREW_PREFIX/"share/mime"
cellar_mime = share/"mime"

# Remove bad links created by old libheif postinstall
rm_rf global_mime if global_mime.symlink?
rm_r(global_mime) if global_mime.symlink?

if !cellar_mime.exist? || !cellar_mime.symlink?
rm_rf cellar_mime
ln_sf global_mime, cellar_mime
end
rm_r(cellar_mime) if cellar_mime.exist? && !cellar_mime.symlink?
ln_sf(global_mime, cellar_mime)

(global_mime/"packages").mkpath
cp (pkgshare/"packages").children, global_mime/"packages"
Expand Down
2 changes: 1 addition & 1 deletion Formula/s/snakemake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ class Snakemake < Formula

def install
venv = virtualenv_install_with_resources
(venv.site_packages/"pulp/solverdir/cbc").rmtree
rm_r(venv.site_packages/"pulp/solverdir/cbc")
end

test do
Expand Down
4 changes: 2 additions & 2 deletions Formula/s/snowpack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ def install
os = OS.kernel_name.downcase
arch = Hardware::CPU.intel? ? "x64" : Hardware::CPU.arch.to_s
libexec.glob("lib/node_modules/snowpack/node_modules/{bufferutil,utf-8-validate}/prebuilds/*")
.each { |dir| dir.rmtree if dir.basename.to_s != "#{os}-#{arch}" }
.each { |dir| rm_r(dir) if dir.basename.to_s != "#{os}-#{arch}" }
# `rollup` < 2.38.3 uses x86_64-specific `fsevents`. Can remove when `rollup` is updated.
(libexec/"lib/node_modules/snowpack/node_modules/rollup/node_modules/fsevents").rmtree if Hardware::CPU.arm?
rm_r(libexec/"lib/node_modules/snowpack/node_modules/rollup/node_modules/fsevents") if Hardware::CPU.arm?

# Replace universal binaries with their native slices
deuniversalize_machos
Expand Down
2 changes: 1 addition & 1 deletion Formula/s/sonar-scanner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SonarScanner < Formula
depends_on "openjdk"

def install
rm_rf Dir["bin/*.bat"]
rm_r(Dir["bin/*.bat"])
libexec.install Dir["*"]
bin.install libexec/"bin/sonar-scanner"
etc.install libexec/"conf/sonar-scanner.properties"
Expand Down
2 changes: 1 addition & 1 deletion Formula/s/sonarqube-lts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def install
["macosx", "linux-x86"]
end

rm_rf Dir["bin/{#{remove},windows}-*"]
rm_r(Dir["bin/{#{remove},windows}-*"])

libexec.install Dir["*"]

Expand Down
2 changes: 1 addition & 1 deletion Formula/s/sql-language-server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def install

# Remove vendored pre-built binary `terminal-notifier`
node_notifier_vendor_dir = libexec/"lib/node_modules/sql-language-server/node_modules/node-notifier/vendor"
node_notifier_vendor_dir.rmtree # remove vendored pre-built binaries
rm_r(node_notifier_vendor_dir) # remove vendored pre-built binaries

if OS.mac?
terminal_notifier_dir = node_notifier_vendor_dir/"mac.noindex"
Expand Down
2 changes: 1 addition & 1 deletion Formula/s/sratoolkit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def install
system "cmake", "--install", "sra-tools-build"

# Remove non-executable files.
(bin/"ncbi").rmtree
rm_r(bin/"ncbi")
end

test do
Expand Down
2 changes: 1 addition & 1 deletion Formula/s/structurizr-cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class StructurizrCli < Formula
depends_on "openjdk"

def install
rm_f Dir["*.bat"]
rm(Dir["*.bat"])
libexec.install Dir["*"]
(bin/"structurizr-cli").write_env_script libexec/"structurizr.sh", Language::Java.overridable_java_home_env
end
Expand Down
2 changes: 1 addition & 1 deletion Formula/s/subversion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def install
# purged by Homebrew's post-install cleaner because that doesn't check
# "Library" directories. It is however pointless to keep around as it
# only contains the perllocal.pod installation file.
rm_rf prefix/"Library/Perl"
rm_r(prefix/"Library/Perl") if (prefix/"Library/Perl").exist?
end

def caveats
Expand Down
2 changes: 1 addition & 1 deletion Formula/s/sundials.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def install
# Only keep one example for testing purposes
(pkgshare/"examples").install Dir[prefix/"examples/nvector/serial/*"] \
- Dir[prefix/"examples/nvector/serial/{CMake*,Makefile}"]
(prefix/"examples").rmtree
rm_r(prefix/"examples")
end

test do
Expand Down
6 changes: 3 additions & 3 deletions Formula/s/supertux.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ def install
system "cmake", "--install", "build"

# Remove unnecessary files
(share/"applications").rmtree
(share/"pixmaps").rmtree
(prefix/"MacOS").rmtree if OS.mac?
rm_r(share/"applications")
rm_r(share/"pixmaps")
rm_r(prefix/"MacOS") if OS.mac?
end

test do
Expand Down

0 comments on commit b998361

Please sign in to comment.