Showing 45 of 64 total issues
Method info
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def info(id, options = {}, not_found = :reject, found = :return)
@id = id
@options = options
custom_params = []
custom_params << use_consistency(options)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method fire
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def fire(name, value = nil, service = nil, node = nil, tag = nil, dc = nil, options = {})
Method read
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def read(id, options = {}, not_found = :reject, found = :return)
@options = options
custom_params = []
custom_params << use_consistency(options)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create(value, options = {})
blacklist = ['ID', 'iD', 'Id', :ID, :iD, :Id] & value.keys
raise Diplomat::RoleMalformed, 'ID should not be specified' unless blacklist.empty?
id = value[:Name] || value['Name']
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method transaction_verification
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def transaction_verification(transaction)
raise Diplomat::InvalidTransaction unless transaction.is_a?(Array)
transaction.each do |req|
raise Diplomat::InvalidTransaction unless transaction_type_verification(req)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method send_put_request
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_put_request(connection, url, options, data, custom_params = nil, mime = 'application/json')
Method register_script
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def register_script(check_id, name, notes, args, interval, options = {})
Method get
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get(meta = nil, options = {})
ret = send_get_request(@conn, ['/v1/catalog/datacenters'], options)
if meta && ret.headers
meta[:index] = ret.headers['x-consul-index'] if ret.headers['x-consul-index']
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method send_delete_request
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def send_delete_request(connection, url, options, custom_params = nil)
rest_options = parse_options(options)
url += rest_options[:query_params]
url += custom_params unless custom_params.nil?
connection.delete do |req|
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create(value, options = {})
blacklist = ['ID', 'iD', 'Id', :ID, :iD, :Id] & value.keys
raise Diplomat::PolicyMalformed, 'ID should not be specified' unless blacklist.empty?
id = value[:Name] || value['Name']
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method register_ttl
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def register_ttl(check_id, name, notes, ttl, options = {})
Method get
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get(name = nil, token = :last, not_found = :wait, found = :return, options = {})
Method send_post_request
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_post_request(connection, url, options, data, custom_params = nil)
Method wait_to_acquire
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def wait_to_acquire(key, session, value = nil, check_interval = 10, options = {})
Method parse_options
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_options(options)
headers = nil
query_params = []
url_prefix = nil
consistency = []
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method consul_info
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.consul_info(options = {})
consul_self = Diplomat::Agent.self(options)
puts 'Server: ' + consul_self['Config']['NodeName']
puts 'Datacenter: ' + consul_self['Config']['Datacenter']
puts 'Consul Version: ' + consul_self['Config']['Version']
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return return_value(return_nil_values, transformation)
Avoid too many return
statements within this method. Open
return convert_to_hash(return_value(return_nil_values, transformation, true)) if @options && @options[:convert_to_hash]
Method update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update(value, options = {})
id = value[:ID] || value['ID']
raise Diplomat::IdParameterRequired if id.nil?
role_name = value[:Name] || value['Name']
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update(value, options = {})
id = value[:AccessorID] || value['AccessorID']
raise Diplomat::AccessorIdParameterRequired if id.nil?
custom_params = use_cas(@options)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"