Commit e5b49b31 authored by Francesco Witz's avatar Francesco Witz
Browse files

feat: add boolean return if check formating method is used during changelog gen process

parent 47ce56b7
......@@ -174,7 +174,7 @@ def check_case(case_type: str, to_check: str) -> bool:
return to_check[0].isupper()
def check_formating(project_path: str):
def check_formating(project_path: str, before_gen: bool):
""" Method that check if the commits follow the formating rules set in the config """
print("Checking commit formatting since last version... 🛠\n")
check_update()
......@@ -210,20 +210,36 @@ def check_formating(project_path: str):
punctuation = set(string.punctuation)
if not any(char in punctuation for char in message):
print("✅ " + commit[1])
if before_gen:
return True
else:
print("❌ " + commit[1] + " ➡ The commit message must not contain special characters")
if before_gen:
return False
else:
print("✅ " + commit[1])
if before_gen:
return True
else:
print("❌ " + commit[1] + " ➡ The commit message has to be " + subject_case)
if before_gen:
return False
else:
print("❌ " + commit[1] + " ➡ The commit message must be a maximum of " + str(subject_length) + " characters")
if before_gen:
return False
else:
print("❌ " + commit[1] + " ➡ The commit type has to be " + type_case)
if before_gen:
return False
else:
print("❌ " + commit[1] + " ➡ The commit type is unknown, add it to the configuration")
if before_gen:
return False
else:
print("❌ " + commit[1] + " ➡ This commit doesn't follow the intended format type: message")
if before_gen:
return False
print("\nCheck finished ! ✨")
# Explain to user how to edit the commits with git
print("ℹ You can edit your commit messages using the interactive version of the git rebase command !")
......@@ -450,7 +466,7 @@ def config(argv):
print("You need to provide a path to the project with the -p option !")
elif args.check:
if(args.path[0]):
check_formating(project_path=args.path[0])
check_formating(project_path=args.path[0], before_gen=False)
else:
print("You need to provide a path to the project with the -p option !")
elif args.update:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment