diff options
author | Jacob Helwig <jacob@technosorcery.net> | 2018-06-25 11:07:12 -0700 |
---|---|---|
committer | Jacob Helwig <jacob@technosorcery.net> | 2018-06-25 11:26:53 -0700 |
commit | 93ebe94656230209315ce0214103b239a28dec5e (patch) | |
tree | e4832521c4ed8d170af1a99fa05b41c9b4d08ee5 /lib/puppet | |
parent | f00732c424c7535e22a31f64d1cd22d83dc76b14 (diff) | |
download | puppet-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.rb | 13 |
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 |