bicep
bicep copied to clipboard
linter rule to check for decompile fluff
Decompile will create vars/params/resources with an "appendix" on the name if they are ambiguous. So you can end up with things like accountName_var
or virtualNetwork_resource
which are a bit inelegant in bicep. Would be nice to lint these as a reminder to clean up decompiled code to make it more bicep like.
if we think we can do this programmatically, I'd love to see if we can add it to the decompiler itself. Would still be good to have it in the linter too to catch any existing fluff.
I think it's easy to "catch" a bit harder to "autofix" - which I think is how we ended up with the design in the first place... But yeah, even better ;)
I like this. When I was converting our internal templates, I had to manually look for these and probably missed some.
I think it's easy to "catch" a bit harder to "autofix" - which I think is how we ended up with the design in the first place... But yeah, even better ;)
+1, I like the suggestion. If added as a linter, then the decompiler could also flag these immediately as warnings in the output after running.
What we have today technically is autofixing (appending fluff to add uniqueness); it's hard to see how we could do a better job generating names (well, perhaps barring some advanced AI solution) without involving some user interactivity ("these identifiers are conflicting, would you like to rename one of them?"). At the time, I felt that there was no need for this, because editor-based refactoring should be just as straightforward.
We could decompile to hungarian notation ;)
I vote for the Hungarian!
The goal is to make this not necessary, and instead do a better job in the decompiler. But it is possible we might not completely resolve it, so I guess I need to leave this here for now.