@@ -20,7 +20,7 @@ import {
20
20
POINTS_FOR_CATEGORIES ,
21
21
Rating ,
22
22
CATEGORY_NAMES ,
23
- RatingsContext ,
23
+ RatingsResult ,
24
24
} from './rating-types.js' ;
25
25
import { extractEmbeddedCodeFromTypeScript } from './embedded-languages.js' ;
26
26
import { Environment } from '../configuration/environment.js' ;
@@ -63,7 +63,7 @@ export async function rateGeneratedCode(
63
63
let categorizedFiles : CategorizedFiles | null = null ;
64
64
let totalPoints = 0 ;
65
65
let maxOverallPoints = 0 ;
66
- const ratingsContext : RatingsContext = { } ;
66
+ const ratingsResult : RatingsResult = { } ;
67
67
68
68
// Rating may also invoke LLMs. Track the usage.
69
69
const tokenUsage = {
@@ -98,14 +98,14 @@ export async function rateGeneratedCode(
98
98
repairAttempts ,
99
99
outputFiles . length ,
100
100
axeRepairAttempts ,
101
- ratingsContext
101
+ ratingsResult
102
102
) ;
103
103
} else if ( current . kind === RatingKind . PER_FILE ) {
104
104
categorizedFiles ??= splitFilesIntoCategories ( outputFiles ) ;
105
105
result = await runPerFileRating (
106
106
current ,
107
107
categorizedFiles ,
108
- ratingsContext
108
+ ratingsResult
109
109
) ;
110
110
} else if ( current . kind === RatingKind . LLM_BASED ) {
111
111
result = await runLlmBasedRating (
@@ -121,7 +121,7 @@ export async function rateGeneratedCode(
121
121
axeRepairAttempts ,
122
122
abortSignal ,
123
123
autoraterModel ,
124
- ratingsContext
124
+ ratingsResult
125
125
) ;
126
126
} else {
127
127
throw new UserFacingError ( `Unsupported rating type ${ current } ` ) ;
@@ -147,7 +147,7 @@ export async function rateGeneratedCode(
147
147
) ;
148
148
}
149
149
150
- ratingsContext [ current . id ] = result ;
150
+ ratingsResult [ current . id ] = result ;
151
151
category . assessments . push ( result ) ;
152
152
}
153
153
@@ -188,15 +188,15 @@ function runPerBuildRating(
188
188
repairAttempts : number ,
189
189
generatedFileCount : number ,
190
190
axeRepairAttempts : number ,
191
- ratingsContext : RatingsContext
191
+ ratingsResult : RatingsResult
192
192
) : IndividualAssessment | SkippedIndividualAssessment {
193
193
const rateResult = rating . rate ( {
194
194
buildResult,
195
195
serveResult,
196
196
repairAttempts,
197
197
generatedFileCount,
198
198
axeRepairAttempts,
199
- ratingsContext ,
199
+ ratingsResult ,
200
200
} ) ;
201
201
202
202
// If the rating was skipped (e.g., Axe test wasn't run), create a skipped assessment.
@@ -215,7 +215,7 @@ function runPerBuildRating(
215
215
async function runPerFileRating (
216
216
rating : PerFileRating ,
217
217
categorizedFiles : CategorizedFiles ,
218
- ratingsContext : RatingsContext
218
+ ratingsResult : RatingsResult
219
219
) : Promise < IndividualAssessment | SkippedIndividualAssessment > {
220
220
const errorMessages : string [ ] = [ ] ;
221
221
let contentType : PerFileRatingContentType ;
@@ -246,7 +246,7 @@ async function runPerFileRating(
246
246
// Remove comments from the code to avoid false-detection of bad patterns.
247
247
// Some keywords like `NgModule` can be used in code comments.
248
248
const code = removeComments ( file . code , contentType ) ;
249
- const result = await rating . rate ( code , file . filePath , ratingsContext ) ;
249
+ const result = await rating . rate ( code , file . filePath , ratingsResult ) ;
250
250
let coeff : number ;
251
251
252
252
if ( typeof result === 'number' ) {
@@ -292,7 +292,7 @@ async function runLlmBasedRating(
292
292
axeRepairAttempts : number ,
293
293
abortSignal : AbortSignal ,
294
294
autoraterModel : string ,
295
- ratingsContext : RatingsContext
295
+ ratingsResult : RatingsResult
296
296
) : Promise < IndividualAssessment | SkippedIndividualAssessment > {
297
297
const result = await rating . rate ( {
298
298
environment,
@@ -306,7 +306,7 @@ async function runLlmBasedRating(
306
306
repairAttempts,
307
307
axeRepairAttempts,
308
308
abortSignal,
309
- ratingsContext ,
309
+ ratingsResult ,
310
310
} ) ;
311
311
312
312
if ( result . state === RatingState . SKIPPED ) {
0 commit comments