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:
Enabled: false
# significantly less indentation involved; more consistent
Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent
Layout/FirstHashElementIndentation:
EnforcedStyle: consistent
# favour parens-less DSL-style arguments
Lint/AmbiguousBlockAssociation:
Enabled: false

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -84,20 +84,18 @@ describe Homebrew::Diagnostic::Checks do
describe "#check_broken_sdks" 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_any_instance_of(OS::Mac::CLTSDKLocator).to receive(:all_sdks)
.and_return([
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),
])
allow_any_instance_of(OS::Mac::CLTSDKLocator).to receive(:all_sdks).and_return([
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),
])
expect(checks.check_broken_sdks).to be_nil
end
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)
.and_return([
OS::Mac::SDK.new(OS::Mac::Version.new("10.14"), "/some/path/MacOSX10.15.sdk", :clt),
])
allow_any_instance_of(OS::Mac::CLTSDKLocator).to receive(:all_sdks).and_return([
OS::Mac::SDK.new(OS::Mac::Version.new("10.14"), "/some/path/MacOSX10.15.sdk", :clt),
])
expect(checks.check_broken_sdks)
.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
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)
.and_return([
OS::Mac::SDK.new(OS::Mac::Version.new("10.14"), "/some/path/MacOSX10.15.sdk", :xcode),
])
allow_any_instance_of(OS::Mac::XcodeSDKLocator).to receive(:all_sdks).and_return([
OS::Mac::SDK.new(OS::Mac::Version.new("10.14"), "/some/path/MacOSX10.15.sdk", :xcode),
])
expect(checks.check_broken_sdks)
.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.
module Bom
DMG_METADATA = Set.new(%w[
.background
.com.apple.timemachine.donotpresent
.com.apple.timemachine.supported
.DocumentRevisions-V100
.DS_Store
.fseventsd
.MobileBackups
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
]).freeze
.background
.com.apple.timemachine.donotpresent
.com.apple.timemachine.supported
.DocumentRevisions-V100
.DS_Store
.fseventsd
.MobileBackups
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
]).freeze
private_constant :DMG_METADATA
refine Pathname do