LogoSkills

code-review Templates

Templates for writing code review results.

Code Review Templates#

Templates for writing code review results.


Template A: Full Review Result#

# Code Review: [PR title or filename]

## Summary

**Overall**: โญโญโญโญโ˜† (4/5)

**Reviewer**: [name]
**Date**: [YYYY-MM-DD]

| Category | Score | Key Issues |
|----------|-------|------------|
| ๐Ÿ—๏ธ Architecture | โœ… | - |
| ๐Ÿงฉ State Management | โš ๏ธ | BlocBuilder optimization needed |
| ๐Ÿ”’ Security | โœ… | - |
| โšก Performance | โš ๏ธ | Image cache size not specified |
| ๐Ÿงช Testing | โŒ | UseCase tests missing |
| ๐Ÿ“– Readability | โœ… | - |
| ๐ŸŒ i18n | โœ… | - |
| โ™ฟ Accessibility | โš ๏ธ | Some semantic labels missing |

---

## ๐Ÿ”ด Critical Issues (must fix before merge)

### 1. [Security] API key hardcoded
- **File**: `lib/core/config.dart:15`
- **Problem**: API key directly included in source code
- **Impact**: Security vulnerability, key exposure risk
- **Fix**: Use environment variables via Envied
dart

// Before const apiKey = 'sk-1234567890abcdef';

// After @Envied(path: '.env') abstract class AppConfig { @EnviedField(varName: 'API_KEY') static const String apiKey = _AppConfig.apiKey; }


 ### 2. [Testing] UseCase tests missing
- **File**: `test/domain/usecase/`
- **Problem**: No tests for core business logic
- **Impact**: Risk of regression bugs
- **Fix**: Add unit tests per UseCase

---

## ๐ŸŸก Improvements (recommended fixes)

### 1. [Performance] Image cache size needs to be specified
- **File**: `lib/presentation/widget/product_card.dart:42`
- **Current code**:
dart

Image.network(product.imageUrl)

- **Recommended code**:
dart

CachedNetworkImage( imageUrl: product.imageUrl, cacheWidth: 200, cacheHeight: 200, )


 ### 2. [State Management] BlocBuilder optimization
- **File**: `lib/presentation/page/home_page.dart:78`
- **Current code**:
dart

BlocBuilder<HomeBloC, HomeState>( builder: (context, state) => UserWidget(state.user), )

- **Recommended code**:
dart

BlocBuilder<HomeBloC, HomeState>( buildWhen: (previous, current) => previous.user != current.user, builder: (context, state) => UserWidget(state.user), )


 ---

## ๐ŸŸข Suggestions (optional improvements)

### 1. [Readability] Variable name improvement suggestion
- `data` โ†’ `userProfile`
- `list` โ†’ `productItems`
- `result` โ†’ `authResult`

### 2. [Structure] Widget extraction suggestion
- `_buildHeader()` โ†’ Extract to `HomeHeader` widget
- Improves reusability and testability

---

## โ“ Questions

1. `auth_bloc.dart:45` - What is the intent of this exception handling logic?
2. `user_repository.dart:89` - Is there a reason the cache expiration time is 5 minutes?

---

## Conclusion

Overall good code. Can merge after fixing 2 Critical Issues.

Template B: Quick Review Result#

# Quick Review: [filename]

**Result**: โœ… Approved with comments

## Key Feedback

1. **[Performance]** Adding image cache size recommended
   - `product_card.dart:42`

2. **[Readability]** Variable name `data` โ†’ `userProfile` recommended
   - `home_bloc.dart:25`

## Well Done ๐Ÿ‘

- Clean Architecture pattern well followed
- Immutable state management using Freezed
- Proper error handling

Template C: Detailed Category Review#

# Detailed Review: [category name]

## ๐Ÿ—๏ธ Architecture Review

### Review Items

