Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions lib/puppet/provider/rabbitmq_user/rabbitmqctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,20 @@
rabbitmqctl_list('users')
end

user_list.split(%r{\n}).map do |line|
raise Puppet::Error, "Cannot parse invalid user line: #{line}" unless line =~ %r{^(\S+)\s+\[(.*?)\]$}

user = Regexp.last_match(1)
tags = Regexp.last_match(2).split(%r{,\s*})
new(
ensure: :present,
name: user,
tags: tags
)
if user_list.split(%r{\n}).size > 0

Check failure on line 21 in lib/puppet/provider/rabbitmq_user/rabbitmqctl.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Style/ZeroLengthPredicate: Use `!empty?` instead of `size > 0`.

Check failure on line 21 in lib/puppet/provider/rabbitmq_user/rabbitmqctl.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Style/NumericPredicate: Use `user_list.split(%r{\n}).size.positive?` instead of `user_list.split(%r{\n}).size > 0`. (https://rubystyle.guide#predicate-methods)
user_list.split(%r{\n}).map do |line|
raise Puppet::Error, "Cannot parse invalid user line: #{line}" unless line =~ %r{^(\S+)\s+\[(.*?)\]$}

user = Regexp.last_match(1)
tags = Regexp.last_match(2).split(%r{,\s*})
new(
ensure: :present,
name: user,
tags: tags
)
end
else
user_list = []

Check failure on line 34 in lib/puppet/provider/rabbitmq_user/rabbitmqctl.rb

View workflow job for this annotation

GitHub Actions / Puppet / Static validations

Lint/UselessAssignment: Useless assignment to variable - `user_list`. (https://rubystyle.guide#underscore-unused-vars)
end
end

Expand Down
Loading