ECHOInternational/your_membership

View on GitHub

Showing 27 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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  def self.mediaGallery_get(session, member_id, options = {}) # rubocop:disable Style/MethodName
                    options = {}
                    options[:ID] = member_id
                    response = post('/', :body => build_XML_request('Members.MediaGallery.Get', session, options))
              
              
              Severity: Minor
              Found in lib/your_membership/members.rb and 1 other location - About 25 mins to fix
              lib/your_membership/members.rb on lines 34..40

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 30.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  def self.connections_get(session, member_id, options = {})
                    options = {}
                    options[:ID] = member_id
                    response = post('/', :body => build_XML_request('Members.Connections.Get', session, options))
              
              
              Severity: Minor
              Found in lib/your_membership/members.rb and 1 other location - About 25 mins to fix
              lib/your_membership/members.rb on lines 78..84

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 30.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              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

              Similar blocks of code found in 4 locations. Consider refactoring.
              Open

                    def self.certifications_get(member_id, options = {})
                      options[:ID] = member_id
              
                      response = post('/', :body => build_XML_request('Sa.Member.Certifications.Get', nil, options))
              
              
              Severity: Minor
              Found in lib/your_membership/sa_member.rb and 3 other locations - About 20 mins to fix
              lib/your_membership/sa_member.rb on lines 39..45
              lib/your_membership/sa_members.rb on lines 96..102
              lib/your_membership/sa_members.rb on lines 115..121

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 28.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 4 locations. Consider refactoring.
              Open

                    def self.certifications_journal_get(member_id, options = {})
                      options[:ID] = member_id
              
                      response = post('/', :body => build_XML_request('Sa.Member.Certifications.Journal.Get', nil, options))
              
              
              Severity: Minor
              Found in lib/your_membership/sa_member.rb and 3 other locations - About 20 mins to fix
              lib/your_membership/sa_member.rb on lines 13..19
              lib/your_membership/sa_members.rb on lines 96..102
              lib/your_membership/sa_members.rb on lines 115..121

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 28.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 4 locations. Consider refactoring.
              Open

                    def self.referrals_get(member_id, options = {})
                      options[:ID] = member_id
              
                      response = post('/', :body => build_XML_request('Sa.Members.Referrals.Get', nil, options))
              
              
              Severity: Minor
              Found in lib/your_membership/sa_members.rb and 3 other locations - About 20 mins to fix
              lib/your_membership/sa_member.rb on lines 13..19
              lib/your_membership/sa_member.rb on lines 39..45
              lib/your_membership/sa_members.rb on lines 115..121

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 28.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                  def self.mediaGallery_albums_get(session, member_id) # rubocop:disable Style/MethodName
                    options = {}
                    options[:ID] = member_id
                    # puts build_XML_request('Members.MediaGallery.Albums.Get', session, options)
                    response = post('/', :body => build_XML_request('Members.MediaGallery.Albums.Get', session, options))
              Severity: Minor
              Found in lib/your_membership/members.rb and 2 other locations - About 20 mins to fix
              lib/your_membership/member.rb on lines 156..163
              lib/your_membership/members.rb on lines 14..20

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 28.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                  def self.connections_categories_get(session, member_id)
                    options = {}
                    options[:ID] = member_id
                    response = post('/', :body => build_XML_request('Members.Connections.Categories.Get', session, options))
              
              
              Severity: Minor
              Found in lib/your_membership/members.rb and 2 other locations - About 20 mins to fix
              lib/your_membership/member.rb on lines 156..163
              lib/your_membership/members.rb on lines 54..61

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 28.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 4 locations. Consider refactoring.
              Open

                    def self.subAccounts_get(member_id, options = {}) # rubocop:disable Style/MethodName
                      options[:ID] = member_id
              
                      response = post('/', :body => build_XML_request('Sa.Members.SubAccounts.Get', nil, options))
              
              
              Severity: Minor
              Found in lib/your_membership/sa_members.rb and 3 other locations - About 20 mins to fix
              lib/your_membership/sa_member.rb on lines 13..19
              lib/your_membership/sa_member.rb on lines 39..45
              lib/your_membership/sa_members.rb on lines 96..102

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 28.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                  def self.commerce_store_order_get(session, invoiceID)
                    options = {}
                    options[:InvoiceID] = invoiceID
              
                    response = post('/', :body => build_XML_request('Member.Commerce.Store.Order.Get', session, options))
              Severity: Minor
              Found in lib/your_membership/member.rb and 2 other locations - About 20 mins to fix
              lib/your_membership/members.rb on lines 14..20
              lib/your_membership/members.rb on lines 54..61

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 28.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  def self.all_search(session, options = {})
                    response = post('/', :body => build_XML_request('People.All.Search', session, options))
              
                    response_valid? response
                    response_to_array_of_hashes response['YourMembership_Response']['People.All.Search'], ['Results', 'Item']
              Severity: Minor
              Found in lib/your_membership/people.rb and 1 other location - About 15 mins to fix
              lib/your_membership/events.rb on lines 14..20

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 25.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                    def self.event_registration_get(event_id, options = {})
                      options[:EventID] = event_id
              
                      response = post('/', :body => build_XML_request('Sa.Events.Event.Registration.Get', nil, options))
              
              
              Severity: Minor
              Found in lib/your_membership/sa_events.rb and 1 other location - About 15 mins to fix
              lib/your_membership/sa_groups.rb on lines 20..26

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 25.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Severity
              Category
              Status
              Source
              Language