Commit dbcc8c6
feat(#3529): move ThresholdConfig from MetricProvider to individual Metrics
Refactor the scorecard MetricProvider interface to move threshold
configuration from provider-level methods to individual Metric objects.
Core interface changes:
- Add `threshold: ThresholdConfig` field to the `Metric` type
- Remove `getMetricType()`, `getMetric()`, `getMetricThresholds()`,
`calculateMetric()`, and `getMetricIds()` from MetricProvider
- Make `getMetrics()` and `calculateMetrics()` required on MetricProvider
- Consolidate single/batch provider code paths into batch-only
Provider migrations:
- All providers (dependabot, filecheck, github, jira, openssf, sonarqube)
updated to the new interface with thresholds on metric objects
- ThresholdResolver API: `resolveProviderThresholds(provider)` →
`resolveMetricThresholds(metric, providerId)`
- ThresholdResolver API: `resolveEntityThresholds(entity, provider)` →
`resolveEntityThresholds(entity, metric, providerId)`
- mergeEntityAndProviderThresholds signature updated similarly
- PullMetricsByProviderTask consolidated to always use calculateMetrics()
- MetricProvidersRegistry uses provider.getMetrics() for all operations
All tests updated. API reports regenerated.
Note: DatabaseMetricValues tests could not run (missing better-sqlite3
native binding in sandbox). All other 91 test suites (976 tests) passed.
Closes #3529
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 0186e63 commit dbcc8c6
41 files changed
Lines changed: 643 additions & 880 deletions
File tree
- workspaces/scorecard/plugins
- scorecard-backend-module-dependabot/src/metricProviders
- scorecard-backend-module-filecheck/src/metricProviders
- scorecard-backend-module-github/src/metricProviders
- scorecard-backend-module-jira/src/metricProviders
- scorecard-backend-module-openssf/src/metricProviders
- scorecard-backend-module-sonarqube/src/metricProviders
- scorecard-backend
- __fixtures__
- src
- permissions
- providers
- scheduler/tasks
- service
- threshold
- utils
- scorecard-common
- src/types
- scorecard-node
- src/api
- scorecard
- dev
- src/hooks/__tests__
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 11 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
88 | 90 | | |
89 | 91 | | |
90 | 92 | | |
91 | 93 | | |
92 | 94 | | |
93 | 95 | | |
| 96 | + | |
94 | 97 | | |
95 | 98 | | |
96 | 99 | | |
97 | 100 | | |
98 | 101 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | 102 | | |
122 | 103 | | |
123 | 104 | | |
| |||
184 | 165 | | |
185 | 166 | | |
186 | 167 | | |
187 | | - | |
| 168 | + | |
188 | 169 | | |
189 | 170 | | |
190 | 171 | | |
| |||
196 | 177 | | |
197 | 178 | | |
198 | 179 | | |
199 | | - | |
| 180 | + | |
200 | 181 | | |
201 | | - | |
| 182 | + | |
202 | 183 | | |
203 | 184 | | |
204 | 185 | | |
| |||
219 | 200 | | |
220 | 201 | | |
221 | 202 | | |
222 | | - | |
| 203 | + | |
| 204 | + | |
223 | 205 | | |
224 | 206 | | |
225 | 207 | | |
| |||
230 | 212 | | |
231 | 213 | | |
232 | 214 | | |
233 | | - | |
| 215 | + | |
234 | 216 | | |
235 | 217 | | |
236 | 218 | | |
| |||
Lines changed: 16 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| 17 | + | |
21 | 18 | | |
22 | 19 | | |
23 | 20 | | |
| |||
63 | 60 | | |
64 | 61 | | |
65 | 62 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
| 63 | + | |
71 | 64 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
83 | 75 | | |
84 | 76 | | |
85 | 77 | | |
| |||
112 | 104 | | |
113 | 105 | | |
114 | 106 | | |
115 | | - | |
| 107 | + | |
116 | 108 | | |
117 | 109 | | |
118 | 110 | | |
119 | 111 | | |
120 | 112 | | |
121 | 113 | | |
122 | 114 | | |
123 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
124 | 118 | | |
125 | 119 | | |
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
Lines changed: 10 additions & 72 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
263 | 260 | | |
264 | 261 | | |
265 | 262 | | |
266 | 263 | | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
273 | 268 | | |
274 | 269 | | |
275 | 270 | | |
| |||
288 | 283 | | |
289 | 284 | | |
290 | 285 | | |
| 286 | + | |
291 | 287 | | |
292 | 288 | | |
293 | 289 | | |
294 | 290 | | |
295 | 291 | | |
296 | 292 | | |
297 | 293 | | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
| 294 | + | |
310 | 295 | | |
311 | 296 | | |
312 | 297 | | |
| |||
398 | 383 | | |
399 | 384 | | |
400 | 385 | | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | 386 | | |
449 | 387 | | |
450 | 388 | | |
| |||
Lines changed: 2 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 19 | + | |
23 | 20 | | |
24 | 21 | | |
25 | 22 | | |
| |||
44 | 41 | | |
45 | 42 | | |
46 | 43 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | 44 | | |
60 | 45 | | |
61 | 46 | | |
62 | 47 | | |
63 | 48 | | |
64 | 49 | | |
| 50 | + | |
65 | 51 | | |
66 | 52 | | |
67 | 53 | | |
68 | 54 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | 55 | | |
74 | 56 | | |
75 | 57 | | |
| |||
78 | 60 | | |
79 | 61 | | |
80 | 62 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | 63 | | |
88 | 64 | | |
89 | 65 | | |
| |||
Lines changed: 7 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | | - | |
37 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | | - | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
69 | | - | |
| 70 | + | |
70 | 71 | | |
71 | | - | |
| 72 | + | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| |||
0 commit comments