CodemodFacebook 代碼分析工具
Codemod 是一個(gè)工具/庫(kù),它可以幫你處理那些只有部分自動(dòng)化功能,部分場(chǎng)合還需人工干預(yù)的大規(guī)模代碼庫(kù)。
示例代碼:
-m Have regex work over multiple lines (e.g. have dot match newlines). By default, codemod applies the regex one line at a time. -d The path whose ancestor files are to be explored. Defaults to current dir. --start A path:line_number-formatted position somewhere in the hierarchy from which to being exploring, or a percentage (e.g. "--start 25%") of the way through to start. Useful if you're divvying up the substitution task across multiple people. --end A path:line_number-formatted position somewhere in the hierarchy just *before* which we should stop exploring, or a percentage of the way through, just before which to end. --extensions A comma-delimited list of file extensions to process. --include-extensionless If set, this will check files without an extension, along with any matching file extensions passed in --extensions --accept-all Automatically accept all changes (use with caution) --editor Specify an editor, e.g. "vim" or "emacs". If omitted, defaults to $EDITOR environment variable. --count Don't run normally. Instead, just print out number of times places in the codebase where the 'query' matches. --test Don't run normally. Instead, just run the unit tests embedded in the codemod library.
評(píng)論
圖片
表情
