Skip to content

Commit 855f3bb

Browse files
(MODULES-11197) Rubocop fixes
1 parent ec516a2 commit 855f3bb

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

.rubocop.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Style/SymbolArray:
7373
EnforcedStyle: brackets
7474
Style/SignalException:
7575
Enabled: false
76-
Layout/IndentHeredoc:
76+
Layout/HeredocIndentation:
7777
Enabled: false
7878
Metrics/BlockNesting:
7979
Enabled: false
@@ -89,7 +89,7 @@ Style/NumericPredicate:
8989
Enabled: false
9090
Style/PredicateName:
9191
Enabled: false
92-
Style/VariableName:
92+
RSpec/VariableName:
9393
Enabled: false
9494
RSpec/MessageSpies:
9595
EnforcedStyle: receive

lib/puppet/provider/augeas/augeas.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,17 +95,17 @@ def parse_commands(data)
9595
if f == :path
9696
start = sc.pos
9797
nbracket = 0
98-
inSingleTick = false
99-
inDoubleTick = false
98+
in_single_tick = false
99+
in_double_tick = false
100100
loop do
101101
sc.skip(%r{([^\]\[\s\\'"]|\\.)+})
102102
ch = sc.getch
103103
nbracket += 1 if ch == '['
104104
nbracket -= 1 if ch == ']'
105-
inSingleTick = !inSingleTick if ch == "'"
106-
inDoubleTick = !inDoubleTick if ch == '"'
105+
in_single_tick = !in_single_tick if ch == "'"
106+
in_double_tick = !in_double_tick if ch == '"'
107107
raise(_('unmatched [')) if nbracket < 0
108-
break if (nbracket == 0 && !inSingleTick && !inDoubleTick && (ch =~ %r{\s})) || sc.eos?
108+
break if (nbracket == 0 && !in_single_tick && !in_double_tick && (ch =~ %r{\s})) || sc.eos?
109109
end
110110
len = sc.pos - start
111111
len -= 1 unless sc.eos?
@@ -209,7 +209,7 @@ def close_augeas
209209
@aug = nil
210210
end
211211

212-
def is_numeric?(s)
212+
def numeric?(s)
213213
case s
214214
when Integer
215215
true
@@ -236,8 +236,8 @@ def process_get(cmd_array)
236236
# check the value in augeas
237237
result = @aug.get(path) || ''
238238

239-
if ['<', '<=', '>=', '>'].include?(comparator) && is_numeric?(result) &&
240-
is_numeric?(arg)
239+
if ['<', '<=', '>=', '>'].include?(comparator) && numeric?(result) &&
240+
numeric?(arg)
241241
resultf = result.to_f
242242
argf = arg.to_f
243243
return_value = resultf.send(comparator, argf)

lib/puppet/type/augeas.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@
129129
end
130130

131131
newparam(:load_path) do
132-
desc "Optional colon-separated list or array of directories; these directories are searched for schema definitions. The agent's `$libdir/augeas/lenses` path will always be added to support pluginsync."
132+
desc "Optional colon-separated list or array of directories; these directories are searched for schema definitions.
133+
The agent's `$libdir/augeas/lenses` path will always be added to support pluginsync."
133134
defaultto ''
134135
end
135136

spec/unit/provider/augeas/augeas_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -475,19 +475,19 @@ def make_tmpname((prefix, suffix), n)
475475
end
476476
describe 'performing is_numeric checks (#22617)' do
477477
it 'returns false for nil' do
478-
expect(provider.is_numeric?(nil)).to eq(false)
478+
expect(provider.numeric?(nil)).to eq(false)
479479
end
480480
it 'returns true for Integers' do
481-
expect(provider.is_numeric?(9)).to eq(true)
481+
expect(provider.numeric?(9)).to eq(true)
482482
end
483483
it 'returns true for numbers in Strings' do
484-
expect(provider.is_numeric?('9')).to eq(true)
484+
expect(provider.numeric?('9')).to eq(true)
485485
end
486486
it 'returns false for non-number Strings' do
487-
expect(provider.is_numeric?('x9')).to eq(false)
487+
expect(provider.numeric?('x9')).to eq(false)
488488
end
489489
it 'returns false for other types' do
490-
expect(provider.is_numeric?([true])).to eq(false)
490+
expect(provider.numeric?([true])).to eq(false)
491491
end
492492
end
493493

0 commit comments

Comments
 (0)