Skip to content

Conversation

@jhill1
Copy link
Owner

@jhill1 jhill1 commented Apr 29, 2025

Excellent work! All tests pass cleanly. Code is well written and clear.

Things done well:

  • clear code with some good comments
  • tests pass perfectly
  • reasonably good commit history which is generally well partitioned

To improve

  • add copyright and licence
  • make sure commits are as atomic as possible; change one "thing" in a commit so that commit can be unwound if needed
  • Feel free to add features and adjust and add tests as needed

python/todo.py Outdated
Return - nothing
"""

with open(TASK_FILE, "a") as f: #append ensures text is always inserted at the end of the file
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good; comment should probably be more a # Note: append to add task to end of list

f.write(task + "\n")

def list_tasks():
"""Function: list_tasks
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try not to change two things in one commit. You've edited the add_task and list_tasks on same commit, which makes it harder to unwind

python/todo.py Outdated
return ""

with open(TASK_FILE, "r") as f:
with open(TASK_FILE, "r") as f:
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid adding whitespace in a commit. Use git diff to see what is being changed

python/todo.py Outdated
read = f.readlines()

return "".join(f"{i+1}. {task}" for i, task in enumerate(read)) #combines and numbers tasks
return "\n".join(f"{i+1}. {task.strip()}" for i, task in enumerate(read)).strip() #combines and numbers tasks
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rstrip is probably the better function here as you only want whitespac stripping from right

with open(TASK_FILE, "a") as f: #text is inserted at the end of the file

with open(TASK_FILE, "a") as f:
#insert text at the end of the file
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent comment to match code

"""

with open(TASK_FILE, "a") as f:
with open(TASK_FILE, "a", encoding="utf-8") as f:
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As previous; try and group commits into logical units so unwinding them is easier, i.e. do all the comment lint tasks, then the encoding, then the imports, etc, etc

@jhill1
Copy link
Owner Author

jhill1 commented Apr 29, 2025

@TobyD785 Really nice work. Feedback above

@jhill1 jhill1 closed this Apr 29, 2025
@jhill1 jhill1 reopened this May 1, 2025
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.

2 participants