1
- import { AnnotationStore } from '../../annotations/versioning/AnnotationStoreV2' ;
1
+ import { Annotation , AnnotationStore , ReviewResult } from '../../annotations/versioning/AnnotationStoreV2' ;
2
2
import { PythonClass } from '../../packageData/model/PythonClass' ;
3
3
import { PythonFunction } from '../../packageData/model/PythonFunction' ;
4
4
import { PythonModule } from '../../packageData/model/PythonModule' ;
@@ -171,7 +171,7 @@ export class AnnotatedPythonPackageBuilder {
171
171
switch ( annotationType ) {
172
172
case 'Boundary' :
173
173
const boundaryAnnotation = this . annotationStore . boundaryAnnotations [ target ] ;
174
- if ( boundaryAnnotation && ! boundaryAnnotation . isRemoved ) {
174
+ if ( annotationShouldBeProcessed ( boundaryAnnotation ) ) {
175
175
return new InferableBoundaryAnnotation ( boundaryAnnotation ) ;
176
176
}
177
177
break ;
@@ -181,17 +181,17 @@ export class AnnotatedPythonPackageBuilder {
181
181
break ;
182
182
}
183
183
return Object . values ( calledAfterAnnotations )
184
- . filter ( ( it ) => ! it . isRemoved )
184
+ . filter ( annotationShouldBeProcessed )
185
185
. map ( ( calledAfterAnnotation ) => new InferableCalledAfterAnnotation ( calledAfterAnnotation ) ) ;
186
186
case 'Constant' :
187
187
const valueAnnotation1 = this . annotationStore . valueAnnotations [ target ] ;
188
- if ( valueAnnotation1 && ! valueAnnotation1 . isRemoved && valueAnnotation1 . variant === 'constant' ) {
188
+ if ( annotationShouldBeProcessed ( valueAnnotation1 ) && valueAnnotation1 . variant === 'constant' ) {
189
189
return new InferableConstantAnnotation ( valueAnnotation1 ) ;
190
190
}
191
191
break ;
192
192
case 'Description' :
193
193
const descriptionAnnotation = this . annotationStore . descriptionAnnotations [ target ] ;
194
- if ( descriptionAnnotation && ! descriptionAnnotation . isRemoved ) {
194
+ if ( annotationShouldBeProcessed ( descriptionAnnotation ) ) {
195
195
return new InferableDescriptionAnnotation ( descriptionAnnotation ) ;
196
196
}
197
197
break ;
@@ -201,57 +201,61 @@ export class AnnotatedPythonPackageBuilder {
201
201
break ;
202
202
}
203
203
return Object . values ( groupAnnotations )
204
- . filter ( ( it ) => ! it . isRemoved )
204
+ . filter ( annotationShouldBeProcessed )
205
205
. map ( ( groupAnnotation ) => new InferableGroupAnnotation ( groupAnnotation ) ) ;
206
206
case 'Enum' :
207
207
const enumAnnotation = this . annotationStore . enumAnnotations [ target ] ;
208
- if ( enumAnnotation && ! enumAnnotation . isRemoved ) {
208
+ if ( annotationShouldBeProcessed ( enumAnnotation ) ) {
209
209
return new InferableEnumAnnotation ( enumAnnotation ) ;
210
210
}
211
211
break ;
212
212
case 'Move' :
213
213
const moveAnnotation = this . annotationStore . moveAnnotations [ target ] ;
214
- if ( moveAnnotation && ! moveAnnotation . isRemoved ) {
214
+ if ( annotationShouldBeProcessed ( moveAnnotation ) ) {
215
215
return new InferableMoveAnnotation ( moveAnnotation ) ;
216
216
}
217
217
break ;
218
218
case 'Optional' :
219
219
const valueAnnotation2 = this . annotationStore . valueAnnotations [ target ] ;
220
- if ( valueAnnotation2 && ! valueAnnotation2 . isRemoved && valueAnnotation2 . variant === 'optional' ) {
220
+ if ( annotationShouldBeProcessed ( valueAnnotation2 ) && valueAnnotation2 . variant === 'optional' ) {
221
221
return new InferableOptionalAnnotation ( valueAnnotation2 ) ;
222
222
}
223
223
break ;
224
224
case 'Pure' :
225
225
const pureAnnotation = this . annotationStore . pureAnnotations [ target ] ;
226
- if ( pureAnnotation && ! pureAnnotation . isRemoved ) {
226
+ if ( annotationShouldBeProcessed ( pureAnnotation ) ) {
227
227
return new InferablePureAnnotation ( ) ;
228
228
}
229
229
break ;
230
230
case 'Remove' :
231
231
const removeAnnotation = this . annotationStore . removeAnnotations [ target ] ;
232
- if ( removeAnnotation && ! removeAnnotation . isRemoved ) {
232
+ if ( annotationShouldBeProcessed ( removeAnnotation ) ) {
233
233
return new InferableRemoveAnnotation ( ) ;
234
234
}
235
235
break ;
236
236
case 'Rename' :
237
237
const renameAnnotation = this . annotationStore . renameAnnotations [ target ] ;
238
- if ( renameAnnotation && ! renameAnnotation . isRemoved ) {
238
+ if ( annotationShouldBeProcessed ( renameAnnotation ) ) {
239
239
return new InferableRenameAnnotation ( renameAnnotation ) ;
240
240
}
241
241
break ;
242
242
case 'Required' :
243
243
const valueAnnotation3 = this . annotationStore . valueAnnotations [ target ] ;
244
- if ( valueAnnotation3 && ! valueAnnotation3 . isRemoved && valueAnnotation3 . variant === 'required' ) {
244
+ if ( annotationShouldBeProcessed ( valueAnnotation3 ) && valueAnnotation3 . variant === 'required' ) {
245
245
return new InferableRequiredAnnotation ( ) ;
246
246
}
247
247
break ;
248
248
case 'Todo' :
249
249
const todoAnnotation = this . annotationStore . todoAnnotations [ target ] ;
250
- if ( todoAnnotation && ! todoAnnotation . isRemoved ) {
250
+ if ( annotationShouldBeProcessed ( todoAnnotation ) ) {
251
251
return new InferableTodoAnnotation ( todoAnnotation ) ;
252
252
}
253
253
break ;
254
254
}
255
255
return undefined ;
256
256
}
257
257
}
258
+
259
+ const annotationShouldBeProcessed = function ( annotation : Annotation ) : boolean {
260
+ return annotation && ! annotation . isRemoved && annotation . reviewResult === ReviewResult . Wrong ;
261
+ } ;
0 commit comments