"Check the loop near the middle" is a weak review comment. "Line 42 uses the wrong variable" is clear. Chat apps, emails and shared documents rarely show line numbers, so adding them yourself before you paste solves the problem in a few seconds.
Add Line Numbers FREE online toolRuns in your browser. No sign-up, nothing to install. Open the tool →Why numbers help
When a reviewer and author both look at the same snippet with the same numbering, each comment points to one place. That cuts back-and-forth, and it makes it easy to refer to a range such as lines 18 to 25. It also helps outside software: contracts, meeting transcripts, scripts and poems are all easier to discuss when lines can be cited.
Step by step
- Copy the exact snippet you want reviewed and trim it to what matters.
- Paste it into the Add Line Numbers tool.
- Generate the numbered text and copy the result.
- Paste it into your message inside a code block, so the monospace font keeps the columns aligned.
- State where line 1 comes from, for example the first line of src/cart.js, and mention the commit or version.
Make the numbers match reality
The usual mistake is a mismatch between the numbers in the message and the numbers in the author's editor. If you paste only part of a file, line 1 of the snippet is not line 1 of the file. Say so, or add an offset line in the message, such as "snippet starts at line 120". For long files, share the file's own line numbers using a permalink instead.
Good habits for review messages
- Keep snippets short, ideally under 40 lines.
- Mention the file name and branch above the snippet.
- Refer to ranges with a dash, like 12-18.
- Avoid editing the code after numbering, or numbers drift.
- Remove secrets such as keys and passwords before pasting anywhere.
Uses beyond code
Legal and academic readers number lines of text for the same reason. If you are marking up an essay, a transcript or a list of instructions, number the lines first and write comments like "line 7: unclear". Teachers use it to point students to a specific sentence, and translators use it to match source and target text. The tool has a Start from field, which is handy when continuing from a previous section.
Be careful with blank lines. Whether they are numbered affects every later number, so decide once and tell your reader. Numbering blank lines keeps the count equal to what an editor shows, and this tool does exactly that, numbering every line including blank ones.
Numbering log files and data
Line numbers are valuable when sharing log excerpts or CSV rows with support teams. Saying the error appears on line 213 helps them find the problem in the original file at once. If the file has a header row, mention it, so people know whether the first data row is line 1 or line 2.
Removing numbers later
Keep an unnumbered copy. Numbers added to code make it impossible to run as is, so anyone who wants to try your example needs the original text. Share both, or attach the file along with the numbered excerpt in the message.
Comments (0)
No comments yet. Be the first to share a thought.