Merge pull request #10594 from Bo98/consistent-alignment

rubocop: use consistent array/hash indentation
This commit is contained in:
Mike McQuaid 2021-02-12 17:29:15 +00:00 committed by GitHub
commit 320bccb38d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 101 additions and 98 deletions

View File

@ -240,6 +240,12 @@ Layout/SpaceAroundOperators:
Layout/RescueEnsureAlignment: Layout/RescueEnsureAlignment:
Enabled: false Enabled: false
# significantly less indentation involved; more consistent
Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent
Layout/FirstHashElementIndentation:
EnforcedStyle: consistent
# favour parens-less DSL-style arguments # favour parens-less DSL-style arguments
Lint/AmbiguousBlockAssociation: Lint/AmbiguousBlockAssociation:
Enabled: false Enabled: false

View File

@ -13,9 +13,9 @@ module Cask
# @api private # @api private
class Installer < AbstractArtifact class Installer < AbstractArtifact
VALID_KEYS = Set.new([ VALID_KEYS = Set.new([
:manual, :manual,
:script, :script,
]).freeze ]).freeze
# Extension module for manual installers. # Extension module for manual installers.
module ManualInstaller module ManualInstaller

View File

@ -64,30 +64,30 @@ module Cask
].freeze ].freeze
DSL_METHODS = Set.new([ DSL_METHODS = Set.new([
:appcast, :appcast,
:artifacts, :artifacts,
:auto_updates, :auto_updates,
:caveats, :caveats,
:conflicts_with, :conflicts_with,
:container, :container,
:desc, :desc,
:depends_on, :depends_on,
:homepage, :homepage,
:language, :language,
:languages, :languages,
:name, :name,
:sha256, :sha256,
:staged_path, :staged_path,
:url, :url,
:version, :version,
:appdir, :appdir,
:discontinued?, :discontinued?,
:livecheck, :livecheck,
:livecheckable?, :livecheckable?,
*ORDINARY_ARTIFACT_CLASSES.map(&:dsl_key), *ORDINARY_ARTIFACT_CLASSES.map(&:dsl_key),
*ACTIVATABLE_ARTIFACT_CLASSES.map(&:dsl_key), *ACTIVATABLE_ARTIFACT_CLASSES.map(&:dsl_key),
*ARTIFACT_BLOCK_CLASSES.flat_map { |klass| [klass.dsl_key, klass.uninstall_dsl_key] }, *ARTIFACT_BLOCK_CLASSES.flat_map { |klass| [klass.dsl_key, klass.uninstall_dsl_key] },
]).freeze ]).freeze
attr_reader :cask, :token attr_reader :cask, :token

View File

@ -10,9 +10,9 @@ module Cask
# @api private # @api private
class Container class Container
VALID_KEYS = Set.new([ VALID_KEYS = Set.new([
:type, :type,
:nested, :nested,
]).freeze ]).freeze
attr_accessor(*VALID_KEYS, :pairs) attr_accessor(*VALID_KEYS, :pairs)

View File

