Skip to content

Scenario B: add smells - #2

Open
etagwerker wants to merge 2 commits into
mainfrom
feature/add-smells
Open

etagwerker wants to merge 2 commits into
mainfrom
feature/add-smells

Conversation

@etagwerker

Copy link
Copy Markdown
Member

Scenario B

Comment thread lib/order.rb
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

Comment thread lib/order.rb
def process(order, user, flag)
if order
if 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'

Comment thread lib/order.rb
@@ -0,0 +1,26 @@
class Order
def process(order, user, flag)
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'

Comment thread lib/order.rb
class Order
def process(order, user, flag)
if 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'

Comment thread lib/order.rb
@@ -0,0 +1,26 @@
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

Comment thread lib/order.rb
@@ -0,0 +1,26 @@
class Order
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

Comment thread lib/order.rb

def total_a(items)
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'

Comment thread lib/order.rb

def total_b(items)
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'

Comment thread lib/order.rb
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: UtilityFunction (new)

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

Comment thread lib/order.rb
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?)

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

RubyCritic report

Base Head Change
98.87 95.39 -3.48

13 new or worsened smells in this PR.

13 commented inline on the diff.

Workflow run

Comment thread lib/order.rb
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'

Comment thread lib/order.rb
end

def extra(a)
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'

Comment thread lib/order.rb
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: UtilityFunction (new)

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant