Evan Conrad

06/15/2023, 10:20 PM
with encouragement from @Joe Grossberg, down to share what I’m doing… I make, a little CLI for having a language model do your code review. You write rules in plain text, and then it checks them against your code, like a test framework. Here’s an example rule that runs on SQL migrations:
Copy code
include: ["migrations/*.sql"]

Make sure our postgres migrations follow these rules:

1. ensure new tables are at least 3NF (third normal form). If they're not, fail and give an example of what's wrong, assuming the reader does not know terms like "BNCF", "3NF", "BCNF", and so on.
2. make sure that all tables have a created_at and updated_at
3. make sure migrations don't have breaking changes. For example, removing a table, removing column, and so on.
   3.1 It's okay to have a breaking change if there's a comment on the migration that explains why it's safe to have that change.
4. prefer 'uuid' over 'serial' or 'int' for primary keys. Ignore this check if it's primary key made up of two columns.

Jason Morris

06/16/2023, 7:20 PM
That's pretty cool. Are you generating a symbolic representation of the rule in the background? (Generating symbolic representations of natural language rules is my day job.)