Skip to content

Commit d879f8e

Browse files
author
jordanbreen28
committed
(CONT-776) - Correct Style/RedundantSelfAssignmentBranch
1 parent 0d2099e commit d879f8e

File tree

3 files changed

+6
-25
lines changed

3 files changed

+6
-25
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
# This configuration was generated by
2-
# `rubocop --auto-gen-config`
3-
# on 2023-04-28 15:04:49 UTC using RuboCop version 1.48.1.
4-
# The point is for the user to remove these configuration records
5-
# one by one as the offenses are removed from the code base.
6-
# Note that changes in the inspected code, or installation of new
7-
# versions of RuboCop, may require this file to be generated again.
8-
91
# Offense count: 22
102
# Configuration parameters: AllowKeywordBlockArguments.
113
Lint/UnderscorePrefixedVariableName:
@@ -164,13 +156,6 @@ RSpec/StubbedMock:
164156
Exclude:
165157
- 'spec/unit/lib/facter/docker_spec.rb'
166158

167-
# Offense count: 2
168-
# This cop supports safe autocorrection (--autocorrect).
169-
Style/RedundantSelfAssignmentBranch:
170-
Exclude:
171-
- 'lib/puppet/functions/docker_params_changed.rb'
172-
- 'spec/helper/get_docker_params_changed.rb'
173-
174159
# Offense count: 3
175160
# This cop supports safe autocorrection (--autocorrect).
176161
Style/RedundantStringEscape:

lib/puppet/functions/docker_params_changed.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,9 @@ def detect_changes(opts)
8989
param_changed = true if opts['volumes'].is_a?(String) && opts['volumes'].include?(':') && opts['volumes'] != inspect_hash['Mounts'].to_a[0] && opts['osfamily'] != 'windows'
9090
param_changed = true if opts['volumes'].is_a?(String) && !opts['volumes'].include?(':') && opts['volumes'] != inspect_hash['Config']['Volumes'].to_a[0] && opts['osfamily'] != 'windows'
9191
param_changed = true if opts['volumes'].is_a?(String) && opts['volumes'].scan(%r{(?=:)}).count == 2 && opts['volumes'] != inspect_hash['Mounts'].to_a[0] && opts['osfamily'] == 'windows'
92-
param_changed = if opts['volumes'].is_a?(String) && opts['volumes'].scan(%r{(?=:)}).count == 1 && opts['volumes'] != inspect_hash['Config']['Volumes'].to_a[0] && opts['osfamily'] == 'windows'
93-
true
94-
else
95-
param_changed
96-
end
92+
if opts['volumes'].is_a?(String) && opts['volumes'].scan(%r{(?=:)}).count == 1 && opts['volumes'] != inspect_hash['Config']['Volumes'].to_a[0] && opts['osfamily'] == 'windows'
93+
param_changed = true
94+
end
9795

9896
pp_paths = opts['volumes'].reject { |item| item.include?(':') } if opts['volumes'].is_a?(Array) && opts['osfamily'] != 'windows'
9997
pp_mounts = opts['volumes'].select { |item| item.include?(':') } if opts['volumes'].is_a?(Array) && opts['osfamily'] != 'windows'

spec/helper/get_docker_params_changed.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@ def get_docker_params_changed(opts)
1818
param_changed = true if opts['volumes'].is_a?(String) && opts['volumes'].include?(':') && opts['volumes'] != inspect_hash['Mounts'].to_a[0] && opts['osfamily'] != 'windows'
1919
param_changed = true if opts['volumes'].is_a?(String) && !opts['volumes'].include?(':') && opts['volumes'] != inspect_hash['Config']['Volumes'].to_a[0] && opts['osfamily'] != 'windows'
2020
param_changed = true if opts['volumes'].is_a?(String) && opts['volumes'].scan(%r{(?=:)}).count == 2 && opts['volumes'] != inspect_hash['Mounts'].to_a[0] && opts['osfamily'] == 'windows'
21-
param_changed = if opts['volumes'].is_a?(String) && opts['volumes'].scan(%r{(?=:)}).count == 1 && opts['volumes'] != inspect_hash['Config']['Volumes'].to_a[0] && opts['osfamily'] == 'windows'
22-
true
23-
else
24-
param_changed
25-
end
21+
if opts['volumes'].is_a?(String) && opts['volumes'].scan(%r{(?=:)}).count == 1 && opts['volumes'] != inspect_hash['Config']['Volumes'].to_a[0] && opts['osfamily'] == 'windows'
22+
param_changed = true
23+
end
2624

2725
pp_paths = opts['volumes'].reject { |item| item.include?(':') } if opts['volumes'].is_a?(Array) && opts['osfamily'] != 'windows'
2826
pp_mounts = opts['volumes'].select { |item| item.include?(':') } if opts['volumes'].is_a?(Array) && opts['osfamily'] != 'windows'

0 commit comments

Comments
 (0)