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

Add a flag to make jscodeshift return a 1 code when errors were found #416

Merged
merged 7 commits into from Jun 23, 2021

Conversation

marcodejongh
Copy link
Contributor

Fixes #194

@facebook-github-bot
Copy link

Hi @marcodejongh!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@marcodejongh
Copy link
Contributor Author

@gkz or @fkling Any chance we could get this merged?

@@ -298,6 +298,10 @@ function run(transformFile, paths, options) {
process.stdout.write(
'Time elapsed: ' + timeElapsed + 'seconds \n'
);

if (options.failOnError && fileCounters.error > 0) {
process.exit(1);
Copy link
Member

Choose a reason for hiding this comment

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

This should probably go below the temp.cleanupSync call at least?

Is it possible to put the process.exit(1) call in bin/jscodeshift.js rather than in this file? I suspect this file is supposed to be reusable as a library and thus shouldn't be handling the exit here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point on moving the process.exit(1), it also didn't really belong in the if (!options.silent) { statement.

On moving this to the bin, I think it makes sense to have it in this file since Runner.js already does many process stuff (see also the process.stdout). If you want to use this file in other JS code, the user can not pass in the failOnError flag.

But it looks like it passes back the stats to bin/jscodeshift, so it's easy to move there as well, it was just that bin/jscodeshift seemed like just the cli wrapper

@marcodejongh
Copy link
Contributor Author

@Daniel15 Any chance this could get another review? I'd love to be able to move us off of our fork of this library

@Daniel15
Copy link
Member

@marcodejongh Sorry for the delay! I'll take a look at this tomorrow morning :)

@Daniel15
Copy link
Member

Looks good. Thanks!

@Daniel15 Daniel15 merged commit f6ec09f into facebook:master Jun 23, 2021
@RajaBellebon
Copy link

Hello @Daniel15 , thanks for accepting this pull-request! Do we have an approx idea of when the new version will be released?

Thank you!

@Daniel15
Copy link
Member

I'll try to push a new release tomorrow :)

@Daniel15
Copy link
Member

Sorry for the delay. Published this as 0.13.0. Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Exit code always 0
4 participants