AR8: Engineering standards and code review

Lesson 3 of 5 · reading 15–25 minutes; practice and project time is on the module page

Code review

🎯You'll be able to

Explain what code review is for, review against a checklist, and keep pull requests small enough to review well.

🏠The everyday picture

Before a surgeon operates, a checklist is read aloud: right patient, right side, allergies checked. It takes a minute and catches the mistakes skilled people still make when busy.

📘What it really is

📝A worked example

Input: PR 41 in reviews/pr-41.diff, adding refunds.

Steps:

  1. Security: a token written in the code (line 5).
  2. Correctness: the refund call isn't awaited (line 10); the empty catch hides failures and the ledger records a refund that may not have happened (lines 11 and 12); nothing stops a refund larger than the payment.
  3. Tests: only the happy path is tested.
  4. Smaller points: console.log instead of the logger (line 8).

Expected output: findings in order of harm, ready to write up (Lesson 4).

🌍Where it's used

📝Case scenario

A team reviewed 2,000-line pull requests with a quick "looks good". A rounding bug in an invoice change slipped through and overcharged customers for a month. They limited pull requests to small, focused changes with a checklist, and the next similar bug was caught in review.

🖱️Try it

Review a small change from any open-source project's recent pull requests using the five checklist groups. Success: at least one finding or one specific piece of praise in three groups.

⚠️Common mistakes

🛠️For your project

Project 3's test 7 checks docs/review-checklist.md: at least ten items in at least four groups, each pointing to a rule or judgement.

✅Quick check

What is code review mainly for?

Show the answer

Catching problems that would hurt customers, money or data, sharing knowledge and keeping the code consistent.

Why do small pull requests get better reviews?

Show the answer

A reviewer can read them carefully; long ones get skimmed.

← PreviousAutomating standards
ProLearners Assist