Showing 10 of 12 total issues
Class ApiClient
has 63 methods (exceeds 20 allowed). Consider refactoring. Open
class ApiClient < Client
attr_accessor :max_batch_size
def initialize(api_token, options = {})
options = options.dup
Class AccountApiClient
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class AccountApiClient < Client
def initialize(api_token, options = {})
options = options.dup
options[:auth_header_name] = 'X-Postmark-Account-Token'
File api_client.rb
has 319 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Postmark
class ApiClient < Client
attr_accessor :max_batch_size
def initialize(api_token, options = {})
Class Message
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Message
attr_accessor :delivered, :postmark_response
def delivered?
Method to_ruby
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def to_ruby(object, options = {})
compatible = options.fetch(:compatible, false)
deep = options.fetch(:deep, false)
case object
- 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 to_postmark
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def to_postmark(object, options = {})
deep = options.fetch(:deep, false)
case object
when Hash
- 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 with_retries
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def with_retries
yield
rescue HttpServerError, HttpClientError, TimeoutError, Errno::EINVAL,
Errno::ECONNRESET, Errno::ECONNREFUSED, EOFError,
Net::ProtocolError, SocketError => e
- 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 validate_template
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_template(attributes = {})
data = serialize(HashHelper.to_postmark(attributes))
response = format_response(http_client.post('templates/validate', data))
response.each do |k, v|
- 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 prerender
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def prerender
raise ::Postmark::Error, 'Cannot prerender a message without an associated template alias' unless templated?
unless delivery_method.is_a?(::Mail::Postmark)
raise ::Postmark::MailAdapterError, "Cannot render templates via #{delivery_method.class} adapter."
- 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 to_ruby_hash
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_ruby_hash(inbound)
inbound = Json.decode(inbound) if inbound.is_a?(String)
ret = HashHelper.to_ruby(inbound)
ret[:from_full] ||= {}
ret[:to_full] ||= []
- 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"