Automate amqp code generation and add test to catch drift
Summary: Automate amqp code generation and add test to catch drift
This is a work in progress change to implement what was described here.
Relevant Issues: https://github.com/pixie-io/pixie/pull/1820#issuecomment-1905273586
Type of change: /kind cleanup
Test Plan: diff_file rules fail until linting issues are resolved
I think it's okay to skip linting for autogenerated files. Might be worth adding them to the exclusion list and calling this done.
I think if you reduce the tab/spaces in the returns for gen_method_enum_select_case, gen_method_enum_declr etc to the expected output, the generated code is probably mostly formatted as expected.
There's a lot of them though, so unsure if it's worth the trouble.
I was expecting the diff 'as is' to be pretty nasty, which is why I tried to keep the code formatting intact initially. I'll see how difficult it is to get the code generation to output relatively formatted code.
@vihangm my latest approach gets the files formatted with minor whitespace differences. It required quite a few changes to the amqp code generation file. The changes to amqp_code_gen.py could be cleaner, but I wanted to get a feel for how many lines needed to be touched to make the diff reasonable. It required enough whitespace changes that my preference would be to stick with the initial approach that formatted the output files according to our clang-format config.
Let me know what you think. I'm holding off on fixing the amqp_code_gen_test.py tests until we have consensus on this PR's direction.
Given that you have spent a bunch of time here, I trust your judgement. If you think running clang-format as part of the generation isn't too much trouble, that approach seems fine too. I was worried that running the linter would be more painful and hence suggested skipping lint/updating the code generation. :)
Sounds good :+1:. I've updated the branch based on the initial approach and it's ready for review now.