mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-06 10:03:49 -06:00
fix: rank uncheckable profiles first in triage
--strict fails on a profile no declared repository answers for, yet --triage scored it 0 under the clean profiles and left it out of the count to review. It now weighs as a pin to set again and is counted.
This commit is contained in:
1 parent
63fafaf0f9
commit
420162c79b
2 files changed
+23
-1
No files matched your search
@@ -2665,6 +2665,9 @@ def drift_score(
|
||||
# set again before any ref can be read, so each outranks a GONE ref:
|
||||
# pcem ranked last at 0 with an orphaned upstream_commit.
|
||||
score += PIN_WEIGHT * (len(report.orphaned) + len(report.moved_repos))
|
||||
# A profile no repository answers for cannot be read at all, and
|
||||
# --strict fails on it: it ranked at 0 under the clean profiles.
|
||||
score += PIN_WEIGHT * report.uncheckable()
|
||||
score += min(commits, 20) // 4
|
||||
return score
|
||||
|
||||
@@ -5034,7 +5037,7 @@ def _print_triage(
|
||||
state = triage_state(report)
|
||||
if refused:
|
||||
state += f", {refused}"
|
||||
pending += bool(report.needs_review())
|
||||
pending += bool(report.needs_review() or report.uncheckable())
|
||||
print(f"{score:5d} {report.name:30s} {state}")
|
||||
print(f"{len(ranked)} profiles, {pending} with something to review")
|
||||
|
||||
|
||||
@@ -6027,6 +6027,25 @@ class TheTriageCountsWhatBlocksThePin(unittest.TestCase):
|
||||
self.assertEqual(lines[-1], "2 profiles, 1 with something to review")
|
||||
self.assertEqual(len(err.getvalue().splitlines()), 1, err.getvalue())
|
||||
|
||||
def test_an_uncheckable_profile_ranks_first_and_counts(self):
|
||||
"""simple64 and teknoparrot answered 404 and --strict failed on them,
|
||||
while the triage put them at 0 under the clean profiles."""
|
||||
gone = ProfileReport(
|
||||
name="gone", pin="p", skipped="no declared repository answers (o/n)",
|
||||
)
|
||||
reports = [self._report("clean", 1), gone]
|
||||
selected = {r.name: {"source": "https://github.com/o/n"} for r in reports}
|
||||
args = argparse.Namespace(cache_dir="unused", offline=True)
|
||||
out = io.StringIO()
|
||||
with mock.patch.object(profile_sync, "check_version", return_value=None), \
|
||||
mock.patch.object(profile_sync.upstream, "commits_touching",
|
||||
return_value=0), \
|
||||
contextlib.redirect_stdout(out), contextlib.redirect_stderr(io.StringIO()):
|
||||
profile_sync._print_triage(args, selected, reports)
|
||||
lines = out.getvalue().splitlines()
|
||||
self.assertIn("gone", lines[1])
|
||||
self.assertEqual(lines[-1], "2 profiles, 1 with something to review")
|
||||
|
||||
|
||||
class TestBranchProfiles(unittest.TestCase):
|
||||
"""--changed and --added name the profiles a branch brings, not by hand."""
|
||||
|
||||
Reference in new issue
Block a user