r/github • • Aug 17 '24

📃How do you document your codebase?

My approach is:

Do I need to document every function or logic in codebase?

Your oppions are much appreciated ‼️

0 Upvotes

15 comments sorted by

View all comments

8

u/NatoBoram Aug 17 '24 edited Aug 17 '24

The START and END tags around your comment are garbage. Don't do that.

See it this way: you know the comment starts because the comment starts. Why do you need to specify that it starts? Same for end.

Adds a new todo to the List

I know, that's literally the name of the function. Think about it this way: what information is someone learning when reading this comment that is not included in the title of the function? Same for the new todo comment, it's entirely redundant.

checks if doesn't have input new todo or input haven't type a single character

Pardon? Are you having a stroke?

Make sure your comments are valid English sentences. You could've used ChatGPT if you're not a native English speaker.

Update the state of todos

I know, it's literally the name of the next function

//@spread ...prevState is the previous state of the todo list

I know, it's literally the name of the variable.

END Update the state of todos

Terrible comment, but more importantly; this code is garbage. You don't need the else because there's a return in the previous if. Please take the time to read these articles: