Skip to content
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

Merged
merged 2 commits into from
Jul 12, 2021
Merged

Conversation

pomek
Copy link
Member

@pomek pomek commented Jul 12, 2021

Suggested merge commit message (convention)

Other (env): Set the proper exit code when found an error when collecting translations. Closes ckeditor/ckeditor5#10123.

@coveralls
Copy link

coveralls commented Jul 12, 2021

Coverage Status

Coverage increased (+0.02%) to 87.17% when pulling 03983fb on ck/10123 into 3f5fe79 on master.

@mlewand mlewand self-requested a review July 12, 2021 07:22
Copy link
Contributor

@mlewand mlewand left a 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 ) {
Copy link
Contributor

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;
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 03983fb.

Copy link
Contributor

@mlewand mlewand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good 👌

@mlewand mlewand merged commit 36d1190 into master Jul 12, 2021
@mlewand mlewand deleted the ck/10123 branch July 12, 2021 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"translations:collect" does not return the proper exit code in case of an error
3 participants