-
Notifications
You must be signed in to change notification settings - Fork 13
Code quality improvements #261
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
Code quality improvements #261
Conversation
Signed-off-by: jakub-nt <175944085+jakub-nt@users.noreply.github.com>
Signed-off-by: jakub-nt <175944085+jakub-nt@users.noreply.github.com>
Signed-off-by: jakub-nt <175944085+jakub-nt@users.noreply.github.com>
…on code Signed-off-by: jakub-nt <175944085+jakub-nt@users.noreply.github.com>
This improves modularity (useful in case Git initialization needs to also be done elsewhere), and helps deflate the currently overgrown `commands.py` file Signed-off-by: jakub-nt <175944085+jakub-nt@users.noreply.github.com>
…inting and returning 0 or 1 Signed-off-by: jakub-nt <175944085+jakub-nt@users.noreply.github.com>
Signed-off-by: jakub-nt <175944085+jakub-nt@users.noreply.github.com>
c369b45 to
79933af
Compare
olehermanse
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, just some smaller comments.
| def yesno_to_bool(s: str): | ||
| if s == "yes": | ||
| return True | ||
| if s == "no": | ||
| return False | ||
| assert False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| def yesno_to_bool(s: str): | |
| if s == "yes": | |
| return True | |
| if s == "no": | |
| return False | |
| assert False | |
| def yesno_to_bool(s: str): | |
| assert s in ("yes", "no") | |
| return s == "yes" |
| raise CFBSUserError("Already initialized - look at %s" % cfbs_filename()) | ||
|
|
||
| name = prompt_user( | ||
| project_name = prompt_user( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is very subjective. I thought it was nicer before when name matched the name field, same as description, but not a big deal.
| if not is_git_repo(): | ||
| git_init(user_name, user_email, description) | ||
| else: | ||
| if not git_set_config("user.name", user_name) or not git_set_config( | ||
| "user.email", user_email | ||
| ): | ||
| raise CFBSExitError("Failed to set Git user name and email") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could have used early return and avoided a bit of indentation.
No description provided.