Skip to content

Commit bd33382

Browse files
committed
Refactor update_scorecard
Signed-off-by: Matthias Büchse <matthias.buechse@alasca.cloud>
1 parent ececb8c commit bd33382

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Tests/cli.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ def select(specpath, version, sections, tests):
7979

8080

8181
def _update_scorecard(scorecard, report, testcase_lookup):
82+
subject = report['subject']
83+
scopeuuid = report['scope']
84+
if subject != scorecard.setdefault('subject', subject):
85+
raise RuntimeError('subjects do not match')
86+
if scopeuuid != scorecard.setdefault('scope', scopeuuid):
87+
raise RuntimeError('scopes do not match')
8288
scores = scorecard.setdefault('tests', {})
8389
checked_at = report['checked_at']
8490
checked_at_str = str(checked_at)[:19]
@@ -150,12 +156,6 @@ def score(specpath, subject, score_yaml, report_yaml):
150156
report_yaml = f'report-{ts}-{subject}.yaml'
151157
_atomic_write(report_yaml, _dump(report))
152158
if score_yaml:
153-
scorecard.setdefault('subject', subject)
154-
scorecard.setdefault('scope', scopeuuid)
155-
if subject != scorecard['subject']:
156-
raise RuntimeError('subjects do not match')
157-
if scopeuuid != scorecard['scope']:
158-
raise RuntimeError('scopes do not match')
159159
_prune_scorecard(scorecard)
160160
_update_scorecard(scorecard, report, spec['testcases'])
161161
_atomic_write(score_yaml, _dump(scorecard))

0 commit comments

Comments
 (0)