lib/dnsmadeeasy/api/client.rb
Class Client
has 51 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Client
class << self
def public_operations
(new('a', 'b').methods - Object.methods).map(&:to_s).reject { |r| r =~ /[=]$|^(api_|on_|request)/ }.sort
end
File client.rb
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require 'time'
require 'openssl'
require 'json'
require 'uri'
require 'net/http'
Method create_httpred_record
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def create_httpred_record(domain_name, name, value, redirectType = 'STANDARD - 302', description = '', keywords = '', title = '', options = {})
Method create_srv_record
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def create_srv_record(domain_name, name, priority, weight, port, value, options = {})
Method update_record
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def update_record(domain, record_id, name, type, value, options = {})
Method create_record
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def create_record(domain_name, name, type, value, options = {})
Method create_mx_record
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def create_mx_record(domain_name, name, priority, value, options = {})
Method process_response!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def process_response!(response)
response.value # raise Net::HTTPServerException unless response was 2xx
process_rate_limits(response)
unparsed_json = response.body.to_s.empty? ? '{}' : response.body
Hashie::Mash.new(JSON.parse(unparsed_json))
- 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 initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def initialize(api_key, api_secret, sandbox = false, options = {})
fail 'api_key is undefined' unless api_key
fail 'api_secret is undefined' unless api_secret
@api_key = api_key
- 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
Use options['mxLevel'] = priority
instead of options.merge!('mxLevel' => priority)
. Open
Open
options.merge!('mxLevel' => priority)
- Read upRead up
- Exclude checks
This cop identifies places where Hash#merge!
can be replaced by
Hash#[]=
.
Example:
hash.merge!(a: 1)
hash.merge!({'key' => 'value'})
hash.merge!(a: 1, b: 2)