Skip to content

Commit 2abd323

Browse files
(PUP-11767) Fix IfUnlessModifierOfIfUnless violations and remove from to_do
1 parent 9e3a7f6 commit 2abd323

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -508,11 +508,6 @@ Style/HashSyntax:
508508
Style/IfUnlessModifier:
509509
Enabled: false
510510

511-
# This cop supports safe auto-correction (--auto-correct).
512-
Style/IfUnlessModifierOfIfUnless:
513-
Exclude:
514-
- 'lib/puppet/util/command_line/trollop.rb'
515-
516511
# This cop supports safe auto-correction (--auto-correct).
517512
Style/IfWithSemicolon:
518513
Exclude:

lib/puppet/util/command_line/trollop.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,9 @@ def opt name, desc = "", opts = {}
230230
raise ArgumentError, _("long option name %{value0} is already taken; please specify a (different) :long") % { value0: opts[:long].inspect } if @long[opts[:long]]
231231

232232
## fill in :short
233-
opts[:short] = opts[:short].to_s if opts[:short] unless opts[:short] == :none
233+
unless opts[:short] == :none
234+
opts[:short] = opts[:short].to_s if opts[:short]
235+
end
234236
opts[:short] = case opts[:short]
235237
when /^-(.)$/; $1
236238
when nil, :none, /^.$/; opts[:short]
@@ -312,7 +314,9 @@ def parse cmdline = ARGV
312314
required = {}
313315

314316
if handle_help_and_version
315-
opt :version, _("Print version and exit") if @version unless @specs[:version] || @long["version"]
317+
unless @specs[:version] || @long["version"]
318+
opt :version, _("Print version and exit") if @version
319+
end
316320
opt :help, _("Show this message") unless @specs[:help] || @long["help"]
317321
end
318322

0 commit comments

Comments
 (0)