facebook / facebook/jscodeshift

Add a way to provide reason for skipping

Open
#115 4 comments 10 reactions 0 assignees View on GitHub
improvement
Dominant language
JavaScript
Stars
10k
Forks
498
PR merge metrics
No merged PRs in 30d

Description

I’m writing my first codemod and I noticed it’s very hard to determine whether certain edge cases are worth handling. Currently I see an output like this:

```
168 errors
0 unmodified
61720 skipped
858 ok
```

However “61720 skipped” is not very informative. I have 15 different places where I return early based on some condition. Handling these cases could introduce more complexity to the codemod **but I want to know when it would be worth it**. For example, an output like this would be way more helpful:

```
168 errors
0 unmodified
50042 skipped (reason: does not import a mixin)
8243 skipped (reason: contains a dangerous call)
2192 skipped (no reason given)
858 ok
```

This would give me a much better understanding of where to spend the effort making the codemod smarter. In terms of API, it could look like:

``` js
if (something) {
return j.skip('does not import a mixin');
}

if (somethingElse) {
return j.skip('contains a dangerous call');
}

if (blabla) {
return;
}
```

Would you be interested in considering this feature request?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.