@ -12,13 +12,13 @@ module Cask
# @api private # @api private
class DependsOn < SimpleDelegator class DependsOn < SimpleDelegator
VALID_KEYS = Set.new([ VALID_KEYS = Set.new([
:formula, :formula,
:cask, :cask,
:macos, :macos,
:arch, :arch,
:x11, :x11,
:java, :java,
]).freeze ]).freeze
VALID_ARCHES = { VALID_ARCHES = {
intel: { type: :intel, bits: 64 }, intel: { type: :intel, bits: 64 },

View File

@ -502,11 +502,11 @@ module Formulary
name = name.to_s.downcase name = name.to_s.downcase
taps.map do |tap| taps.map do |tap|
Pathname.glob([ Pathname.glob([
"#{tap}Formula/#{name}.rb", "#{tap}Formula/#{name}.rb",
"#{tap}HomebrewFormula/#{name}.rb", "#{tap}HomebrewFormula/#{name}.rb",
"#{tap}#{name}.rb", "#{tap}#{name}.rb",
"#{tap}Aliases/#{name}", "#{tap}Aliases/#{name}",
]).find(&:file?) ]).find(&:file?)
end.compact end.compact
end end
end end

View File

@ -8,9 +8,9 @@ module Metafiles
LICENSES = Set.new(%w[copying copyright license licence]).freeze LICENSES = Set.new(%w[copying copyright license licence]).freeze
# {https://github.com/github/markup#markups} # {https://github.com/github/markup#markups}
EXTENSIONS = Set.new(%w[ EXTENSIONS = Set.new(%w[
.adoc .asc .asciidoc .creole .html .markdown .md .mdown .mediawiki .mkdn .adoc .asc .asciidoc .creole .html .markdown .md .mdown .mediawiki .mkdn
.org .pod .rdoc .rst .rtf .textile .txt .wiki .org .pod .rdoc .rst .rtf .textile .txt .wiki
]).freeze ]).freeze
BASENAMES = Set.new(%w[about authors changelog changes history news notes notice readme todo]).freeze BASENAMES = Set.new(%w[about authors changelog changes history news notes notice readme todo]).freeze
module_function module_function

View File

@ -58,10 +58,10 @@ class Keg
# Try signing again # Try signing again
odebug "Codesigning (2nd try) #{file}" odebug "Codesigning (2nd try) #{file}"
result = system_command("codesign", args: [ result = system_command("codesign", args: [
"--sign", "-", "--force", "--sign", "-", "--force",
"--preserve-metadata=entitlements,requirements,flags,runtime", "--preserve-metadata=entitlements,requirements,flags,runtime",
file file
], print_stderr: false) ], print_stderr: false)
return if result.success? return if result.success?
# If it fails again, error out # If it fails again, error out

View File

@ -9,16 +9,16 @@ describe Cask::Cask, :cask do
context "and there are duplicate versions" do context "and there are duplicate versions" do
it "uses the last unique version" do it "uses the last unique version" do
allow(cask).to receive(:timestamped_versions).and_return([ allow(cask).to receive(:timestamped_versions).and_return([
["1.2.2", "0999"], ["1.2.2", "0999"],
["1.2.3", "1000"], ["1.2.3", "1000"],
["1.2.2", "1001"], ["1.2.2", "1001"],
]) ])
expect(cask).to receive(:timestamped_versions) expect(cask).to receive(:timestamped_versions)
expect(cask.versions).to eq([ expect(cask.versions).to eq([
"1.2.3", "1.2.3",
"1.2.2", "1.2.2",
]) ])
end end
end end
end end

View File

@ -80,8 +80,8 @@ describe Cask::DSL, :cask do
end end
expect(cask.name).to eq([ expect(cask.name).to eq([
"Proper Name", "Proper Name",
]) ])
end end
it "Accepts an array value to the name stanza" do it "Accepts an array value to the name stanza" do
@ -90,9 +90,9 @@ describe Cask::DSL, :cask do
end end
expect(cask.name).to eq([ expect(cask.name).to eq([
"Proper Name", "Proper Name",
"Alternate Name", "Alternate Name",
]) ])
end end
it "Accepts multiple name stanzas" do it "Accepts multiple name stanzas" do
@ -102,9 +102,9 @@ describe Cask::DSL, :cask do
end end
expect(cask.name).to eq([ expect(cask.name).to eq([
"Proper Name", "Proper Name",
"Alternate Name", "Alternate Name",
]) ])
end end
end end
@ -497,8 +497,8 @@ describe Cask::DSL, :cask do
it "does not include a trailing slash" do it "does not include a trailing slash" do
config = Cask::Config.new(explicit: { config = Cask::Config.new(explicit: {
appdir: "/Applications/", appdir: "/Applications/",
}) })
cask = Cask::Cask.new("appdir-trailing-slash", config: config) do cask = Cask::Cask.new("appdir-trailing-slash", config: config) do
binary "#{appdir}/some/path" binary "#{appdir}/some/path"

View File

@ -68,13 +68,13 @@ describe Homebrew::Livecheck do
it "returns a hash containing the livecheck status" do it "returns a hash containing the livecheck status" do
expect(livecheck.status_hash(f, "error", ["Unable to get versions"])) expect(livecheck.status_hash(f, "error", ["Unable to get versions"]))
.to eq({ .to eq({
formula: "test", formula: "test",
status: "error", status: "error",
messages: ["Unable to get versions"], messages: ["Unable to get versions"],
meta: { meta: {
livecheckable: true, livecheckable: true,
}, },
}) })
end end
end end

View File

@ -84,20 +84,18 @@ describe Homebrew::Diagnostic::Checks do
describe "#check_broken_sdks" do describe "#check_broken_sdks" do
it "doesn't trigger when SDK versions are as expected" do it "doesn't trigger when SDK versions are as expected" do
allow(OS::Mac).to receive(:sdk_locator).and_return(OS::Mac::CLT.sdk_locator) allow(OS::Mac).to receive(:sdk_locator).and_return(OS::Mac::CLT.sdk_locator)
allow_any_instance_of(OS::Mac::CLTSDKLocator).to receive(:all_sdks) allow_any_instance_of(OS::Mac::CLTSDKLocator).to receive(:all_sdks).and_return([
.and_return([ OS::Mac::SDK.new(OS::Mac::Version.new("11"), "/some/path/MacOSX.sdk", :clt),
OS::Mac::SDK.new(OS::Mac::Version.new("11"), "/some/path/MacOSX.sdk", :clt), OS::Mac::SDK.new(OS::Mac::Version.new("10.15"), "/some/path/MacOSX10.15.sdk", :clt),
OS::Mac::SDK.new(OS::Mac::Version.new("10.15"), "/some/path/MacOSX10.15.sdk", :clt), ])
])
expect(checks.check_broken_sdks).to be_nil expect(checks.check_broken_sdks).to be_nil
end end
it "triggers when the CLT SDK version doesn't match the folder name" do it "triggers when the CLT SDK version doesn't match the folder name" do
allow_any_instance_of(OS::Mac::CLTSDKLocator).to receive(:all_sdks) allow_any_instance_of(OS::Mac::CLTSDKLocator).to receive(:all_sdks).and_return([
.and_return([ OS::Mac::SDK.new(OS::Mac::Version.new("10.14"), "/some/path/MacOSX10.15.sdk", :clt),
OS::Mac::SDK.new(OS::Mac::Version.new("10.14"), "/some/path/MacOSX10.15.sdk", :clt), ])
])
expect(checks.check_broken_sdks) expect(checks.check_broken_sdks)
.to include("SDKs in your Command Line Tools (CLT) installation do not match the SDK folder names") .to include("SDKs in your Command Line Tools (CLT) installation do not match the SDK folder names")
@ -105,10 +103,9 @@ describe Homebrew::Diagnostic::Checks do
it "triggers when the Xcode SDK version doesn't match the folder name" do it "triggers when the Xcode SDK version doesn't match the folder name" do
allow(OS::Mac).to receive(:sdk_locator).and_return(OS::Mac::Xcode.sdk_locator) allow(OS::Mac).to receive(:sdk_locator).and_return(OS::Mac::Xcode.sdk_locator)
allow_any_instance_of(OS::Mac::XcodeSDKLocator).to receive(:all_sdks) allow_any_instance_of(OS::Mac::XcodeSDKLocator).to receive(:all_sdks).and_return([
.and_return([ OS::Mac::SDK.new(OS::Mac::Version.new("10.14"), "/some/path/MacOSX10.15.sdk", :xcode),
OS::Mac::SDK.new(OS::Mac::Version.new("10.14"), "/some/path/MacOSX10.15.sdk", :xcode), ])
])
expect(checks.check_broken_sdks) expect(checks.check_broken_sdks)
.to include("The contents of the SDKs in your Xcode installation do not match the SDK folder names") .to include("The contents of the SDKs in your Xcode installation do not match the SDK folder names")

View File

@ -13,18 +13,18 @@ module UnpackStrategy
# Helper module for listing the contents of a volume mounted from a disk image. # Helper module for listing the contents of a volume mounted from a disk image.
module Bom module Bom
DMG_METADATA = Set.new(%w[ DMG_METADATA = Set.new(%w[
.background .background
.com.apple.timemachine.donotpresent .com.apple.timemachine.donotpresent
.com.apple.timemachine.supported .com.apple.timemachine.supported
.DocumentRevisions-V100 .DocumentRevisions-V100
.DS_Store .DS_Store
.fseventsd .fseventsd
.MobileBackups .MobileBackups
.Spotlight-V100 .Spotlight-V100
.TemporaryItems .TemporaryItems
.Trashes .Trashes
.VolumeIcon.icns .VolumeIcon.icns
]).freeze ]).freeze
private_constant :DMG_METADATA private_constant :DMG_METADATA
refine Pathname do refine Pathname do