Repository navigation
Scenario B: add smells - #2
etagwerker wants to merge 2 commits into
Conversation
| end | ||
| end | ||
|
|
||
| def total_a(items) |
There was a problem hiding this comment.
RubyCritic: DuplicateCode (new)
Similar code found in 2 nodes
| def process(order, user, flag) | ||
| if order | ||
| if user | ||
| if flag |
There was a problem hiding this comment.
RubyCritic: ControlParameter (new)
Order#process is controlled by argument 'flag'
| @@ -0,0 +1,26 @@ | |||
| class Order | |||
| def process(order, user, flag) | |||
| if order | |||
There was a problem hiding this comment.
RubyCritic: ControlParameter (new)
Order#process is controlled by argument 'order'
| class Order | ||
| def process(order, user, flag) | ||
| if order | ||
| if user |
There was a problem hiding this comment.
RubyCritic: ControlParameter (new)
Order#process is controlled by argument 'user'
| @@ -0,0 +1,26 @@ | |||
| class Order | |||
There was a problem hiding this comment.
RubyCritic: IrresponsibleModule (new)
Order has no descriptive comment
| @@ -0,0 +1,26 @@ | |||
| class Order | |||
| def process(order, user, flag) | |||
There was a problem hiding this comment.
RubyCritic: TooManyStatements (new)
Order#process has approx 11 statements
|
|
||
| def total_a(items) | ||
| sum = 0 | ||
| items.each { |i| sum += i.price * i.quantity if i.active? } |
There was a problem hiding this comment.
RubyCritic: UncommunicativeVariableName (new)
Order#total_a has the variable name 'i'
|
|
||
| def total_b(items) | ||
| sum = 0 | ||
| items.each { |i| sum += i.price * i.quantity if i.active? } |
There was a problem hiding this comment.
RubyCritic: UncommunicativeVariableName (new)
Order#total_b has the variable name 'i'
| end | ||
| end | ||
|
|
||
| def total_a(items) |
There was a problem hiding this comment.
RubyCritic: UtilityFunction (new)
Order#total_a doesn't depend on instance state (maybe move it to another class?)
| sum | ||
| end | ||
|
|
||
| def total_b(items) |
There was a problem hiding this comment.
RubyCritic: UtilityFunction (new)
Order#total_b doesn't depend on instance state (maybe move it to another class?)
RubyCritic report
13 new or worsened smells in this PR. 13 commented inline on the diff. |
| sum | ||
| end | ||
|
|
||
| def extra(a) |
There was a problem hiding this comment.
RubyCritic: UncommunicativeParameterName (new)
Order#extra has the parameter name 'a'
| end | ||
|
|
||
| def extra(a) | ||
| a.map { |x| x * 2 } |
There was a problem hiding this comment.
RubyCritic: UncommunicativeVariableName (new)
Order#extra has the variable name 'x'
| sum | ||
| end | ||
|
|
||
| def extra(a) |
There was a problem hiding this comment.
RubyCritic: UtilityFunction (new)
Order#extra doesn't depend on instance state (maybe move it to another class?)
Scenario B