Fix DoubleNegation.

This commit is contained in:
Markus Reiter 2016-09-20 22:24:31 +02:00
parent 52ff988530
commit 23eac7ab89
6 changed files with 12 additions and 12 deletions

View File

@ -151,13 +151,9 @@ Style/ConstantName:
# Offense count: 10 # Offense count: 10
Style/DoubleNegation: Style/DoubleNegation:
Exclude: Exclude:
- 'Homebrew/extend/ARGV.rb'
- 'Homebrew/formula_installer.rb'
- 'Homebrew/os/mac/cctools_keg.rb' - 'Homebrew/os/mac/cctools_keg.rb'
- 'Homebrew/os/mac/ruby_keg.rb' - 'Homebrew/os/mac/ruby_keg.rb'
- 'Homebrew/os/mac/xcode.rb' - 'Homebrew/os/mac/xcode.rb'
- 'Homebrew/requirement.rb'
- 'Homebrew/software_spec.rb'
# Offense count: 1 # Offense count: 1
# Configuration parameters: EnforcedStyle, SupportedStyles. # Configuration parameters: EnforcedStyle, SupportedStyles.

View File

@ -216,7 +216,7 @@ module HomebrewArgvExtension
end end
def build_all_from_source? def build_all_from_source?
!!ENV["HOMEBREW_BUILD_FROM_SOURCE"] !ENV["HOMEBREW_BUILD_FROM_SOURCE"].nil?
end end
# Whether a given formula should be built from source during the current # Whether a given formula should be built from source during the current

View File

@ -24,7 +24,9 @@ class FormulaInstaller
private(*names) private(*names)
names.each do |name| names.each do |name|
predicate = "#{name}?" predicate = "#{name}?"
define_method(predicate) { !!send(name) } define_method(predicate) do
send(name) ? true : false
end
private(predicate) private(predicate)
end end
end end
@ -71,7 +73,8 @@ class FormulaInstaller
end end
def build_bottle? def build_bottle?
!!@build_bottle && !formula.bottle_disabled? return false unless @build_bottle
!formula.bottle_disabled?
end end
def pour_bottle?(install_bottle_options = { warn: false }) def pour_bottle?(install_bottle_options = { warn: false })

View File

@ -175,7 +175,7 @@ module OS
# Returns true even if outdated tools are installed, e.g. # Returns true even if outdated tools are installed, e.g.
# tools from Xcode 4.x on 10.9 # tools from Xcode 4.x on 10.9
def installed? def installed?
!!detect_version !detect_version.nil?
end end
def update_instructions def update_instructions

View File

@ -56,7 +56,7 @@ class Requirement
def satisfied? def satisfied?
result = self.class.satisfy.yielder { |p| instance_eval(&p) } result = self.class.satisfy.yielder { |p| instance_eval(&p) }
@satisfied_result = result @satisfied_result = result
!!result result ? true : false
end end
# Overriding #fatal? is deprecated. # Overriding #fatal? is deprecated.

View File

@ -65,11 +65,12 @@ class SoftwareSpec
end end
def bottle_unneeded? def bottle_unneeded?
!!@bottle_disable_reason && @bottle_disable_reason.unneeded? return false unless @bottle_disable_reason
@bottle_disable_reason.unneeded?
end end
def bottle_disabled? def bottle_disabled?
!!@bottle_disable_reason @bottle_disable_reason ? true : false
end end
attr_reader :bottle_disable_reason attr_reader :bottle_disable_reason
@ -318,7 +319,7 @@ class BottleSpecification
end end
def tag?(tag) def tag?(tag)
!!checksum_for(tag) checksum_for(tag) ? true : false
end end
# Checksum methods in the DSL's bottle block optionally take # Checksum methods in the DSL's bottle block optionally take