Skip to content

CC0114 convert assignment to function name to return statement #737

@kwhitefoot

Description

@kwhitefoot

New analyzer:

VB only: convert assignment to function name to return statement.

Before:

Public function f(s As String) As Integer
    f = s.Count()
End Function

After:

Public function f(s As String) As Integer
    Return s.Count()
End Function

The purpose is to avoid the risk of mistyping the function name and accidentally assigning the value to some unrelated field or property.

Diagnostic Id: CC0114
Category: Style
Severity: Info

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions