-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exit code when translations:collect
reports an error
#715
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The solution looks to be working just fine. I just have one question.
} | ||
} | ||
|
||
for ( const error of errors ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part is repeated in all three functions. Wouldn't it be better to do this logic outside of assert*
functions once?
Instead of
const foundErrors = [
assertNoMissingContext( { packageContexts, sourceMessages, logger } ),
assertAllContextUsed( { packageContexts, sourceMessages, logger } ),
assertNoRepeatedContext( { packageContexts, logger } )
].filter( errors => errors.length ).length > 0;
one could do:
const errors = [].concat(
assertNoMissingContext( { packageContexts, sourceMessages, logger } ),
assertAllContextUsed( { packageContexts, sourceMessages, logger } ),
assertNoRepeatedContext( { packageContexts, logger } )
);
// (...)
for ( const error of errors ) {
logger.error( error );
process.exitCode = 1;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 03983fb.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good 👌
Suggested merge commit message (convention)
Other (env): Set the proper exit code when found an error when collecting translations. Closes ckeditor/ckeditor5#10123.