aboutsummaryrefslogtreecommitdiff
path: root/lib/puppet
diff options
context:
space:
mode:
authorJacob Helwig <jacob@technosorcery.net>2018-06-25 11:07:12 -0700
committerJacob Helwig <jacob@technosorcery.net>2018-06-25 11:26:53 -0700
commit93ebe94656230209315ce0214103b239a28dec5e (patch)
treee4832521c4ed8d170af1a99fa05b41c9b4d08ee5 /lib/puppet
parentf00732c424c7535e22a31f64d1cd22d83dc76b14 (diff)
downloadpuppet-sshkeys_core-93ebe94656230209315ce0214103b239a28dec5e.tar.gz
puppet-sshkeys_core-93ebe94656230209315ce0214103b239a28dec5e.tar.bz2
Remove Rubocop Style/GuardClause violation
By restructuring this code to use a guard clause style, we can also get rid of the assignment in conditional.
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/provider/ssh_authorized_key/parsed.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/puppet/provider/ssh_authorized_key/parsed.rb b/lib/puppet/provider/ssh_authorized_key/parsed.rb
index 45ef649..02a19eb 100644
--- a/lib/puppet/provider/ssh_authorized_key/parsed.rb
+++ b/lib/puppet/provider/ssh_authorized_key/parsed.rb
@@ -76,12 +76,13 @@ Puppet::Type.type(:ssh_authorized_key).provide(
until scanner.eos?
scanner.skip(%r{[ \t]*})
# scan a long option
- if (out = scanner.scan(%r{[-a-z0-9A-Z_]+=\".*?[^\\]\"})) || (out = scanner.scan(%r{[-a-z0-9A-Z_]+}))
- result << out
- else
- # found an unscannable token, let's abort
- break
- end
+ out = scanner.scan(%r{[-a-z0-9A-Z_]+=\".*?[^\\]\"}) || scanner.scan(%r{[-a-z0-9A-Z_]+})
+
+ # found an unscannable token, let's abort
+ break unless out
+
+ result << out
+
# eat a comma
scanner.skip(%r{[ \t]*,[ \t]*})
end