lib/odania/consul.rb
Method build_config
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def build_config(plugin_name, plugin_instance_name, ip, tags=[], port=80)
Use sample
instead of shuffle.first
. Open
Open
get(core_backends.shuffle.first)
- Read upRead up
- Exclude checks
This cop is used to identify usages of shuffle.first
, shuffle.last
and shuffle[]
and change them to use sample
instead.
Example:
# bad
[1, 2, 3].shuffle.first
[1, 2, 3].shuffle.first(2)
[1, 2, 3].shuffle.last
[1, 2, 3].shuffle[2]
[1, 2, 3].shuffle[0, 2] # sample(2) will do the same
[1, 2, 3].shuffle[0..2] # sample(3) will do the same
[1, 2, 3].shuffle(random: Random.new).first
# good
[1, 2, 3].shuffle
[1, 2, 3].sample
[1, 2, 3].sample(3)
[1, 2, 3].shuffle[1, 3] # sample(3) might return a longer Array
[1, 2, 3].shuffle[1..3] # sample(3) might return a longer Array
[1, 2, 3].shuffle[foo, bar]
[1, 2, 3].shuffle(random: Random.new)
TODO found Open
Open
# TODO Is there an easier way to get the first service tagges with "core-backend"?
- Exclude checks