@@ -20,7 +20,7 @@ import {
2020 POINTS_FOR_CATEGORIES ,
2121 Rating ,
2222 CATEGORY_NAMES ,
23- RatingsContext ,
23+ RatingsResult ,
2424} from './rating-types.js' ;
2525import { extractEmbeddedCodeFromTypeScript } from './embedded-languages.js' ;
2626import { Environment } from '../configuration/environment.js' ;
@@ -63,7 +63,7 @@ export async function rateGeneratedCode(
6363 let categorizedFiles : CategorizedFiles | null = null ;
6464 let totalPoints = 0 ;
6565 let maxOverallPoints = 0 ;
66- const ratingsContext : RatingsContext = { } ;
66+ const ratingsResult : RatingsResult = { } ;
6767
6868 // Rating may also invoke LLMs. Track the usage.
6969 const tokenUsage = {
@@ -98,14 +98,14 @@ export async function rateGeneratedCode(
9898 repairAttempts ,
9999 outputFiles . length ,
100100 axeRepairAttempts ,
101- ratingsContext
101+ ratingsResult
102102 ) ;
103103 } else if ( current . kind === RatingKind . PER_FILE ) {
104104 categorizedFiles ??= splitFilesIntoCategories ( outputFiles ) ;
105105 result = await runPerFileRating (
106106 current ,
107107 categorizedFiles ,
108- ratingsContext
108+ ratingsResult
109109 ) ;
110110 } else if ( current . kind === RatingKind . LLM_BASED ) {
111111 result = await runLlmBasedRating (
@@ -121,7 +121,7 @@ export async function rateGeneratedCode(
121121 axeRepairAttempts ,
122122 abortSignal ,
123123 autoraterModel ,
124- ratingsContext
124+ ratingsResult
125125 ) ;
126126 } else {
127127 throw new UserFacingError ( `Unsupported rating type ${ current } ` ) ;
@@ -147,7 +147,7 @@ export async function rateGeneratedCode(
147147 ) ;
148148 }
149149
150- ratingsContext [ current . id ] = result ;
150+ ratingsResult [ current . id ] = result ;
151151 category . assessments . push ( result ) ;
152152 }
153153
@@ -188,15 +188,15 @@ function runPerBuildRating(
188188 repairAttempts : number ,
189189 generatedFileCount : number ,
190190 axeRepairAttempts : number ,
191- ratingsContext : RatingsContext
191+ ratingsResult : RatingsResult
192192) : IndividualAssessment | SkippedIndividualAssessment {
193193 const rateResult = rating . rate ( {
194194 buildResult,
195195 serveResult,
196196 repairAttempts,
197197 generatedFileCount,
198198 axeRepairAttempts,
199- ratingsContext ,
199+ ratingsResult ,
200200 } ) ;
201201
202202 // If the rating was skipped (e.g., Axe test wasn't run), create a skipped assessment.
@@ -215,7 +215,7 @@ function runPerBuildRating(
215215async function runPerFileRating (
216216 rating : PerFileRating ,
217217 categorizedFiles : CategorizedFiles ,
218- ratingsContext : RatingsContext
218+ ratingsResult : RatingsResult
219219) : Promise < IndividualAssessment | SkippedIndividualAssessment > {
220220 const errorMessages : string [ ] = [ ] ;
221221 let contentType : PerFileRatingContentType ;
@@ -246,7 +246,7 @@ async function runPerFileRating(
246246 // Remove comments from the code to avoid false-detection of bad patterns.
247247 // Some keywords like `NgModule` can be used in code comments.
248248 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 ) ;
250250 let coeff : number ;
251251
252252 if ( typeof result === 'number' ) {
@@ -292,7 +292,7 @@ async function runLlmBasedRating(
292292 axeRepairAttempts : number ,
293293 abortSignal : AbortSignal ,
294294 autoraterModel : string ,
295- ratingsContext : RatingsContext
295+ ratingsResult : RatingsResult
296296) : Promise < IndividualAssessment | SkippedIndividualAssessment > {
297297 const result = await rating . rate ( {
298298 environment,
@@ -306,7 +306,7 @@ async function runLlmBasedRating(
306306 repairAttempts,
307307 axeRepairAttempts,
308308 abortSignal,
309- ratingsContext ,
309+ ratingsResult ,
310310 } ) ;
311311
312312 if ( result . state === RatingState . SKIPPED ) {
0 commit comments