style: improve code formatting and whitespace

- Remove trailing whitespaces in Step class
- Improve formatting in GitHub and GitLab commit modules
- Fix indentation in error message output
- Add proper line spacing between functions
This commit is contained in:
bobo.yang 2025-03-07 13:02:06 +08:00
parent bb0ed153c7
commit 083c714ac0
3 changed files with 30 additions and 19 deletions

View File

@ -34,4 +34,3 @@ class Step(AbstractContextManager):
IDEService().ide_logging(
"debug", f"Step {self.title} took {end_time - self.enter_time:.2f} seconds"
)

View File

@ -362,7 +362,6 @@ def ask_for_push():
Returns:
bool: 用户是否选择推送
"""
from lib.chatmark import Button
print(
"Step 3/3: Would you like to push your commit to the remote repository?",
@ -375,6 +374,7 @@ def ask_for_push():
return button.clicked == 0 # 如果用户点击第一个按钮(Yes)则返回True
def push_changes():
"""
推送更改到远程仓库
@ -385,7 +385,12 @@ def push_changes():
try:
current_branch = get_current_branch()
if not current_branch:
print("Could not determine current branch. Push failed.", end="\n\n", file=sys.stderr, flush=True)
print(
"Could not determine current branch. Push failed.",
end="\n\n",
file=sys.stderr,
flush=True,
)
return False
print(f"Pushing changes to origin/{current_branch}...", end="\n\n", flush=True)
@ -408,6 +413,7 @@ def push_changes():
print(f"An unexpected error occurred: {str(e)}", end="\n\n", file=sys.stderr, flush=True)
return False
def main():
global language
try:

View File

@ -362,7 +362,6 @@ def ask_for_push():
Returns:
bool: 用户是否选择推送
"""
from lib.chatmark import Button
print(
"Step 3/3: Would you like to push your commit to the remote repository?",
@ -375,6 +374,7 @@ def ask_for_push():
return button.clicked == 0 # 如果用户点击第一个按钮(Yes)则返回True
def push_changes():
"""
推送更改到远程仓库
@ -385,7 +385,12 @@ def push_changes():
try:
current_branch = get_current_branch()
if not current_branch:
print("Could not determine current branch. Push failed.", end="\n\n", file=sys.stderr, flush=True)
print(
"Could not determine current branch. Push failed.",
end="\n\n",
file=sys.stderr,
flush=True,
)
return False
print(f"Pushing changes to origin/{current_branch}...", end="\n\n", flush=True)
@ -408,6 +413,7 @@ def push_changes():
print(f"An unexpected error occurred: {str(e)}", end="\n\n", file=sys.stderr, flush=True)
return False
def main():
global language
try: