Merge pull request #14444 from dduugg/resolve-rubocop-todo

Resolve rubocop todo
This commit is contained in:
Mike McQuaid 2023-01-27 10:17:50 +00:00 committed by GitHub
commit 10845a1122
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 78 additions and 54 deletions

View File

@ -1,6 +1,5 @@
inherit_from:
- ../.rubocop_rspec.yml
- .rubocop_todo.yml
Homebrew/MoveToExtendOS:
Enabled: true
@ -20,9 +19,9 @@ Lint/NestedMethodDefinition:
# TODO: Try to bring down all metrics maximums.
Metrics/AbcSize:
Max: 280
Max: 241
Metrics/BlockLength:
Max: 106
Max: 86
Exclude:
# TODO: extract more of the bottling logic
- "dev-cmd/bottle.rb"
@ -31,18 +30,18 @@ Metrics/BlockLength:
Metrics/BlockNesting:
Max: 5
Metrics/ClassLength:
Max: 800
Max: 736
Exclude:
- "formula.rb"
- "formula_installer.rb"
Metrics/CyclomaticComplexity:
Max: 80
Max: 68
Metrics/PerceivedComplexity:
Max: 90
Max: 84
Metrics/MethodLength:
Max: 260
Max: 232
Metrics/ModuleLength:
Max: 500
Max: 463
Exclude:
# TODO: extract more of the bottling logic
- "dev-cmd/bottle.rb"
@ -57,6 +56,28 @@ Naming/PredicateName:
- is_32_bit?
- is_64_bit?
Style/Documentation:
AllowedConstants:
- Homebrew
Exclude:
- "extend/**/*.rb"
- "test/**/*.rb"
- "cask/macos.rb"
- "cli/args.rb"
- "cli/parser.rb"
- "cmd/list.rb"
- "cmd/update-report.rb"
- "dev-cmd/irb.rb"
- "dev-cmd/pr-pull.rb"
- "keg_relocate.rb"
- "os/mac/keg.rb"
- "software_spec.rb"
- "utils.rb"
- "utils/fork.rb"
- "utils/git_repository.rb"
- "utils/popen.rb"
- "utils/shell.rb"
Style/HashAsLastArrayItem:
Exclude:
- "test/utils/spdx_spec.rb"

View File

@ -1,35 +0,0 @@
Style/Documentation:
Exclude:
- "compat/**/*.rb"
- "extend/**/*.rb"
- "cmd/**/*.rb"
- "dev-cmd/**/*.rb"
- "test/**/*.rb"
- "cask/macos.rb"
- "cli/args.rb"
- "cli/parser.rb"
- "default_prefix.rb"
- "global.rb"
- "keg_relocate.rb"
- "os/mac/keg.rb"
- "reinstall.rb"
- "software_spec.rb"
- "upgrade.rb"
- "utils.rb"
- "utils/fork.rb"
- "utils/gems.rb"
- "utils/git_repository.rb"
- "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