Skip to content

Commit 1332c4f

Browse files
sync checklist with template repo
1 parent 626cdf5 commit 1332c4f

File tree

1 file changed

+60
-29
lines changed

1 file changed

+60
-29
lines changed

3_documenting_and_testing/code_review_checklist.md

+60-29
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,80 @@ Writing a good function involves a lot of detail, way too much to remember right
44
away! This checklist can help you review your own or your classmates' code until
55
the details become a habit.
66

7-
## File Names
7+
## Behavior
88

9-
- [ ] The file names match the function
10-
- [ ] Test file is named `/tests/test_file_name.py`
9+
### Files
1110

12-
## Files
11+
- [ ] The file name describes the function's behavior
12+
- [ ] There is a module docstring in the function file
13+
- [ ] The test file's name matches the function file name -
14+
`/tests/test_file_name.py`
15+
- [ ] There is a module docstring in the tests file
1316

14-
- [ ] The file names match the function
15-
- [ ] Module header in each file
16-
- [ ] Module docstring in each file
17-
18-
## Unit Tests
17+
### Unit Tests
1918

2019
- [ ] The test class has a helpful name in PascalCase
2120
- [ ] The test class has a docstring
22-
- Each unit test has
21+
- Every unit test has
2322
- [ ] A helpful name
2423
- [ ] A clear docstring
2524
- [ ] Only one assertion
2625
- [ ] There is no logic in the unit test
2726
- [ ] All tests pass
28-
- [ ] (challenge) Tests for defensive assertions
29-
- [ ] (challenge) Tests for many boundary cases
27+
- [ ] There are tests for defensive assertions
28+
- [ ] There are tests for boundary cases
29+
30+
### Function Docstring
31+
32+
- [ ] The function's behavior is described
33+
- The function's arguments are described:
34+
- [ ] Type
35+
- [ ] Purpose
36+
- [ ] Other assumptions (eg. if it's a number, what's the expected range?)
37+
- The return value is described
38+
- [ ] Type
39+
- [ ] Other assumptions are documented
40+
- The defensive assertions are documented using `Raises:`
41+
- [ ] Each assumption about an argument is checked with an assertion
42+
- [ ] Each assertion checks for _only one_ assumption about the argument
43+
- [ ] Include 3 or more (passing!) doctests
44+
45+
### The Function
46+
47+
- [ ] The function's name describes it's behavior
48+
- [ ] The function's name matches the file name
49+
- _It's ok to have extra helper functions if necessary, like with mergesort_
50+
- [ ] The function has correct type annotations
51+
- [ ] The function is not called at the top level of the function file
52+
- _Recursive solutions **can** call the function from **inside** the function body_
3053

31-
## Function Docstring
54+
## Strategy
3255

33-
- [ ] behavior description
34-
- [ ] parameter description
35-
- [ ] return value description
36-
- [ ] include any assumptions
37-
- [ ] include 3 or more (passing!) doctests
38-
- [ ] assertions are documented (if there are any)
39-
- [ ] include 1-2 use cases (if necessary)
56+
### Do's
4057

41-
## Function Implementation
58+
- [ ] Variable names help to understand the strategy
59+
- [ ] Any comments are clear and describe the strategy
60+
- [ ] Lines of code are spaced to help show different stages of the strategy
4261

43-
- [ ] The code is auto-formatted
44-
- [ ] The code has no (reasonable) linting mistakes
62+
### Don'ts
63+
64+
- [ ] The function's strategy _is not_ described in any docstrings or tests
65+
- [ ] Comments explain the _strategy_, **not** the _implementation_
66+
- [ ] The function _does not_ have more comments than code
67+
- If it does, consider finding a new strategy or a simpler implementation
68+
69+
## Implementation
70+
71+
- [ ] The code passes the formatting checks
72+
- [ ] The code passes all Ruff linting checks
73+
- [ ] The code has no (reasonable) Pylint errors
74+
- In code review, you can decide when fixing a Pylint error is helpful and
75+
when it's too restricting.
4576
- [ ] Variables are named with snake_case
46-
- [ ] The function has a clear and helpful name
47-
- [ ] The file's name matches the function name
48-
- [ ] The code follows the strategy as simply as possible
4977
- [ ] Variable names are clear and helpful
50-
- [ ] Comments explain the strategy (if necessary)
51-
- [ ] There are type annotations
52-
- [ ] (challenge) The code includes defensive assertions
78+
- [ ] The code follows the strategy as simply as possible
79+
- [ ] The implementation is as simple as possible given the strategy
80+
- [ ] There are no commented lines of code
81+
- [ ] There are no `print` statements anywhere
82+
- [ ] The code includes defensive assertions
83+
- [ ] Defensive assertions include as little logic as possible

0 commit comments

Comments
 (0)