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.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extension groups?

modocache opened this issue · comments

Sometimes I want to modify all instances of a particular string in an Objective-C/Swift codebase. At Facebook, that means --extensions=h,m,mm,swift,BUCK,plist.

Typing those out is a pain--instead, it might be cool to have "extension groups", or aliases for a list of extensions. For example, if we defined a group called ios, these two would be equivalent:

--extensions=h,m,mm,swift,BUCK,DEFS,plist
--extensions=ios

Since ios means different things to different teams, maybe one should be able to register their own custom groups, instead of codemod making a decision as to what ios means for everyone.

Not sure if this is a good idea, as it might just be adding a complex feature without a great need to--thoughts? 🙌

Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.

I don't personally have a use for this feature, but I could see it being useful. Overall I think it's too much complexity for a niche use-case. Anyone else think this could be helpful?

To implement that we should add ~/.codemodrc file and

[extension_groups]
ios=h,m,mm,swift,BUCK,DEFS,plist

Not a good idea to hardcode the list