Open Limero opened 6 months ago
Thanks for filing this issue. I can see how you might want consistency when empty lines are used between some t.Run calls and not others, but I honestly don't think either approach (all use empty lines in between, versus none use empty lines in between) is clearly the canonical formatting that everyone should use.
For example, https://github.com/cue-labs/oci/blob/14751940d5b22f24e01c024cc61a3138565f8c7e/ociregistry/internal/conformance/conformance_test.go#L131-L139 seems perfectly fine to me, as does https://github.com/go-json-experiment/json/blob/2e55bd4e08b08427ba10066e9617338e1f113c53/jsontext/coder_test.go#L704-L753, which also seems to group subtest functions based on the categories.
All in all, I don't think we can enforce anything like this in general.
At work we often use
t.Run()
inside of test cases to separate parts of it, but there is no consistency to the line breaks separating these, so our tests often end up looking like this:It would be useful if
gofumpt
enforced the linebreaks between multiline function calls withfunc()
as argument.When a function is passed as an argument, it basically becomes a wrapper around a stand-alone function, so rules similar to the existing "Multiline top-level declarations must be separated by empty lines" rule should be applied.
Expected result: