Odania-IT/odania-gem

View on GitHub
lib/odania/consul.rb

Summary

Maintainability
A
35 mins
Test Coverage

Method build_config has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

            def build_config(plugin_name, plugin_instance_name, ip, tags=[], port=80)
Severity: Minor
Found in lib/odania/consul.rb - About 35 mins to fix

    Use sample instead of shuffle.first.
    Open

                    get(core_backends.shuffle.first)
    Severity: Minor
    Found in lib/odania/consul.rb by rubocop

    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

                # TODO Is there an easier way to get the first service tagges with "core-backend"?
    Severity: Minor
    Found in lib/odania/consul.rb by fixme

    There are no issues that match your filters.

    Category
    Status