PSA: If you write a tool that auto-generates code based on other data, make sure it adds not only a comment at the top that states "THIS FILE WAS AUTO-GENERATED, DO NOT EDIT!", but also what files it was generated from, so people know what to edit instead.

Bonus points if the comment mentions what script generated the files, so people know what to change if the output is bad, but the other two bits of information are more important.

Follow

@uliwitness
Extra bonus points for including what version of said tool generated the files.

That and needing coworkers to actually not edit the generated files to the point that we can't use the auto generation anymore because it'll break everything

@brokenintuition My issue with including things like version (and worse, date and time) is that it leads to files showing up as modified to version control. Since it's easier to get a reproducible build if you can check in the generated files, I generally wouldn't want such changeable info in generated files.

@brokenintuition Oh, and regarding editing generated files: I usually solve that by integrating the generator into the build process, so any changes made get insta-overwritten whenever they build the app. That usually gives anyone ignoring the comment/docs and editing nonetheless painfully of the "proper way" to do things.

Sign in to participate in the conversation
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!