| Item | Status | Notes |
|------|--------|-------|
| Clean Architecture layer separation | โœ… | |
| UseCase pattern usage | โœ… | |
| Repository interface separation | โš ๏ธ | Partially missing |
| Feature module independence | โœ… | |

### Detailed Feedback

#### Repository Interface Separation (โš ๏ธ)

**Current State**:
- `CartRepository` directly implemented without interface

**Recommended Change**:
1. Create `ICartRepository` interface
2. Place interface in Domain layer
3. Implement in Data layer
dart

// domain/repository/i_cart_repository.dart abstract interface class ICartRepository { Future<Either<Failure, Cart>> getCart(); Future<Either<Failure, void>> addItem(CartItem item); }

// data/repository/cart_repository.dart @LazySingleton(as: ICartRepository) class CartRepository implements ICartRepository { // implementation }


Template D: PR Comments#

Required Fix (Blocking)#

๐Ÿ”ด **[Required]** Security vulnerability

**Location**: `lib/core/config.dart:15`

**Problem**: API key is hardcoded.

**Fix**:
dart

// Use Envied @EnviedField(varName: 'API_KEY') static const String apiKey = _AppConfig.apiKey;


 Cannot merge until this issue is resolved.

Improvement Request (Non-blocking)#

๐ŸŸก **[Improvement]** Performance optimization

**Location**: `lib/presentation/widget/product_card.dart:42`

**Current code**:
dart

Image.network(product.imageUrl)


 **Recommended code**:
dart

CachedNetworkImage( imageUrl: product.imageUrl, cacheWidth: 200, )


 Specifying image cache size reduces memory usage.

Suggestion/Question#

๐ŸŸข **[Suggestion]** Variable name improvement

**Location**: `lib/presentation/bloc/home_bloc.dart:25`

Changing variable name `data` to `userProfile` would improve readability.

---

โ“ **[Question]** Exception handling intent

**Location**: `lib/data/repository/auth_repository.dart:45`

Is there a reason this try-catch block ignores all exceptions?

Praise#

โœจ **Nice!** Clean state management

**Location**: `lib/presentation/bloc/cart_bloc.dart`

State management using Freezed and Union Types is very clean.
The loading/error/success state separation is especially well done!

Template E: Review Checklist (Self-Review)#

# Self-Review Checklist

Self-check list before PR submission.

## Basics

- [ ] Code builds successfully
- [ ] All tests pass
- [ ] No lint errors
- [ ] Related issues are linked

## Architecture

- [ ] Clean Architecture layer separation followed
- [ ] No direct dependencies between feature modules
- [ ] New code follows existing patterns

## Security

- [ ] No hardcoded secrets
- [ ] No sensitive information in logs
- [ ] Input validation applied

## Performance

- [ ] const widgets used
- [ ] Image cache size specified
- [ ] Resources released in dispose

## Testing

- [ ] Tests added for new features
- [ ] Edge cases covered

## Internationalization

- [ ] No hardcoded strings
- [ ] Translation keys used

## Final Check

- [ ] Unnecessary console.log/print removed
- [ ] TODO comments resolved or issues filed
- [ ] Commit messages follow convention

Template F: Review Summary (Approve/Request Changes)#

Approve โœ…#

LGTM! ๐ŸŽ‰

All checklist items verified.

**Verified items**:
- โœ… Build successful
- โœ… Tests passing
- โœ… No security issues
- โœ… Code quality good

Great work!

Request Changes ๐Ÿ”„#

Changes requested.

**Required fixes** (must resolve before merge):
1. Remove hardcoded API key (`config.dart:15`)
2. Add UseCase tests

**Recommended fixes** (optional):
1. Specify image cache size
2. BlocBuilder optimization

Please re-request review after fixing the required items.

Comment ๐Ÿ’ฌ#

Overall looks good. A few questions/suggestions.

**Questions**:
1. Curious about the caching strategy choice

**Suggestions**:
1. Please consider error message internationalization

Please respond after review.