Showing 15 of 17 total issues
Method subscribers
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def subscribers(args = {}, &blk)
args.each do |key, value|
raise "Invalid argument: '#{key}'." unless SUBSCRIBERS_VALID_ARGS.include?(key)
end
- 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 subscribers
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def subscribers(args = {}, &blk)
args.each do |key, value|
raise "Invalid argument: '#{key}'." unless SUBSCRIBERS_VALID_ARGS.include?(key)
end
Method update
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def update(data)
begin
res = aos.req_json("v1/subscribers/queue", :post, json: [data.merge(:Id => self.data(:id))])
url = URI.parse(res["Result"]["PollURL"])
result = nil
- 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 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update(data)
begin
res = aos.req_json("v1/subscribers/queue", :post, json: [data.merge(:Id => self.data(:id))])
url = URI.parse(res["Result"]["PollURL"])
result = nil
Method remove_all_subscribers
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def remove_all_subscribers
data = aos.req("v1/mailinglists/#{self.data(:id)}/subscriptions/all", :delete)
res = data.fetch(:json)
unless res["Code"] == 1
Method delete
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def delete
res = aos.req_json("v1/mailinglists/", :delete, json: [data(:id)])
url = URI.parse(res["Result"]["PollURL"])
result = nil
- 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 list_for
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list_for(resource_url, resource_url_with_dates, resource_name, args = {})
# OptOut counting does not work :-( We will have to do the date request to fix this...
# If date-arguments are given, we will have to use the date request.
if args[:date_from] || args[:date_to] || resource_name == "OptOut"
return list_for_with_dates(resource_url_with_dates, resource_name, args)
Method parse_obj
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_obj(obj)
if obj.is_a?(Array)
ret = []
obj.each do |obj_i|
ret << parse_obj(obj_i)
- 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 remove_all_subscribers
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def remove_all_subscribers
data = aos.req("v1/mailinglists/#{self.data(:id)}/subscriptions/all", :delete)
res = data.fetch(:json)
unless res["Code"] == 1
- 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 list_for
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def list_for(resource_url, resource_url_with_dates, resource_name, args = {})
# OptOut counting does not work :-( We will have to do the date request to fix this...
# If date-arguments are given, we will have to use the date request.
if args[:date_from] || args[:date_to] || resource_name == "OptOut"
return list_for_with_dates(resource_url_with_dates, resource_name, args)
- 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 parse_json_response
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_json_response(response)
# Throw custom JSON error for debugging if the JSON was corrupt (this actually happens!).
begin
json = JSON.parse(response.body)
rescue JSON::ParserError
- 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_subscribers
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_subscribers(data)
res = aos.req_json("v1/subscribers/mailinglist/#{data(:id)}/queue", :post, json: data)
url = URI.parse(res["Result"]["PollURL"])
data_subscribers = nil
- 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 obj
Avoid too many return
statements within this method. Open
return obj
Method read_queued_response
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def read_queued_response(url)
uri = URI.parse(url)
Timeout.timeout(300) do
loop do
- 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"