Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Palindrome solution #447

Open
wants to merge 152 commits into
base: main
Choose a base branch
from

Conversation

njeridorcaswanja
Copy link


name: solution review
about: A template PR for code review with a checklist

Behavior

Files

  • The file name describes the function's behavior
  • There is a module docstring in the function file
  • The test file's name matches the function file name -
    /tests/test_file_name.py
  • There is a module docstring in the tests file

Unit Tests

  • The test class has a helpful name in PascalCase
  • The test class has a docstring
  • Every unit test has
    • A helpful name
    • A clear docstring
    • Only one assertion
    • There is no logic in the unit test
  • All tests pass
  • There are tests for defensive assertions
  • There are tests for boundary cases

Function Docstring

  • The function's behavior is described
  • The function's arguments are described:
    • Type
    • Purpose
    • Other assumptions (eg. if it's a number, what's the expected range?)
  • The return value is described
    • Type
    • Other assumptions are documented
  • The defensive assertions are documented using Raises:
    • Each assumption about an argument is checked with an assertion
    • Each assertion checks for only one assumption about the argument
  • Include 3 or more (passing!) doctests

The Function

  • The function's name describes it's behavior
  • The function's name matches the file name
    • It's ok to have extra helper functions if necessary, like with mergesort
  • The function has correct type annotations
  • The function is not called at the top level of the function file
    • Recursive solutions can call the function from inside the function body

Strategy

Do's

  • Variable names help to understand the strategy
  • Any comments are clear and describe the strategy
  • Lines of code are spaced to help show different stages of the strategy

Don'ts

  • The function's strategy is not described in any docstrings or tests
  • Comments explain the strategy, not the implementation
  • The function does not have more comments than code
    • If it does, consider finding a new strategy or a simpler implementation

Implementation

  • The code passes the formatting checks
  • The code passes all Ruff linting checks
  • The code has no (reasonable) Pylint errors
    • In code review, you can decide when fixing a Pylint error is helpful and
      when it's too restricting.
  • Variables are named with snake_case
  • Variable names are clear and helpful
  • The code follows the strategy as simply as possible
  • The implementation is as simple as possible given the strategy
  • There are no commented lines of code
  • There are no print statements anywhere
  • The code includes defensive assertions
  • Defensive assertions include as little logic as possible

AmmarIbrahimTech and others added 30 commits December 25, 2024 22:01
…(local_constraints)

$ git branch
* local_constraints
  main

3mmar@AmmarOsman MINGW64 ~/Deliverables_MIT/ET6-foundations-group-21 (local_constraints)
$ git checkout main
Switched to branch 'main'
Your branch is up to date with 'origin/main'.

3mmar@AmmarOsman MINGW64 ~/Deliverables_MIT/ET6-foundations-group-21 (main)
$ git pull origin maink
fatal: couldn't find remote ref maink

3mmar@AmmarOsman MINGW64 ~/Deliverables_MIT/ET6-foundations-group-21 (main)
$ git pull origin main
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (2/2), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 5 (delta 1), reused 0 (delta 0), pack-reused 3 (from 1)
Unpacking objects: 100% (5/5), 2.43 KiB | 131.00 KiB/s, done.
From https://github.com/MIT-Emerging-Talent/ET6-foundations-group-21
 * branch            main       -> FETCH_HEAD
   7247bf5..8e1107d  main       -> origin/main
Updating 7247bf5..8e1107d
Fast-forward
 README.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

3mmar@AmmarOsman MINGW64 ~/Deliverables_MIT/ET6-foundations-group-21 (main)
$ git log
commit 8e1107d (HEAD -> main, origin/main, origin/HEAD)
Merge: 7247bf5 c7b01fd
Author: Fikremichael Mamo <[email protected]>
Date:   Fri Dec 27 17:08:11 2024 +0300

    Merge pull request #8 from MIT-Emerging-Talent/Readme

    Updating group's name

commit c7b01fd
Author: nourana819 <[email protected]>
Date:   Fri Dec 27 03:29:25 2024 +0300

    Describe what you changed

commit 7247bf5 (origin/Group-Norms)
Author: Evan Cole <[email protected]>
Date:   Mon Dec 23 09:26:34 2024 -0500

    no longer suggesting discussions

commit 10b1f43 (origin/Setting-learning-objectives, origin/Project-board)
Author: colevandersWands <[email protected]>
Date:   Sat Dec 21 08:53:50 2024 -0500
Merge branch 'Setting-learning-objectives' of https://github.com/MIT-Emerging-Talent/ET6-foundations-group-21 into learning_goals
~                                                                 ~                                                                 ~                                                                 ~                                                                 ~                                                                 ~                                                                 ~                                                                 ~                                                                 ~                                                                 ~                                                                 ~                                                                 ~                                                                 ~                                                                 ~                                                                 ~                                                                 ~                                                                 ~                                                                 ~                                                                 ~                                                                 ~                                                                 ~                                                                 ~                                                                 ~                                                                 ~                                                                 ~                                                                 ~                                                                 ~                                                                 ~                                                                 .git/MERGE_MSG [unix] (12:06 29/12/2024)                  5,12 Allsearch hit TOP, continuing at BOTTOM

~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  ~                                                                  .git/MERGE_MSG[+] [unix] (12:06 29/12/2024)                 1,1 All-- INSERT --

~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~
~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  ~                                                                                  .git/MERGE_MSG[+] [unix] (12:06 29/12/2024)                                 1,1 All-- INSERT --

Merged branch 'Setting-learning-objectives' into 'learning_goals'
KimaciaJnr and others added 30 commits January 9, 2025 17:19
update function name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.