8000 GitHub - ssgreg/nlreturn: Checks for a new line before return and branch statements.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ssgreg/nlreturn

Repository files navigation

nlreturn

Build Status Go Report Status Coverage Status

Linter requires a new line before return and branch statements except when the return is alone inside a statement group (such as an if statement) to increase code clarity.

Example

Examples of incorrect code:

func foo() int {
    a := 0
    _ = a
    return a
}

func bar() int {
    a := 0
    if a == 0 {
        _ = a
        return
    }
    return a
}

Examples of correct code:

func foo() int {
    a := 0
    _ = a

    return a
}

func bar() int {
    a := 0
    if a == 0 {
        _ = a

        return
    }

    return a
}

Args

  • -block-size n size of the block (including return statement that is still "OK") so no return split required.

About

Checks for a new line before return and branch statements.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  
0