Showing 9 of 27 total issues
Class Member
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Member < YourMembership::Base
attr_reader :id, :website_id
attr_accessor :first_name, :last_name, :email, :session, :profile
# Member Initializer - Use Member.create_from_session or Member.create_by_authentication to instantiate
Method build_XML_request
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.build_XML_request(callMethod, session = nil, params = {}) # rubocop:disable Style/MethodLength, Style/MethodName
builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
# Root Node Is always <YourMembership>
xml.YourMembership do
# API 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
Method build_XML_request
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.build_XML_request(callMethod, session = nil, params = {}) # rubocop:disable Style/MethodLength, Style/MethodName
builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
# Root Node Is always <YourMembership>
xml.YourMembership do
# API Version
Method create_new
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.create_new(first_name, last_name, member_type_code, email, username, password, options = {})
Method initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(id, website_id, first_name, last_name, email, session = nil)
Method certifications_journalEntry_create
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.certifications_journalEntry_create(member_id, ceus_earned, ceus_expire_date, description, entry_date, options = {}) # rubocop:disable Style/MethodName
Method isAuthenticated
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.isAuthenticated(session) # rubocop:disable Style/MethodName
response = post('/', :body => build_XML_request('Member.IsAuthenticated', session))
# Fail on HTTP Errors
raise HTTParty::ResponseError.new(response), 'Connection to YourMembership API failed.' unless response.success?
- 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 :error
Method parse_custom_field_responses
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_custom_field_responses(custom_fields)
return {} unless custom_fields
# CustomFieldResponse may be an array (if multiple responses) or a hash
# (if single response). Make sure we're always dealing with an array.
- 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"