Skip to content

Commit 0f8c055

Browse files
(PUP-11767) Enable Style/IfWithBooleanLiteralBranches
1 parent 44d78b3 commit 0f8c055

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

.rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,3 +322,6 @@ Style/IfInsideElse:
322322

323323
Style/IfUnlessModifierOfIfUnless:
324324
Enabled: true
325+
326+
Style/IfWithBooleanLiteralBranches:
327+
Enabled: true

lib/puppet/defaults.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ def self.initialize_default_settings!(settings)
489489
},
490490
:daemonize => {
491491
:type => :boolean,
492-
:default => (Puppet::Util::Platform.windows? ? false : true),
492+
:default => (!Puppet::Util::Platform.windows?),
493493
:desc => "Whether to send the process into the background. This defaults
494494
to true on POSIX systems, and to false on Windows (where Puppet
495495
currently cannot daemonize).",

lib/puppet/type/exec.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -415,11 +415,7 @@ def value=(*values)
415415
# on refresh.
416416
def check(value)
417417
# We have to invert the values.
418-
if value == :true
419-
false
420-
else
421-
true
422-
end
418+
value != :true
423419
end
424420
end
425421

lib/puppet/type/file.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ def should_be_file?
874874
if self[:ensure] == :present
875875
return true unless stat
876876

877-
return(stat.ftype == "file" ? true : false)
877+
return(stat.ftype == "file")
878878
end
879879

880880
# If we've gotten here, then :ensure isn't set
@@ -1023,11 +1023,8 @@ def can_backup?(type)
10231023
# (#18110) Directories cannot be removed without :force,
10241024
# so it doesn't make sense to back them up unless removing with :force.
10251025
true
1026-
elsif type == "file" or type == "link"
1027-
true
10281026
else
1029-
# Including: “blockSpecial”, “characterSpecial”, "fifo", "socket", “unknown”
1030-
false
1027+
type == "file" or type == "link"
10311028
end
10321029
end
10331030

0 commit comments

Comments
 (0)