Hacker News new | past | comments | ask | show | jobs | submit login

Committed generated code can also be a pain. Now you invite manual changes to the generated code, which is probably a pain to maintain if you also want to maintain and reuse the generation script in parallel.



No, committed generated code does not invite manual changes. This should obviously be prevented and part of your standard software development process and guidelines. That's why autogenerated source files usually have a big warning in their headers, and you would kill any manual changes in code review with a telling off of the dev, anyway. Very simple to enforce and maintain.

At least you have the whole compiled code base under source control, you can guarantee that you have access to the exact source files used for previous builds, and debugging is generally easier. You have the generated code subject to your normal code review process and everyone can easily inspect it. You also have a separation of concerns and source files, embedding Python scripts into your, say, C files is conplexifying everything for little, if any, benefits.


You can use the "cog --check" command in CI to prevent this from happening.

On every commit, your tests can rerun the code generator and confirm that it makes no changes to the code. If it does, the tests fail.

That way if anyone manually edits generated code (which they should not be doing) it will be caught by CI.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: