Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions git_hooks/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,18 @@
teams: list[str] = [
"T",
Copy link
Member

Choose a reason for hiding this comment

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

lets just relax the rule to allow any 1 to 4 letter prefix?

Copy link
Member

Choose a reason for hiding this comment

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

think we can remove the teams block right?

"L2",
"DAE"
"DAE",
"PDEV"
Comment on lines 35 to +38

Choose a reason for hiding this comment

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

medium

For better maintainability and to make it easier to check for existing teams in the future, it's a good practice to keep this list sorted alphabetically.

Suggested change
"T",
"L2",
"DAE"
"DAE",
"PDEV"
"DAE",
"L2",
"PDEV",
"T"

]
linear_ref: str = (
"(?:"
f"{'|'.join(t for t in teams)}"
"|"
r"[A-Z]{3}"
r"[A-Z]{1,4}"
"|"
f"{'|'.join(t.lower() for t in teams)}"
"|"
r"[a-z]{3}"
r"[a-z]{1,4}"
")-[0-9]{1,5}"
)
valid_commit_regex: str = (
Expand Down
4 changes: 4 additions & 0 deletions git_hooks/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def test_commit_type_regex(commit_type: str):
"xyz-1234",
"T-1",
"L2-99999",
"PDEV-1234",
],
)
def test_linear_ref(issue: str):
Expand All @@ -42,6 +43,7 @@ def test_linear_ref(issue: str):
"xyz-1234/docs: ",
"T-1/style: ",
"L2-99999/test: ",
"PDEV-1234/feat: ",
],
)
def test_valid_commit_regex(commit: str):
Expand Down Expand Up @@ -91,6 +93,7 @@ def test_commit_msg_title_regex(commit_msg: str):
"xyz-1234/docs: add something",
"T-1/style add something",
"L2-99999/test: add something",
"PDEV-1234/feat: add something",
],
)
def test_commit_msg_issue_regex(commit_msg: str):
Expand All @@ -108,6 +111,7 @@ def test_commit_msg_issue_regex(commit_msg: str):
"xyz-1234",
"T-1",
"L2-99999",
"PDEV-1234",
],
)
def test_issue_regex(issue: str):
Expand Down
Loading