solhint-community

named-return-values

Recommended Badge Category Badge Default Severity Badge warn

The {“extends”: “solhint:recommended”} property in a configuration file enables this rule.

Description

Ensure function return parameters are named

Options

This rule accepts an array of options:

Index Description Default Value
0 Rule severity. Must be one of “error”, “warn”, “off”. warn
1 An integer specifying the max amount of return values a function can have while still allowing them to remain anonymous 1

Example Config

{
  "rules": {
    "named-return-values": ["warn",1]
  }
}

Examples

👍 Examples of correct code for this rule

Function definition with named return values

function checkBalance(address wallet) external view returns(uint256 retBalance) {}

👎 Examples of incorrect code for this rule

Function definition with unnamed return values

function checkBalance(address wallet) external view returns(uint256) {}

Version

This rule was introduced in Solhint 3.7.0-rc02

Resources