theodi/open-orgn-services

View on GitHub

Showing 22 of 22 total issues

Method perform has 73 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def perform
    organization_details = {
      "name"           => organization["name"] || contact_person["name"],
      "contact_name"   => contact_person["name"],
      "company_number" => organization["company_number"],
Severity: Major
Found in lib/signup/signup_processor.rb - About 2 hrs to fix

    Method perform has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.perform(party, membership)
        if %w(individual student).include?(membership['product_name'])
          p = find_or_create_person(party)
          first_name, last_name = party['name'].split(" ")
        else
    Severity: Major
    Found in lib/capsulecrm/send_signup_to_capsule.rb - About 2 hrs to fix

      Method perform has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.perform(events)
          data = {}
          
          events.reverse!
          
      Severity: Major
      Found in lib/eventbrite/event_summary_generator.rb - About 2 hrs to fix

        Method perform has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.perform(person, product, comment)
            # Create organisation in CapsuleCRM
            organisation = CapsuleCRM::Organisation.find_all(:q => person['affiliation']).first
            if organisation.nil?
              organisation = CapsuleCRM::Organisation.new(:name => person['affiliation'])
        Severity: Minor
        Found in lib/capsulecrm/partner_enquiry_processor.rb - About 2 hrs to fix

          Method invoice_contact has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.invoice_contact(contact, invoice_to, invoice_details, invoice_uid = nil)
              # Check existing invoices for order number
              invoices = xero.Invoice.all(:where => %{Contact.ContactID = GUID("#{contact.id}")})
              existing = invoices.find do |invoice|
                invoice.line_items.find do |line|
          Severity: Minor
          Found in lib/xero/invoicer.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 invoice_contact has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def self.invoice_contact(contact, invoice_to, invoice_details, invoice_uid = nil)
              # Check existing invoices for order number
              invoices = xero.Invoice.all(:where => %{Contact.ContactID = GUID("#{contact.id}")})
              existing = invoices.find do |invoice|
                invoice.line_items.find do |line|
          Severity: Minor
          Found in lib/xero/invoicer.rb - About 1 hr to fix

            Method refund_row has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def refund_row(refund)
                  customer = @customers[refund.customer_id]
                  product = @products[refund.product_id]
                  refund_transactions = Chargify::Transaction.all(from: "/subscriptions/#{refund.subscription_id}/transactions").group_by(&:type)
                  payment = refund_transactions['Payment'].first
            Severity: Minor
            Found in lib/chargify/cash_report.rb - About 1 hr to fix

              Method perform has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.perform(events)
                  data = {}
                  
                  events.reverse!
                  
              Severity: Minor
              Found in lib/eventbrite/event_summary_generator.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 perform has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def perform(order_uri)
                  order = Eventbrite::Client.order_details(order_uri)
                  event = order['event']
                  attendees = order['attendees']
                  purchaser = attendees.first
              Severity: Minor
              Found in lib/eventbrite/order_invoicer.rb - About 1 hr to fix

                Method perform has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def self.perform(id, type)
                    # Get the subject from capsule
                    subject = "CapsuleCRM::#{type.titleize}".constantize.find(id)
                    if subject
                      membership = {
                Severity: Minor
                Found in lib/capsulecrm/sync_capsule_data.rb - About 1 hr to fix

                  Method fetch_data has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def fetch_data
                      @products = Chargify::Product.all
                      @transactions = []
                      per_page = 20
                      params = {since_date: @start_date.to_s, until_date: @end_date.to_s, per_page: per_page, page: 1}
                  Severity: Minor
                  Found in lib/chargify/chargify_report_generator.rb - About 1 hr to fix

                    Method perform has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def self.perform
                        
                        # Get open opportunities from CapsuleCRM
                        opportunities = CapsuleCRM::Opportunity.find_all.select{|x| !opportunity_closed?(x)}
                        # Get list of old opportunities
                    Severity: Minor
                    Found in lib/capsulecrm/send_opportunity_reminders.rb - About 1 hr to fix

                      Method set_membership_tag has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def set_membership_tag(party, fields)
                          types = {
                            "Level"                          => :text,
                            "Supporter Level"                => :text,
                            "ID"                             => :text,
                      Severity: Minor
                      Found in lib/capsulecrm/capsule_helper.rb - About 1 hr to fix

                        Method transactions_for_subscription has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def transactions_for_subscription(subscription_id)
                              subscription_transactions = transactions[subscription_id]
                        
                              subscription_transactions.each do |transaction|
                                next unless transaction.type == "Charge"
                        Severity: Minor
                        Found in lib/chargify/cash_report.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 perform has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def self.perform(membership_id, organization, directory_entry, date)
                            org = find_organization(membership_id)
                            if org.nil?
                              requeue(membership_id, organization, directory_entry, date)
                            else
                        Severity: Minor
                        Found in lib/capsulecrm/send_directory_entry_to_capsule.rb - About 1 hr to fix

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

                              def initialize(start_date, end_date, transactions, customers, products, subscriptions)
                          Severity: Minor
                          Found in lib/chargify/report.rb - About 45 mins to fix

                            Method invoice_description has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                              def invoice_description(membership_id, description, type, method, frequency)
                            Severity: Minor
                            Found in lib/signup/signup_processor.rb - About 35 mins to fix

                              Method perform has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def self.perform(id, type)
                                  # Get the subject from capsule
                                  subject = "CapsuleCRM::#{type.titleize}".constantize.find(id)
                                  if subject
                                    membership = {
                              Severity: Minor
                              Found in lib/capsulecrm/sync_capsule_data.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

                              Method perform has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def self.perform(organization_name, individual_email, membership_id)
                                  # Find organization
                                  if organization_name
                                    party = find_organization(organization_name)
                                    raise ArgumentError.new("Organization name #{organization_name} not found") if party.nil?
                              Severity: Minor
                              Found in lib/capsulecrm/save_membership_id_in_capsule.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

                              Method data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def data
                                    table = []
                                    table << headers_row
                              
                                    transactions.keys.sort.each do |subscription_id|
                              Severity: Minor
                              Found in lib/chargify/cash_report.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

                              Severity
                              Category
                              Status
                              Source
                              Language