Skip to content

Commit 92f0c8e

Browse files
committed
circuitpython_libraries.py: change library issue and pr info to show merged PR info, and collapse open PR info
1 parent 609a21f commit 92f0c8e

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

adabot/circuitpython_libraries.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@
103103
if vals[0].startswith("validate")
104104
]
105105

106-
pr_sort_re = re.compile("(?<=\(Open\s)(.+)(?=\sdays)")
106+
pr_sort_re = re.compile(r"(?<=\(Open\s)(.+)(?=\sdays)")
107+
close_pr_sort_re = re.compile(r"(?<=\(Days\sopen:\s)(.+)(?=\))")
107108

108109
def run_library_checks(validators, bundle_submodules, latest_pylint, kw_args):
109110
"""runs the various library checking functions"""
@@ -165,7 +166,8 @@ def run_library_checks(validators, bundle_submodules, latest_pylint, kw_args):
165166
insights = blinka_insights
166167
elif repo["name"] == "circuitpython":
167168
insights = core_insights
168-
errors = validator.gather_insights(repo, insights, since)
169+
closed_metric = bool(insights == lib_insights)
170+
errors = validator.gather_insights(repo, insights, since, show_closed_metric=closed_metric)
169171
if errors:
170172
print("insights error")
171173
for error in errors:
@@ -213,15 +215,16 @@ def run_library_checks(validators, bundle_submodules, latest_pylint, kw_args):
213215
output_handler()
214216
output_handler("Libraries")
215217
print_pr_overview(lib_insights)
216-
output_handler("* {} open pull requests".format(len(lib_insights["open_prs"])))
217-
sorted_prs = sorted(lib_insights["open_prs"],
218-
key=lambda days: int(pr_sort_re.search(days).group(1)),
218+
output_handler("* Merged pull requests:".format(len(lib_insights["open_prs"])))
219+
sorted_prs = sorted(lib_insights["merged_prs"],
220+
key=lambda days: int(close_pr_sort_re.search(days).group(1)),
219221
reverse=True)
220222
for pr in sorted_prs:
221223
output_handler(" * {}".format(pr))
222224
print_issue_overview(lib_insights)
223-
output_handler("* {} open issues".format(len(lib_insights["open_issues"])))
224-
output_handler(" * https://circuitpython.org/contributing")
225+
output_handler("* https://circuitpython.org/contributing")
226+
output_handler(" * {} open issues".format(len(lib_insights["open_issues"])))
227+
output_handler(" * {} open pull requests".format(len(lib_insights["open_prs"])))
225228
output_handler("Library updates in the last seven days:")
226229
if len(new_libs) != 0:
227230
output_handler("**New Libraries**")
@@ -419,7 +422,7 @@ def print_circuitpython_download_stats():
419422
output_handler()
420423

421424
def print_pr_overview(*insights):
422-
merged_prs = sum([x["merged_prs"] for x in insights])
425+
merged_prs = sum([len(x["merged_prs"]) for x in insights])
423426
authors = set().union(*[x["pr_merged_authors"] for x in insights])
424427
reviewers = set().union(*[x["pr_reviewers"] for x in insights])
425428

0 commit comments

Comments
 (0)