add task solution#3325
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation correctly satisfies all functional requirements. The getArea methods properly use this, triangle calculation uses Heron's formula correctly, circles use Math.PI, and the getInfo function returns the expected format. However, the ESLint check identified several style issues in your test file that need attention: there are duplicate class/function declarations (Triangle, Circle, Rectangle, and getInfo appear to be defined multiple times), and there are some style violations like missing blank lines between class members and a missing semicolon. You can auto-fix most of these by running npx eslint src/figuresClasses.test.ts --fix, then manually remove the duplicate declarations. The functional implementation is solid—focus on cleaning up the linting issues and removing any duplicate code blocks.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Error messages are generic placeholders ('your error message') instead of detailed descriptions explaining what validation failed. Checklist item #3 requires error messages to be descriptive. For example: Triangle sides: 'All triangle sides must be greater than 0' and 'Triangle sides cannot form a valid triangle: longest side must be less than sum of other two sides'; Circle: 'Circle radius must be greater than 0'; Rectangle: 'Rectangle width and height must be greater than 0'. Additionally, ESLint style violations: Missing blank lines between class members in src/figuresClasses.ts (9 errors). You can auto-fix these by running npx eslint src/figuresClasses.ts --fix.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| if (a <= 0 || b <= 0 || c <= 0) { | ||
| throw new Error('your error message'); |
There was a problem hiding this comment.
This violates checklist item #3: error messages should be detailed descriptions. Change to something like 'All triangle sides must be greater than 0'
| if (max >= sum - max) { | ||
| throw new Error('your error message'); |
There was a problem hiding this comment.
This violates checklist item #3: error messages should be detailed descriptions. Change to something like 'Triangle sides cannot form a valid triangle: longest side must be less than sum of other two sides'
| if (radius <= 0) { | ||
| throw new Error('your error message'); |
There was a problem hiding this comment.
This violates checklist item #3: error messages should be detailed descriptions. Change to something like 'Circle radius must be greater than 0'
| if (width <= 0 || height <= 0) { | ||
| throw new Error('your error message'); |
There was a problem hiding this comment.
This violates checklist item #3: error messages should be detailed descriptions. Change to something like 'Rectangle width and height must be greater than 0'
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
The request meets the required criteria for approval.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| color: Color; | ||
|
|
||
| a: number; | ||
|
|
||
| b: number; | ||
|
|
||
| c: number; | ||
|
|
||
| constructor(color: Color, a: number, b: number, c: number) { | ||
| if (a <= 0 || b <= 0 || c <= 0) { | ||
| throw new Error('All triangle sides must be greater than 0'); | ||
| } | ||
|
|
||
| const max = Math.max(a, b, c); | ||
| const sum = a + b + c; | ||
|
|
||
| if (max >= sum - max) { | ||
| throw new Error( | ||
| 'Triangle sides cannot form a valid triangle: longest side must be less than sum of other two sides', | ||
| ); | ||
| } | ||
|
|
||
| this.color = color; | ||
| this.a = a; | ||
| this.b = b; | ||
| this.c = c; |
There was a problem hiding this comment.
Checklist item #4: Constructor parameters with access modifiers implicitly create class properties. Instead of declaring properties separately and assigning in constructor body, use access modifiers directly on parameters.
BAD: this.a = a; this.b = b; this.c = c; in constructor body
GOOD: constructor(private color: Color, private a: number, ...)
| color: Color; | ||
|
|
||
| export class Rectangle implements Figure {} | ||
| radius: number; | ||
|
|
||
| constructor(color: Color, radius: number) { | ||
| if (radius <= 0) { | ||
| throw new Error('Circle radius must be greater than 0'); | ||
| } | ||
|
|
||
| this.color = color; | ||
| this.radius = radius; |
There was a problem hiding this comment.
Checklist item #4: Same issue here. Use constructor(private color: Color, private radius: number) instead of separate property declaration and manual assignment.
| color: Color; | ||
|
|
||
| width: number; | ||
|
|
||
| height: number; | ||
|
|
||
| constructor(color: Color, width: number, height: number) { | ||
| if (width <= 0 || height <= 0) { | ||
| throw new Error('Rectangle width and height must be greater than 0'); | ||
| } | ||
|
|
||
| this.color = color; | ||
| this.width = width; | ||
| this.height = height; |
There was a problem hiding this comment.
Checklist item #4: Same issue here. Use constructor(private color: Color, private width: number, private height: number) instead of separate property declarations and manual assignment.
No description provided.