Skip to content

Conversation

@jakub-nt
Copy link
Contributor

No description provided.

jakub-nt added 5 commits July 23, 2025 13:24
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>
@jakub-nt jakub-nt requested a review from olehermanse July 23, 2025 14:31
@jakub-nt jakub-nt marked this pull request as draft July 23, 2025 14:53
jakub-nt added 2 commits July 23, 2025 16:55
…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>
@jakub-nt jakub-nt force-pushed the _minor-code-improvements-2 branch from c369b45 to 79933af Compare July 23, 2025 14:56
@jakub-nt jakub-nt marked this pull request as ready for review July 23, 2025 14:59
Copy link
Member

@olehermanse olehermanse left a 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.

Comment on lines +66 to +71
def yesno_to_bool(s: str):
if s == "yes":
return True
if s == "no":
return False
assert False
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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(
Copy link
Member

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.

Comment on lines +142 to +148
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")
Copy link
Member

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.

@olehermanse olehermanse merged commit c8a1c5e into cfengine:master Jul 24, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants