Skip to content

Commit 6b5cb30

Browse files
committed
(PUP-11993) Cleanup Rubocop changes
This commit cleans up some changes Rubocop autocorrected such as remove extra parenthesis and breaking down ternary operators into more readable if/else statements.
1 parent 2aa8a61 commit 6b5cb30

File tree

6 files changed

+18
-16
lines changed

6 files changed

+18
-16
lines changed

lib/puppet/application/agent.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ def enable_disable_client(agent)
509509
end
510510

511511
def setup_agent
512-
agent = Puppet::Agent.new(Puppet::Configurer, (!((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/external/dot.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,11 @@ def to_s(t = '')
197197
# This code is totally incomprehensible; it needs to be replaced!
198198

199199
label = if @options['shape'] != 'record' && @ports.length == 0
200-
@options['label'] ?
201-
t + $tab + "label = #{stringify(@options['label'])}\n" :
202-
''
200+
if @options['label']
201+
t + $tab + "label = #{stringify(@options['label'])}\n"
202+
else
203+
''
204+
end
203205
else
204206
t + $tab + 'label = "' + " \\\n" +
205207
t + $tab2 + "#{stringify(@options['label'])}| \\\n" +

lib/puppet/module_tool/shared_behaviors.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def resolve_constraints(dependencies, source = [{ :name => :you }], seen = {}, a
139139
:path => if action == :install
140140
@options[:target_dir]
141141
else
142-
(@installed[mod].empty? ? @options[:target_dir] : @installed[mod].first.modulepath)
142+
@installed[mod].empty? ? @options[:target_dir] : @installed[mod].first.modulepath
143143
end,
144144
:dependencies => []
145145
}

lib/puppet/pops/types/string_converter.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,11 @@ def initialize(fmt)
119119

120120
@left = flags.include?('-')
121121
@alt = flags.include?('#')
122-
@plus = (if flags.include?(' ')
123-
:space
124-
else
125-
(flags.include?('+') ? :plus : :ignore)
126-
end)
122+
@plus = if flags.include?(' ')
123+
:space
124+
else
125+
flags.include?('+') ? :plus : :ignore
126+
end
127127
@zero_pad = flags.include?('0')
128128

129129
@delimiters = nil

lib/puppet/pops/types/type_factory.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def self.boolean(value = nil)
251251
if value.nil?
252252
PBooleanType::DEFAULT
253253
else
254-
(value ? PBooleanType::TRUE : PBooleanType::FALSE)
254+
value ? PBooleanType::TRUE : PBooleanType::FALSE
255255
end
256256
end
257257

lib/puppet/util/log.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,11 @@ def Log.reopen
257257

258258
def self.setup_default
259259
Log.newdestination(
260-
(if Puppet.features.syslog?
261-
:syslog
262-
else
263-
(Puppet.features.eventlog? ? :eventlog : Puppet[:puppetdlog])
264-
end)
260+
if Puppet.features.syslog?
261+
:syslog
262+
else
263+
Puppet.features.eventlog? ? :eventlog : Puppet[:puppetdlog]
264+
end
265265
)
266266
end
267267

0 commit comments

Comments
 (0)