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
30 changes: 30 additions & 0 deletions lib/order.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
class Order

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RubyCritic: IrresponsibleModule (new)

Order has no descriptive comment

def process(order, user, flag)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RubyCritic: TooManyStatements (new)

Order#process has approx 11 statements

if order

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RubyCritic: ControlParameter (new)

Order#process is controlled by argument 'order'

if user

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RubyCritic: ControlParameter (new)

Order#process is controlled by argument 'user'

if flag

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RubyCritic: ControlParameter (new)

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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RubyCritic: DuplicateCode (new)

Similar code found in 2 nodes

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RubyCritic: UtilityFunction (new)

Order#total_a 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? }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RubyCritic: UncommunicativeVariableName (new)

Order#total_a has the variable name 'i'

sum
end

def total_b(items)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RubyCritic: UtilityFunction (new)

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? }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RubyCritic: UncommunicativeVariableName (new)

Order#total_b has the variable name 'i'

sum
end

def extra(a)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RubyCritic: UncommunicativeParameterName (new)

Order#extra has the parameter name 'a'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RubyCritic: UtilityFunction (new)

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

a.map { |x| x * 2 }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RubyCritic: UncommunicativeVariableName (new)

Order#extra has the variable name 'x'

end
end
Loading