ECHOInternational/your_membership

View on GitHub

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
Severity: Minor
Found in lib/your_membership/member.rb - About 2 hrs to fix

    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
    Severity: Minor
    Found in lib/your_membership/base.rb - About 1 hr to fix

    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
    Severity: Minor
    Found in lib/your_membership/base.rb - About 1 hr to fix

      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 = {})
      Severity: Major
      Found in lib/your_membership/profile.rb - About 50 mins to fix

        Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def initialize(id, website_id, first_name, last_name, email, session = nil)
        Severity: Minor
        Found in lib/your_membership/member.rb - About 45 mins to fix

          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
          Severity: Minor
          Found in lib/your_membership/sa_members.rb - About 45 mins to fix

            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?
            Severity: Minor
            Found in lib/your_membership/member.rb - About 35 mins to fix

            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
            Severity: Major
            Found in lib/your_membership/sa_export.rb - About 30 mins to fix

              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.
              Severity: Minor
              Found in lib/your_membership/profile.rb - About 25 mins to fix

              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

              Severity
              Category
              Status
              Source
              Language