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

Modularize base.py for readability #90

Closed keyan closed 6 years ago

keyan commented 7 years ago

~This is downstream of https://github.com/facebook/codemod/pull/89~

Partially addresses https://github.com/facebook/codemod/issues/64. Though I think things can be much cleaner still, I didn't want to diverge too far without merging first.

The code is mostly the same, but individual classes have been moved into their own classes. Additionally, I created two "helper" modules that include general use functions. In order to avoid a circular dependency I removed the run_interactive method from the Query class and update the associated documentation.

keyan commented 6 years ago

@modocache any interest in this change? I'm happy to fix the merge conflicts if you plan on merging.

modocache commented 6 years ago

Yup, sorry! Please rebase and I'll merge, thanks.

keyan commented 6 years ago

@modocache no problem, I know this is a really hard one to review so I figured you might not have the bandwidth to accept it.

I rebased and fixed the conflicts with https://github.com/facebook/codemod/commit/08331ef6d60271e8c38aa70f9a5f300ef27f9457 and https://github.com/facebook/codemod/commit/162d2341668237e5e5b38ad4fb633daf0f47a6bb manually by applying those changes to the respective modules terminal_helper.py and query.py.

modocache commented 6 years ago

Sweet, thanks! It's great to have this split up, maybe we can start adding unit tests soon. Awesooome!