"Which line was that again? Oh... "
Pics up the phone, dials.
"Honey, I won't be home in time for dinner."
0. Code generators are to be used hand-in-hand with the coding process.
1. Code generation must happen pre-build, using tooling supplied or documented thoroughly in the project repo.
2. Code generator code and its most recently generated output are checked in alongside the rest of the project.
3. "No humans allowed" inside generated code areas/files.
4. Direct and intermediate output (if applicable) from code generators must be human readable. Proper code formatting is strongly advised.
5. This does not apply to lightweight templates, generics, and other first-class language features. It _does_ apply to DSL implementations and heavyweight template designs that are not already provided by a 3rd party library. Even then, please consider the above path instead.
The above, while restrictive, flattens the project ecosystem down to human-readable and fungible parts. If the worst happens, generated code can still be hotfixed/hacked back into service, without having to fuss with generator internals.
Everyone knows that debugging is twice as hard as writing a program in the first place. So if you’re as clever as you can be when you write it, how will you ever debug it?