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

Use re.MULTILINE instead of re.DOTALL #80

Closed snickl closed 7 years ago

snickl commented 8 years ago

Not sure which use cases this change breaks, but I found I need the other mode to also catch trailing newlines when removing rcsids from old C code with this invocation: codemod -m '^.+?RCSID.+?$\n*'

Or maybe we could add a command line option to choose the multiple line mode?

modocache commented 8 years ago

Thanks! A command-line option (with the current behavior as the default) sounds like it might be best.

snickl commented 7 years ago

Hey there! I found that it is more complicated, MULTILINE and DOTALL do different things and can even be combined. Plus there is a comment in the code that says that the multiline suggestor is "hacky and should be rewritten". I can only imagine it to be quite tricky, given the lack of a simple notion what a chunk is. Not sure if you could run this by the original author, at the moment I have no good idea how to do this cleanly and will therefore close this PR for the time being.

modocache commented 7 years ago

OK, that sounds reasonable. Thanks!