diff --git a/transforms/helpers/eo-prop/private/call-expression.ts b/transforms/helpers/eo-prop/private/call-expression.ts index 71b5577b..98b2f078 100644 --- a/transforms/helpers/eo-prop/private/call-expression.ts +++ b/transforms/helpers/eo-prop/private/call-expression.ts @@ -64,7 +64,7 @@ export default class EOCallExpressionProp extends AbstractEOProp { const logger = createLogger({ format: combine(timestamp(), logFormatter), - transports: [new transports.File({ filename: 'codemods.log' })], + // FIXME: Revert + transports: [ + new transports.File({ filename: 'codemods.log', level: 'error' }), + ], }); export default logger; diff --git a/transforms/helpers/transform.ts b/transforms/helpers/transform.ts index c1f166e3..0cdfdd73 100644 --- a/transforms/helpers/transform.ts +++ b/transforms/helpers/transform.ts @@ -30,13 +30,13 @@ export default function maybeTransformEmberObjects( userOptions: UserOptions ): boolean | undefined { if (isTestFile(filePath)) { - logger.warn(`[${filePath}]: Skipping test file`); + logger.warn(`[${filePath}]: SKIPPED: test file`); return; } if (userOptions.type && !isFileOfType(filePath, userOptions.type)) { logger.warn( - `[${filePath}]: FAILURE Type mismatch, expected type '${userOptions.type}' did not match type of file` + `[${filePath}]: SKIPPED: Type mismatch, expected type '${userOptions.type}' did not match type of file` ); return; } @@ -46,7 +46,7 @@ export default function maybeTransformEmberObjects( : getTelemetryFor(path.resolve(filePath)); if (!runtimeData || !isRuntimeData(runtimeData)) { logger.warn( - `[${filePath}]: SKIPPED Could not find runtime data NO_RUNTIME_DATA` + `[${filePath}]: SKIPPED: Could not find runtime data NO_RUNTIME_DATA` ); return; } @@ -123,7 +123,7 @@ function _maybeTransformEmberObjects( } if (errors.length > 0) { - logger.warn( + logger.error( `[${filePath}]: FAILURE \nValidation errors: \n\t${errors.join( '\n\t' )}` diff --git a/transforms/helpers/validation-helper.ts b/transforms/helpers/validation-helper.ts index ca18bfa3..e0b8b31e 100644 --- a/transforms/helpers/validation-helper.ts +++ b/transforms/helpers/validation-helper.ts @@ -80,19 +80,29 @@ export function hasValidProps( } if ( - (!decorators && - (instanceProp.hasDecorators || - instanceProp instanceof EOClassDecoratorProp)) || - unsupportedPropNames.includes(instanceProp.name) || - (instanceProp instanceof EOCallExpressionProp && - !instanceProp.hasDecorators) + !decorators && + (instanceProp.hasDecorators || + instanceProp instanceof EOClassDecoratorProp || + instanceProp instanceof EOCallExpressionProp) ) { errors.push( - `[${instanceProp.name}]: Transform not supported - need option '--decorators=true' or the property type ${instanceProp.type} can not be transformed` + `[${instanceProp.name}]: Transform not supported - need option '--decorators=true'` + ); + } + + if (unsupportedPropNames.includes(instanceProp.name)) { + errors.push( + `[${instanceProp.name}]: Transform not supported - property with name '${instanceProp.name}' and type ${instanceProp.type} can not be transformed` ); } if (instanceProp instanceof EOCallExpressionProp) { + if (!instanceProp.hasDecorators) { + errors.push( + `[${instanceProp.name}]: Transform not supported - call to '${instanceProp.calleeName}' can not be transformed` + ); + } + if (instanceProp.hasModifierWithArgs) { errors.push( `[${instanceProp.name}]: Transform not supported - value has modifiers like 'property' or 'meta'`