From 855f3bba8bb1c29ea1ec2dae471c90bec7786f01 Mon Sep 17 00:00:00 2001 From: Bobosila Victor Date: Fri, 24 Sep 2021 13:26:47 +0300 Subject: (MODULES-11197) Rubocop fixes --- lib/puppet/provider/augeas/augeas.rb | 16 ++++++++-------- lib/puppet/type/augeas.rb | 3 ++- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'lib/puppet') diff --git a/lib/puppet/provider/augeas/augeas.rb b/lib/puppet/provider/augeas/augeas.rb index 8ab6e7a..8a306db 100644 --- a/lib/puppet/provider/augeas/augeas.rb +++ b/lib/puppet/provider/augeas/augeas.rb @@ -95,17 +95,17 @@ Puppet::Type.type(:augeas).provide(:augeas) do if f == :path start = sc.pos nbracket = 0 - inSingleTick = false - inDoubleTick = false + in_single_tick = false + in_double_tick = false loop do sc.skip(%r{([^\]\[\s\\'"]|\\.)+}) ch = sc.getch nbracket += 1 if ch == '[' nbracket -= 1 if ch == ']' - inSingleTick = !inSingleTick if ch == "'" - inDoubleTick = !inDoubleTick if ch == '"' + in_single_tick = !in_single_tick if ch == "'" + in_double_tick = !in_double_tick if ch == '"' raise(_('unmatched [')) if nbracket < 0 - break if (nbracket == 0 && !inSingleTick && !inDoubleTick && (ch =~ %r{\s})) || sc.eos? + break if (nbracket == 0 && !in_single_tick && !in_double_tick && (ch =~ %r{\s})) || sc.eos? end len = sc.pos - start len -= 1 unless sc.eos? @@ -209,7 +209,7 @@ Puppet::Type.type(:augeas).provide(:augeas) do @aug = nil end - def is_numeric?(s) + def numeric?(s) case s when Integer true @@ -236,8 +236,8 @@ Puppet::Type.type(:augeas).provide(:augeas) do # check the value in augeas result = @aug.get(path) || '' - if ['<', '<=', '>=', '>'].include?(comparator) && is_numeric?(result) && - is_numeric?(arg) + if ['<', '<=', '>=', '>'].include?(comparator) && numeric?(result) && + numeric?(arg) resultf = result.to_f argf = arg.to_f return_value = resultf.send(comparator, argf) diff --git a/lib/puppet/type/augeas.rb b/lib/puppet/type/augeas.rb index 37683a2..2303fdc 100644 --- a/lib/puppet/type/augeas.rb +++ b/lib/puppet/type/augeas.rb @@ -129,7 +129,8 @@ Puppet::Type.newtype(:augeas) do end newparam(:load_path) do - 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." + 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." defaultto '' end -- cgit v1.2.3