facebookarchive / codemod

Codemod is a tool/library to assist you with large-scale codebase refactors that can be partially automated but still require human oversight and occasional intervention. Codemod was developed at Facebook and released as open source.
Apache License 2.0
4.11k stars 198 forks source link

[feature request] Upon exiting, print out a list of modified and non-modified files #87

Open rattrayalex-stripe opened 7 years ago

rattrayalex-stripe commented 7 years ago

It would be helpful to be able to quickly review the paths of the files which had changed and which had been ignored.

modocache commented 7 years ago

I agree! I wonder whether this might be difficult with many thousands of modified files, though.

rattrayalex-stripe commented 7 years ago

Difficult or annoying? 😉

Perhaps display "... and 1337 others" when n > 100 ?

Though if you're using codemod to go line-by-line through thousands of files... you might appreciate this even more / it's a small price to pay?

keyan commented 7 years ago

This seems helpful. I have a pretty clear idea of how to handle this cleanly. I'll open my PR once https://github.com/facebook/codemod/pull/90 is merged.

I am imagining:

<run codemod>
"Would you like to see a list of modified (and ignored files)?"
"y = yes, n = no, m = modified only"
<newline separated list, uses the `n > 100` rule Alex mentioned>
rattrayalex-stripe commented 7 years ago

"y = yes, n = no, m = modified only" maybe could be "y = yes, n = no, m = modified only, c = clipboard" where clipboard copies the entire (including n > 100) to the clipboard. I'd rather put it into a file but can't think of a good way for this to happen easily.

I am imagining the list will sometimes go into a changelog file, github comment, slack channel message, or similar.

It could also be good to instead have "y = yes, n = no, m = modified only", i = ignored only since it is easy to infer the modified files from the commit, but it is not possible to infer the ignored files. They are likely to be a smaller list, and may be valuable to include in a commit message or similar.

Just 2c, take with a grain of salt – I haven't actually used codemod much myself 😄