Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.thesozocrm.com/llms.txt

Use this file to discover all available pages before exploring further.

Code Review Process

This guide covers the code review process, standards, and what reviewers look for.

PR Checklist

Before requesting a review, ensure:

What Reviewers Look For

Code Quality

Readability

Code is easy to read and understand

Consistency

Follows project patterns and conventions

Error Handling

Proper error handling and user feedback

Performance

No obvious performance issues

Security

No security vulnerabilities

Testing

Adequate test coverage

Common Issues

// ❌ Bad
const data = await fetchData();

// ✅ Good
try {
  const data = await fetchData();
} catch (error) {
  console.error('Error:', error);
  toast.error('Failed to load data');
}
// ❌ Bad
const dealerFee = 29.16;

// ✅ Good
const dealerFee = companySettings?.defaultDealerFee ?? 29.16;
// ❌ Bad
if (!data) return null;

// ✅ Good
if (loading) return <LoadingSpinner />;
if (!data) return <EmptyState />;
Remove unused imports and variables
Remove console.logs and debug statements

Review Standards

Must Have

  • ✅ Code compiles without errors
  • ✅ All tests pass
  • ✅ No linter errors
  • ✅ Follows project patterns
  • ✅ Error handling implemented
  • ✅ Loading states provided

Should Have

  • 📝 Clear variable/function names
  • 📝 Comments for complex logic
  • 📝 Type safety (if using TypeScript)
  • 📝 Accessibility considerations

Nice to Have

  • 🎨 Consistent formatting
  • 🎨 Performance optimizations
  • 🎨 Additional test coverage

Review Process

1

Create PR

Push your branch and create PR on GitHub
2

Request Review

Request review from code owner (see CODEOWNERS)
3

Address Feedback

Make requested changes and push updates
4

Get Approval

Wait for approval before merging
5

Merge

Merge PR (or let reviewer merge)

Responding to Reviews

When You Get Feedback

  1. Read Carefully - Understand what’s being asked
  2. Ask Questions - If unclear, ask for clarification
  3. Make Changes - Address all feedback
  4. Push Updates - Push new commits to the PR
  5. Re-request Review - If needed, re-request review

When Reviewing

  1. Be Constructive - Provide helpful feedback
  2. Be Specific - Point to exact lines/issues
  3. Suggest Solutions - Offer alternatives when possible
  4. Approve When Ready - Don’t block on minor issues

Common Review Comments

”Please add error handling"

// Add try/catch and user feedback
try {
  await operation();
} catch (error) {
  toast.error('Operation failed');
}

"This needs a loading state"

// Show loading indicator
if (loading) return <LoadingSpinner />;

"Please add tests"

// Add unit tests for new functionality
describe('myFunction', () => {
  it('should handle edge case', () => {
    // Test implementation
  });
});

"Please remove debug code”

// Remove console.logs and debug statements
// Use proper logging if needed
logger.debug('Debug info');

Approval Requirements

Dev Branch

  • ✅ 1 approval required
  • ✅ All CI checks must pass
  • ✅ No merge conflicts

Staging Branch

  • ✅ 1 approval required
  • ✅ All CI checks must pass
  • ✅ Must come from dev branch

Main Branch (Production)

  • ✅ 2 approvals required
  • ✅ All CI checks must pass
  • ✅ Must come from staging branch
  • ✅ No bypass allowed (even for admins)

Best Practices

Small PRs

Keep PRs focused and small (< 500 lines)

Clear Description

Explain what and why in PR description

Link Issues

Link to Linear issues in PR description

Review Your Own Code

Review your own PR before requesting review

Be Responsive

Respond to review feedback promptly

Learn from Feedback

Use reviews as learning opportunities