Skip to content

Commit 2c892c8

Browse files
committed
(PUP-11993) Style/Not
This commit enables the Style/Not cop and fixes 41 autocorrectable offenses.
1 parent d13fbb1 commit 2c892c8

33 files changed

+41
-45
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -629,10 +629,6 @@ Style/MultipleComparison:
629629
Style/MutableConstant:
630630
Enabled: false
631631

632-
# This cop supports safe auto-correction (--auto-correct).
633-
Style/Not:
634-
Enabled: false
635-
636632
# This cop supports safe auto-correction (--auto-correct).
637633
# Configuration parameters: EnforcedOctalStyle.
638634
# SupportedOctalStyles: zero_with_o, zero_only

lib/puppet/application.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ def run_mode(mode_name = nil)
284284
Puppet.settings.preferred_run_mode = mode_name
285285
end
286286

287-
return @run_mode if @run_mode and not mode_name
287+
return @run_mode if @run_mode and !mode_name
288288

289289
require_relative '../puppet/util/run_mode'
290290
@run_mode = Puppet::Util::RunMode[mode_name || Puppet.settings.preferred_run_mode]

lib/puppet/application/agent.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ def onetime(daemon)
441441

442442
daemon.stop(:exit => false)
443443

444-
if not exitstatus
444+
if !exitstatus
445445
exit(1)
446446
elsif options[:detailed_exitcodes] then
447447
exit(exitstatus)
@@ -509,7 +509,7 @@ def enable_disable_client(agent)
509509
end
510510

511511
def setup_agent
512-
agent = Puppet::Agent.new(Puppet::Configurer, (not(Puppet[:onetime])))
512+
agent = Puppet::Agent.new(Puppet::Configurer, (!((Puppet[:onetime]))))
513513

514514
enable_disable_client(agent) if options[:enable] or options[:disable]
515515

lib/puppet/application/apply.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ def main
276276

277277
exit_status = apply_catalog(catalog)
278278

279-
if not exit_status
279+
if !exit_status
280280
exit(1)
281281
elsif options[:detailed_exitcodes] then
282282
exit(exit_status)

lib/puppet/application/face_base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def parse_options
103103
else
104104
option = find_application_argument(item)
105105
if option
106-
index += 1 if (option[:argument] and not option[:optional])
106+
index += 1 if (option[:argument] and !(option[:optional]))
107107
else
108108
raise OptionParser::InvalidOption.new(item.sub(/=.*$/, ''))
109109
end

lib/puppet/configurer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ def run_internal(options)
442442
# facts may be used to determine which catalog we get, we need to
443443
# rerun the process if the environment is changed.
444444
tries = 0
445-
while catalog.environment and not catalog.environment.empty? and catalog.environment != @environment
445+
while catalog.environment and !catalog.environment.empty? and catalog.environment != @environment
446446
if tries > 3
447447
raise Puppet::Error, _("Catalog environment didn't stabilize after %{tries} fetches, aborting run") % { tries: tries }
448448
end

lib/puppet/face/epp.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
status = true # no validation error yet
7272
files = args
7373
if files.empty?
74-
if not STDIN.tty?
74+
if !STDIN.tty?
7575
tmp = validate_template_string(STDIN.read)
7676
status &&= tmp
7777
else

lib/puppet/face/parser.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
parse_errors = {}
4343

4444
if files.empty?
45-
if not STDIN.tty?
45+
if !STDIN.tty?
4646
Puppet[:code] = STDIN.read
4747
error = validate_manifest(nil)
4848
parse_errors['STDIN'] = error if error

lib/puppet/indirector/catalog/compiler.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def common_checksum_type(agent_checksum_type)
141141
if agent_checksum_type
142142
agent_checksum_types = agent_checksum_type.split('.').map { |type| type.to_sym }
143143
checksum_type = agent_checksum_types.drop_while do |type|
144-
not known_checksum_types.include? type
144+
!known_checksum_types.include? type
145145
end.first
146146
end
147147
checksum_type
@@ -169,7 +169,7 @@ def inlineable?(resource, sources)
169169
when sources.empty?
170170
# TRANSLATORS Inlining refers to adding additional metadata (in this case we are not inlining)
171171
return Puppet::Util::Profiler.profile(_("Not inlining resource without sources"), [:compiler, :static_compile_inlining, :skipped_file_metadata, :no_sources]) { false }
172-
when (not (sources.all? { |source| source =~ /^puppet:/ }))
172+
when (!(sources.all? { |source| source =~ /^puppet:/ }))
173173
# TRANSLATORS Inlining refers to adding additional metadata (in this case we are not inlining)
174174
return Puppet::Util::Profiler.profile(_("Not inlining unsupported source scheme"), [:compiler, :static_compile_inlining, :skipped_file_metadata, :unsupported_scheme]) { false }
175175
else

lib/puppet/indirector/indirection.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def find(key, options = {})
220220
terminus = prepare(request)
221221

222222
result = find_in_cache(request)
223-
if not result.nil?
223+
if !result.nil?
224224
result
225225
elsif request.ignore_terminus?
226226
nil

0 commit comments

Comments
 (0)