Skip to content

Commit

Permalink
Merge pull request #157456 from Bo98/style-dec2023
Browse files Browse the repository at this point in the history
Fix various style issues under newer RuboCop
  • Loading branch information
ZhongRuoyu authored Dec 15, 2023
2 parents 2436328 + 0664c75 commit f62cd33
Show file tree
Hide file tree
Showing 26 changed files with 29 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Formula/b/bwfmetaedit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Bwfmetaedit < Formula

def install
cd "Project/GNU/CLI" do
system "./configure", "--disable-debug", "--prefix=#{prefix}"
system "./configure", "--disable-debug", "--prefix=#{prefix}"
system "make", "install"
end
end
Expand Down
2 changes: 1 addition & 1 deletion Formula/c/clojure-lsp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ClojureLsp < Formula
regex(%r{^(?:release[._-])?v?(\d+(?:[T/.-]\d+)+)$}i)
strategy :git do |tags, regex|
# Convert tags like `2021.03.01-19.18.54` to `20210301T191854` format
tags.map { |tag| tag[regex, 1]&.gsub(".", "")&.gsub(%r{[/-]}, "T") }.compact
tags.map { |tag| tag[regex, 1]&.delete(".")&.gsub(%r{[/-]}, "T") }.compact
end
end

Expand Down
2 changes: 1 addition & 1 deletion Formula/c/crystal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Crystal < Formula
head do
url "https://github.com/crystal-lang/crystal.git", branch: "master"

uses_from_macos "libffi" # for the interpreter
uses_from_macos "libffi" # for the interpreter

resource "shards" do
url "https://github.com/crystal-lang/shards.git", branch: "master"
Expand Down
2 changes: 1 addition & 1 deletion Formula/c/crytic-compile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def install
end

resource("testdata").stage do
system bin/"crytic-compile", "variable-0.8.0.sol-0.8.15-compact.zip", \
system bin/"crytic-compile", "variable-0.8.0.sol-0.8.15-compact.zip",
"--export-format=solc", "--export-dir=#{testpath}/export"
end

Expand Down
2 changes: 1 addition & 1 deletion Formula/d/dvanalyzer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def install
end

cd "AVPS_DV_Analyzer/Project/GNU/CLI" do
system "./configure", "--disable-debug", "--enable-staticlibs", "--prefix=#{prefix}"
system "./configure", "--disable-debug", "--enable-staticlibs", "--prefix=#{prefix}"
system "make", "install"
end
end
Expand Down
2 changes: 1 addition & 1 deletion Formula/e/eatmemory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def install
test do
# test version match
out = shell_output "#{bin}/eatmemory -?"
version_escaped = version.to_s.gsub(/\./, '\.')
version_escaped = version.to_s.gsub(".", '\.')
assert_match %r{^eatmemory #{version_escaped} - https://github.com/julman99/eatmemory\n.*}, out

# test for expected output
Expand Down
2 changes: 1 addition & 1 deletion Formula/g/g3log.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def install
end

test do
(testpath/"test.cpp").write <<~EOS.gsub(/TESTDIR/, testpath)
(testpath/"test.cpp").write <<~EOS.gsub("TESTDIR", testpath)
#include <g3log/g3log.hpp>
#include <g3log/logworker.hpp>
int main()
Expand Down
2 changes: 1 addition & 1 deletion Formula/g/gdal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Gdal < Formula
depends_on "doxygen" => :build
end

depends_on "boost" => :build # for `libkml`
depends_on "boost" => :build # for `libkml`
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "swig" => :build
Expand Down
2 changes: 1 addition & 1 deletion Formula/h/haskell-language-server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def install
end

def caveats
ghc_versions = ghcs.map(&:version).map(&:to_s).join(", ")
ghc_versions = ghcs.map { |ghc| ghc.version.to_s }.join(", ")

<<~EOS
#{name} is built for GHC versions #{ghc_versions}.
Expand Down
2 changes: 1 addition & 1 deletion Formula/h/hyperspec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Hyperspec < Formula
url :homepage
regex(/href=.*?HyperSpec[._-]v?(\d+(?:[.-]\d+)+)\.t/i)
strategy :page_match do |page, regex|
page.scan(regex).map { |match| match&.first&.gsub("-", ".") }
page.scan(regex).map { |match| match&.first&.tr("-", ".") }
end
end

Expand Down
2 changes: 1 addition & 1 deletion Formula/i/icu4c.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Icu4c < Formula
url :stable
regex(/^release[._-]v?(\d+(?:[.-]\d+)+)$/i)
strategy :git do |tags, regex|
tags.map { |tag| tag[regex, 1]&.gsub("-", ".") }.compact
tags.map { |tag| tag[regex, 1]&.tr("-", ".") }.compact
end
end

Expand Down
2 changes: 1 addition & 1 deletion Formula/i/iozone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Iozone < Formula
url "https://www.iozone.org/src/current/"
regex(/href=.*?iozone[._-]?v?(\d+(?:[._]\d+)+)\.t/i)
strategy :page_match do |page, regex|
page.scan(regex).map { |match| match&.first&.gsub("_", ".") }
page.scan(regex).map { |match| match&.first&.tr("_", ".") }
end
end

Expand Down
3 changes: 1 addition & 2 deletions Formula/j/julia.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,7 @@ def install
# This also checks that these libraries can be loaded even when
# the symlinks are broken (e.g. by version bumps).
libs = (lib/"julia").glob(shared_library("*"))
.map(&:basename)
.map(&:to_s)
.map { |library| library.basename.to_s }
.reject do |name|
name.start_with?("sys", "libjulia-internal", "libccalltest")
end
Expand Down
2 changes: 1 addition & 1 deletion Formula/l/ledit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Ledit < Formula
url :stable
regex(/^ledit[._-]v?(\d+(?:[.-]\d+)+)$/i)
strategy :git do |tags, regex|
tags.map { |tag| tag[regex, 1]&.gsub("-", ".") }.compact
tags.map { |tag| tag[regex, 1]&.tr("-", ".") }.compact
end
end

Expand Down
2 changes: 1 addition & 1 deletion Formula/l/litecli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def install
# remove ANSI colors
output.gsub!(/\e\[([;\d]+)?m/, "")
# normalize line endings
output.gsub!(/\r\n/, "\n")
output.gsub!("\r\n", "\n")

expected = <<~EOS
name
Expand Down
8 changes: 4 additions & 4 deletions Formula/m/millet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,22 @@ def install
parse_content_length = lambda { |header_part|
content_length_header = header_part.split("\r\n")[0]
content_length = content_length_header.split(":")[1].to_i
return content_length
content_length
}

read_header_part = lambda { |pipe|
return pipe.readline("\r\n\r\n")
pipe.readline("\r\n\r\n")
}

read_response = lambda { |pipe|
header_part = read_header_part.call(pipe)
content_length = parse_content_length.call(header_part)
return JSON.parse(pipe.readpartial(content_length))
JSON.parse(pipe.readpartial(content_length))
}

json_rpc_message = lambda { |msg|
msg_string = msg.to_json
return "Content-Length: #{msg_string.length}\r\n\r\n" + msg_string
"Content-Length: #{msg_string.length}\r\n\r\n" + msg_string
}

send_message = lambda { |pipe, msg|
Expand Down
2 changes: 1 addition & 1 deletion Formula/m/minio-mc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def install
system "go", "build", *std_go_args(output: bin/"mc")
else
minio_release = stable.specs[:tag]
minio_version = minio_release.gsub(/RELEASE\./, "").chomp.gsub(/T(\d+)-(\d+)-(\d+)Z/, 'T\1:\2:\3Z')
minio_version = minio_release.gsub("RELEASE.", "").chomp.gsub(/T(\d+)-(\d+)-(\d+)Z/, 'T\1:\2:\3Z')
proj = "github.com/minio/mc"
ldflags = %W[
-X #{proj}/cmd.Version=#{minio_version}
Expand Down
2 changes: 1 addition & 1 deletion Formula/m/minio.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def install
system "go", "build", *std_go_args
else
release = `git tag --points-at HEAD`.chomp
version = release.gsub(/RELEASE\./, "").chomp.gsub(/T(\d+)-(\d+)-(\d+)Z/, 'T\1:\2:\3Z')
version = release.gsub("RELEASE.", "").chomp.gsub(/T(\d+)-(\d+)-(\d+)Z/, 'T\1:\2:\3Z')

ldflags = %W[
-s -w
Expand Down
4 changes: 2 additions & 2 deletions Formula/o/opencascade.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Opencascade < Formula
url "https://git.dev.opencascade.org/repos/occt.git"
regex(/^v?(\d+(?:[._]\d+)+(?:p\d+)?)$/i)
strategy :git do |tags, regex|
tags.map { |tag| tag[regex, 1]&.gsub("_", ".") }.compact
tags.map { |tag| tag[regex, 1]&.tr("_", ".") }.compact
end
end

Expand Down Expand Up @@ -82,7 +82,7 @@ def install
output = shell_output("#{bin}/DRAWEXE -b -c \"pload ALL\"")

# Discard the first line ("DRAW is running in batch mode"), and check that the second line is "1"
assert_equal "1", output.split(/\n/, 2)[1].chomp
assert_equal "1", output.split("\n", 2)[1].chomp

# Make sure hardcoded library name references in our CMake config files are valid.
# https://github.com/Homebrew/homebrew-core/issues/129111
Expand Down
1 change: 0 additions & 1 deletion Formula/p/pinot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def install
sleep 40

assert_match("HTTP/1.1 200 OK", shell_output("curl -i http://localhost:#{controller_port} 2>&1"))

ensure
Process.kill "TERM", controller_pid
Process.wait controller_pid
Expand Down
2 changes: 1 addition & 1 deletion Formula/p/pioneers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def install

# GNU ld-only options
inreplace Dir["configure{,.ac}"] do |s|
s.gsub!(/ -Wl,--as-needed/, "")
s.gsub!(" -Wl,--as-needed", "")
s.gsub!(/ -Wl,-z,(relro|now)/, "")
end

Expand Down
2 changes: 1 addition & 1 deletion Formula/p/pytorch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def install
# Update references to shared libraries
inreplace "torch/__init__.py" do |s|
s.sub!(/here = os.path.abspath\(__file__\)/, "here = \"#{lib}\"")
s.sub!(/get_file_path\('torch', 'bin', 'torch_shm_manager'\)/, "\"#{bin}/torch_shm_manager\"")
s.sub!("get_file_path('torch', 'bin', 'torch_shm_manager')", "\"#{bin}/torch_shm_manager\"")
end

inreplace "torch/utils/cpp_extension.py", "_TORCH_PATH = os.path.dirname(os.path.dirname(_HERE))",
Expand Down
2 changes: 1 addition & 1 deletion Formula/q/qp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def install

resource("csp-js").stage { cp_r "index.js", buildpath/"src/csp.js" }

system "qjsc", "-o", "#{bin}/qp",
system "qjsc", "-o", "#{bin}/qp",
"-fno-proxy",
"-fno-eval",
"-fno-string-normalize",
Expand Down
2 changes: 1 addition & 1 deletion Formula/r/rdkit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Rdkit < Formula
url :stable
regex(/^Release[._-](\d+(?:[._]\d+)+)$/i)
strategy :git do |tags|
tags.map { |tag| tag[regex, 1]&.gsub("_", ".") }.compact
tags.map { |tag| tag[regex, 1]&.tr("_", ".") }.compact
end
end

Expand Down
2 changes: 1 addition & 1 deletion Formula/s/sqlite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Sqlite < Formula
url :homepage
regex(%r{href=.*?releaselog/v?(\d+(?:[._]\d+)+)\.html}i)
strategy :page_match do |page, regex|
page.scan(regex).map { |match| match&.first&.gsub("_", ".") }
page.scan(regex).map { |match| match&.first&.tr("_", ".") }
end
end

Expand Down
2 changes: 1 addition & 1 deletion Formula/t/tfel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def install
"-Denable-website=OFF",
"-Dlocal-castem-header=ON",
"-Denable-python=ON",
"-Denable-python-bindings=ON", # requires boost-python
"-Denable-python-bindings=ON", # requires boost-python
"-Denable-numpy-support=OFF",
"-Denable-fortran=ON",
"-Denable-cyrano=ON",
Expand Down

0 comments on commit f62cd33

Please sign in to comment.