Skip to content

FunctionNaming should ignore anonymous functions #3054

Closed
@3flex

Description

@3flex

Expected Behavior of the rule

This example, from the Kotlin docs, is not flagged by FunctionNaming rule at fun(value: Int):

        fun foo() {
            listOf(1, 2, 3, 4, 5).forEach(fun(value: Int) {
                if (value == 3) return  // local return to the caller of the anonymous fun, i.e. the forEach loop
                print(value)
            })
            print(" done with anonymous function")
        }

Context

Anonymous functions by definition do not have a name.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions