Skip to content

Commit

Permalink
Improve report (#32)
Browse files Browse the repository at this point in the history
* Update does_contain_bad_words.py

* Update does_contain_bad_words.py

* comment of is_empty_body

* comment is_empty_body

* comment is_test_commit

* comment for not_a_squased_commit

* finish commenting indicators

* comment score and is_old method in git.py

* 🎨 Format Python code with psf/black (#30)

Co-authored-by: gcattan <[email protected]>

* typo

* fix previous merge conflict

* typo

* remove debug trace

* format indices in example

* Add some recommendation in example

* 🎨 Format Python code with psf/black (#33)

Co-authored-by: gcattan <[email protected]>

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: gcattan <[email protected]>
  • Loading branch information
3 people authored Dec 10, 2022
1 parent 2702c6b commit a9caa35
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
22 changes: 18 additions & 4 deletions example/git-quality-check.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,24 @@
old_branches_index = count_old_branches(branches)
coupling_index = count_coupled(branches, main_branches)

print("Percent of bad commits: ", bad_commit_index)
print("Percent of test commits: ", test_index)
print("Percent of old branches: ", old_branches_index)
print("Percent of coupled branches", coupling_index)
print("Percent of bad commits: ", format_number(bad_commit_index))
print(
" A high number of bad commits means you should avoid WIP or empty commits for example."
)
print("Percent of test commits: ", format_number(test_index))
print(
" A low number of test commits, might indicates that you are not writing enough tests for your software."
)
print("Percent of old branches: ", format_number(old_branches_index))
print(
" A high percent of old branches, means that you should delete unused branches or already merged branches in your repo."
)
print("Percent of coupled branches", format_number(coupling_index))
print(
" A high percent of coupled branches, means that you should use more often squash \
and merge and avoid upmerge of your master/main branch in feature branches.\
A high number of coupled branches complicate your commit history and make difficult the use of git-bisect for example."
)

overall = compute_score(
bad_commit_index, test_index, old_branches_index, coupling_index
Expand Down
1 change: 0 additions & 1 deletion git_quality_check/indicators/counters/count_coupled.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def count_coupled(branches: list[str], main_branches: list[str]):
for bA in branches:
for bB in branches:
if not bA == bB:
print(bA, bB, contains(bA, bB))
counter += 1 if contains(bA, bB) else 0
max_counter += 1
return counter / max_counter * 100
1 change: 0 additions & 1 deletion git_quality_check/utils/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def contains(branchA: str, branchB: str):
try:
ret = run_git(["branch", "--contains", branchB, "-r"]).split("\n")
except:
print("Git `branch --contains failed with: ", branchB)
return False
for r in ret:
if branchA == r.strip().lstrip():
Expand Down

0 comments on commit a9caa35

Please sign in to comment.