Prerequisites
Your environment needs to have:Running a Codemod
From the backend directory:Example
Available Codemods
Codemods are located inbackend/codemod/. Each codemod is a Python module with a command class that extends LibCST’s VisitorBasedCodemodCommand.
Writing a New Codemod
- Create a new file in
backend/codemod/ - Define a codemod class:
- Run your codemod:
Best Practices
- Always test codemods on a small subset of files first
- Review the changes before committing
- Run the test suite after applying codemods
- Consider adding unit tests for complex codemods