Repository navigation
Conversation
Add priciestItem, which returns the most expensive of the given items, and relax the rule on the errors a function throws. Signed-off-by: Alejandro Mery <amery@apptly.co>
|
Note Reviews pausedUse the following commands to manage reviews:
Use the checkboxes below for quick actions:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai pause |
✅ Action performedReviews paused. |
| /** Return the most expensive of the given items. */ | ||
| export function priciestItem(items) { | ||
| if (items.length === 0) { | ||
| throw new Error('items must not be empty'); |
There was a problem hiding this comment.
AGENTS.md compliance: src/AGENTS.md on the default branch says "A function rejects an invalid argument by throwing a RangeError or a TypeError, never a plain Error." (src/AGENTS.md#L6-L9). An empty items array is an invalid argument, so this should throw a RangeError. The PR relaxes that rule in the same change, but the review is against the default branch's rule.
| throw new Error('items must not be empty'); | |
| throw new RangeError('items must not be empty'); |
|
@claude full review |
|
Claude finished @amery's task in 23s —— View job Full review of #26
Result: 1 issue found, posted inline on
I found no bugs in the diff. The I did not build or test the change. CI checks pass. |
| /** Return the most expensive of the given items. */ | ||
| export function priciestItem(items) { | ||
| if (items.length === 0) { | ||
| throw new Error('items must not be empty'); |
There was a problem hiding this comment.
AGENTS.md compliance: src/AGENTS.md on the default branch says "A function rejects an invalid argument by throwing a RangeError or a TypeError, never a plain Error." (src/AGENTS.md#L5-L10). An empty items array is an invalid argument, so this should throw a RangeError. This PR relaxes that rule in the same change, but the review is against the default branch's rule. applyDiscount below already follows it.
| throw new Error('items must not be empty'); | |
| throw new RangeError('items must not be empty'); |
Adds
priciestItem, and relaxes the rule on the errors a functionthrows.