Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add experimental rule to lint/format the spacing after the type parameter list in a function signature #1366

Merged

Conversation

paul-dingemans
Copy link
Collaborator

@paul-dingemans paul-dingemans commented Feb 9, 2022

Description

Add experimental rule to lint/format the spacing after the type parameter list in a function signature.

It fixes code like below:

            // Too many spaces
            fun <T>  foo(t: T) = "some-result"

            // Missing space
            fun <T>foo(t: T) = "some-result"
     
            // Unexpected newlinw
            class Bar<T>
            {
                val bar: T? = null
            }
            class Foo1<Bar>
                constructor() {}
            class Foo2<Bar>
                actual constructor() {}

            // Unexpected space between parameter list and constructor
            class Bar <T> (val t: T)

This rule is required to create a rule which can rewrite the function signature automatically as is described in #1341

Checklist

  • tests are added
  • CHANGELOG.md is updated

Paul Dingemans and others added 6 commits February 9, 2022 20:11
…eter list in a function signature

This rule is required to create a rule which can rewrite the function signature automatically as is described in pinterest#1341
…en not used as operator

Move logic to the TypeParameterListSpacingRule and new rule TypeArgumentListSpacingRule
@paul-dingemans paul-dingemans merged commit 57e0cbe into pinterest:master Mar 13, 2022
@paul-dingemans paul-dingemans deleted the 1341-parameter-type-list branch March 13, 2022 11:21
@paul-dingemans paul-dingemans added this to the 0.45.0 milestone Mar 13, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant