Resolve Lint/EmptyBlock todos

This commit is contained in:
Douglas Eichelberger 2023-01-26 21:18:24 -08:00
parent 12f3fb8252
commit dead4de3fc
16 changed files with 49 additions and 22 deletions

View File

@ -22,14 +22,3 @@ Style/Documentation:
- "utils/popen.rb"
- "utils/shell.rb"
- "version.rb"
Lint/EmptyBlock:
Exclude:
- "dev-cmd/extract.rb"
- "test/cache_store_spec.rb"
- "test/checksum_verification_spec.rb"
- "test/compiler_failure_spec.rb"
- "test/formula_spec.rb"
- "test/formula_validation_spec.rb"
- "test/pathname_spec.rb"
- "test/support/fixtures/cask/Casks/*flight*.rb"

View File

@ -10,22 +10,30 @@ require "tap"
def with_monkey_patch
BottleSpecification.class_eval do
alias_method :old_method_missing, :method_missing if method_defined?(:method_missing)
define_method(:method_missing) { |*| }
define_method(:method_missing) do |*|
# do nothing
end
end
Module.class_eval do
alias_method :old_method_missing, :method_missing if method_defined?(:method_missing)
define_method(:method_missing) { |*| }
define_method(:method_missing) do |*|
# do nothing
end
end
Resource.class_eval do
alias_method :old_method_missing, :method_missing if method_defined?(:method_missing)
define_method(:method_missing) { |*| }
define_method(:method_missing) do |*|
# do nothing
end
end
DependencyCollector.class_eval do
alias_method :old_parse_symbol_spec, :parse_symbol_spec if method_defined?(:parse_symbol_spec)
define_method(:parse_symbol_spec) { |*| }
define_method(:parse_symbol_spec) do |*|
# do nothing
end
end
yield

View File

@ -13,7 +13,9 @@ describe CacheStoreDatabase do
cache_store = instance_double(described_class, "cache_store", write_if_dirty!: nil)
expect(described_class).to receive(:new).with(type).and_return(cache_store)
expect(cache_store).to receive(:write_if_dirty!)
described_class.use(type) { |_db| }
described_class.use(type) { |_db|
# do nothing
}
end
end

View File

@ -18,7 +18,9 @@ describe Formula do
sha256 TESTBALL_SHA256
end
f.brew {}
f.brew {
# do nothing
}
}.not_to raise_error
end
@ -28,7 +30,9 @@ describe Formula do
sha256 "dcbf5f44743b74add648c7e35e414076632fa3b24463d68d1f6afc5be77024f8"
end
f.brew {}
f.brew {
# do nothing
}
}.to raise_error(ChecksumMismatchError)
end
end

View File

@ -22,7 +22,9 @@ describe CompilerFailure do
end
it "can be given an empty block" do
failure = described_class.create(:clang) {}
failure = described_class.create(:clang) {
# do nothing
}
expect(failure).to fail_with(
instance_double(CompilerSelector::Compiler, "Compiler", type: :clang, name: :clang, version: 600),
)

View File

@ -872,7 +872,11 @@ describe Formula do
end
expect(Set.new(f2.recursive_requirements)).to eq(Set[])
expect(Set.new(f2.recursive_requirements {})).to eq(Set[xcode])
expect(
f2.recursive_requirements {
# do nothing
}.to_set,
).to eq(Set[xcode])
requirements = f2.recursive_requirements do |_dependent, requirement|
Requirement.prune if requirement.is_a?(XcodeRequirement)

View File

@ -80,7 +80,11 @@ describe Formula do
end
it "fails when Formula is empty" do
expect { formula {} }.to raise_error(FormulaSpecificationError)
expect {
formula {
# do nothing
}
}.to raise_error(FormulaSpecificationError)
end
end
end

View File

@ -93,7 +93,9 @@ describe Pathname do
end
it "preserves permissions" do
File.open(file, "w", 0100777) {}
File.open(file, "w", 0100777) {
# do nothing
}
file.atomic_write("CONTENT")
expect(file.stat.mode.to_s(8)).to eq((~File.umask & 0100777).to_s(8))
end

View File

@ -8,7 +8,9 @@ cask "with-postflight-multi" do
pkg "MyFancyPkg/Fancy.pkg"
postflight do
# do nothing
end
postflight do
# do nothing
end
end

View File

@ -8,5 +8,6 @@ cask "with-postflight" do
pkg "MyFancyPkg/Fancy.pkg"
postflight do
# do nothing
end
end

View File

@ -8,7 +8,9 @@ cask "with-preflight-multi" do
pkg "MyFancyPkg/Fancy.pkg"
preflight do
# do nothing
end
preflight do
# do nothing
end
end

View File

@ -8,5 +8,6 @@ cask "with-preflight" do
pkg "MyFancyPkg/Fancy.pkg"
preflight do
# do nothing
end
end

View File

@ -8,7 +8,9 @@ cask "with-uninstall-postflight-multi" do
pkg "MyFancyPkg/Fancy.pkg"
uninstall_postflight do
# do nothing
end
uninstall_postflight do
# do nothing
end
end

View File

@ -8,5 +8,6 @@ cask "with-uninstall-postflight" do
pkg "MyFancyPkg/Fancy.pkg"
uninstall_postflight do
# do nothing
end
end

View File

@ -8,7 +8,9 @@ cask "with-uninstall-preflight-multi" do
pkg "MyFancyPkg/Fancy.pkg"
uninstall_preflight do
# do nothing
end
uninstall_preflight do
# do nothing
end
end

View File

@ -8,5 +8,6 @@ cask "with-uninstall-preflight" do
pkg "MyFancyPkg/Fancy.pkg"
uninstall_preflight do
# do nothing
end
end