@@ -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' ;
@@ -61,7 +61,7 @@ export async function rateGeneratedCode(
6161 let categorizedFiles : CategorizedFiles | null = null ;
6262 let totalPoints = 0 ;
6363 let maxOverallPoints = 0 ;
64- const ratingsContext : RatingsContext = { } ;
64+ const ratingsResult : RatingsResult = { } ;
6565
6666 // Rating may also invoke LLMs. Track the usage.
6767 const tokenUsage = {
@@ -95,14 +95,14 @@ export async function rateGeneratedCode(
9595 repairAttempts ,
9696 outputFiles . length ,
9797 axeRepairAttempts ,
98- ratingsContext
98+ ratingsResult
9999 ) ;
100100 } else if ( current . kind === RatingKind . PER_FILE ) {
101101 categorizedFiles ??= splitFilesIntoCategories ( outputFiles ) ;
102102 result = await runPerFileRating (
103103 current ,
104104 categorizedFiles ,
105- ratingsContext
105+ ratingsResult
106106 ) ;
107107 } else if ( current . kind === RatingKind . LLM_BASED ) {
108108 result = await runLlmBasedRating (
@@ -117,7 +117,7 @@ export async function rateGeneratedCode(
117117 axeRepairAttempts ,
118118 abortSignal ,
119119 autoraterModel ,
120- ratingsContext
120+ ratingsResult
121121 ) ;
122122 } else {
123123 throw new UserFacingError ( `Unsupported rating type ${ current } ` ) ;
@@ -143,7 +143,7 @@ export async function rateGeneratedCode(
143143 ) ;
144144 }
145145
146- ratingsContext [ current . id ] = result ;
146+ ratingsResult [ current . id ] = result ;
147147 category . assessments . push ( result ) ;
148148 }
149149
@@ -183,14 +183,14 @@ function runPerBuildRating(
183183 repairAttempts : number ,
184184 generatedFileCount : number ,
185185 axeRepairAttempts : number ,
186- ratingsContext : RatingsContext
186+ ratingsResult : RatingsResult
187187) : IndividualAssessment | SkippedIndividualAssessment {
188188 const rateResult = rating . rate ( {
189189 buildResult,
190190 repairAttempts,
191191 generatedFileCount,
192192 axeRepairAttempts,
193- ratingsContext ,
193+ ratingsResult ,
194194 } ) ;
195195
196196 // If the rating was skipped (e.g., Axe test wasn't run), create a skipped assessment.
@@ -209,7 +209,7 @@ function runPerBuildRating(
209209async function runPerFileRating (
210210 rating : PerFileRating ,
211211 categorizedFiles : CategorizedFiles ,
212- ratingsContext : RatingsContext
212+ ratingsResult : RatingsResult
213213) : Promise < IndividualAssessment | SkippedIndividualAssessment > {
214214 const errorMessages : string [ ] = [ ] ;
215215 let contentType : PerFileRatingContentType ;
@@ -240,7 +240,7 @@ async function runPerFileRating(
240240 // Remove comments from the code to avoid false-detection of bad patterns.
241241 // Some keywords like `NgModule` can be used in code comments.
242242 const code = removeComments ( file . code , contentType ) ;
243- const result = await rating . rate ( code , file . filePath , ratingsContext ) ;
243+ const result = await rating . rate ( code , file . filePath , ratingsResult ) ;
244244 let coeff : number ;
245245
246246 if ( typeof result === 'number' ) {
@@ -285,7 +285,7 @@ async function runLlmBasedRating(
285285 axeRepairAttempts : number ,
286286 abortSignal : AbortSignal ,
287287 autoraterModel : string ,
288- ratingsContext : RatingsContext
288+ ratingsResult : RatingsResult
289289) : Promise < IndividualAssessment | SkippedIndividualAssessment > {
290290 const result = await rating . rate ( {
291291 environment,
@@ -298,7 +298,7 @@ async function runLlmBasedRating(
298298 repairAttempts,
299299 axeRepairAttempts,
300300 abortSignal,
301- ratingsContext ,
301+ ratingsResult ,
302302 } ) ;
303303
304304 if ( result . state === RatingState . SKIPPED ) {
0 commit comments