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"],
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
Method perform
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.perform(events)
data = {}
events.reverse!
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'])
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|
- 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 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|
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
Method perform
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.perform(events)
data = {}
events.reverse!
- 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 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
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 = {
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}
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
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,
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"
- 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 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
Method initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(start_date, end_date, transactions, customers, products, subscriptions)
Method invoice_description
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def invoice_description(membership_id, description, type, method, frequency)
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 = {
- 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 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?
- 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 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|
- 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"