Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions lib/order.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
class Order

Check warning on line 1 in lib/order.rb

View workflow job for this annotation

GitHub Actions / readonly

IrresponsibleModule

Order has no descriptive comment
def process(order, user, flag)

Check warning on line 2 in lib/order.rb

View workflow job for this annotation

GitHub Actions / readonly

TooManyStatements

Order#process has approx 11 statements
if order

Check warning on line 3 in lib/order.rb

View workflow job for this annotation

GitHub Actions / readonly

ControlParameter

Order#process is controlled by argument 'order'
if user

Check warning on line 4 in lib/order.rb

View workflow job for this annotation

GitHub Actions / readonly

ControlParameter

Order#process is controlled by argument 'user'
if flag

Check warning on line 5 in lib/order.rb

View workflow job for this annotation

GitHub Actions / readonly

ControlParameter

Order#process is controlled by argument 'flag'
puts 'one'; puts 'two'; puts 'three'; puts 'four'; puts 'five'
puts 'six'; puts 'seven'; puts 'eight'; puts 'nine'; puts 'ten'
else
puts 'none'
end
end
end
end

def total_a(items)

Check warning on line 15 in lib/order.rb

View workflow job for this annotation

GitHub Actions / readonly

UtilityFunction

Order#total_a doesn't depend on instance state (maybe move it to another class?)

Check warning on line 15 in lib/order.rb

View workflow job for this annotation

GitHub Actions / readonly

DuplicateCode

Similar code found in 2 nodes
sum = 0
items.each { |i| sum += i.price * i.quantity if i.active? }

Check warning on line 17 in lib/order.rb

View workflow job for this annotation

GitHub Actions / readonly

UncommunicativeVariableName

Order#total_a has the variable name 'i'
sum
end

def total_b(items)

Check warning on line 21 in lib/order.rb

View workflow job for this annotation

GitHub Actions / readonly

UtilityFunction

Order#total_b doesn't depend on instance state (maybe move it to another class?)
sum = 0
items.each { |i| sum += i.price * i.quantity if i.active? }

Check warning on line 23 in lib/order.rb

View workflow job for this annotation

GitHub Actions / readonly

UncommunicativeVariableName

Order#total_b has the variable name 'i'
sum
end
end
Loading