It’d be neat if generated code was run through for...
# general
a
It’d be neat if generated code was run through formatters (selectively?) for you. We’re currently running our codegen output through BlackRequest->FmtResult and while it works it’s pretty janky due to how the rule(s) are cached and output is controlled. But short of copying the rule, it’s doesn’t seem that easy to do it in a cache-friendly way.
b
Formatting codegen files isn't something the engine is prepped for, and I'm not sure how we'd accomplish that. Not to say we never will, but it'd take thought
a
Even if there was a reusable rule that could optionally be cached. So the fmt rule can use it like a verbose goal rule And the codegen rule can use it like a silent post-output step. How you would you encourage that, idk. But I’m probably in a niche use case.
b
So, if you don't mind me asking. Why do you want them formatted?
a
We generate our code using AST.unparse, and then upload our code to a “lambda-like” environment. And it’s just impossible to read, navigate and debug without it. And our yaml->python outputted code is also used as a reference a fair bit.
But maybe I’m not that much of an edge case? Reading and debugging badly formatted code is the worst, it doesn’t matter if it comes from codegen or a developer.
b
File an issue, I'll think about it (the solution)
👍 1
❤️ 1