Skip to content

feature: Enforce line breaks between multiline function calls with func() argument #290

@Limero

Description

@Limero

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:

t.Run("a", func(t *testing.T) {
	//
})
t.Run("b", func(t *testing.T) {
	//
})

t.Run("c", func(t *testing.T) {
	//
})

It would be useful if gofumpt enforced the linebreaks between multiline function calls with func() 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:

t.Run("a", func(t *testing.T) {
	//
})

t.Run("b", func(t *testing.T) {
	//
})

t.Run("c", func(t *testing.T) {
	//
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions