solhint

gas-named-return-values

Category Badge Default Severity Badge warn

Description

Enforce the return values of a function to be named

Options

This rule accepts a string option of rule severity. Must be one of “error”, “warn”, “off”. Default to warn.

Example Config

{
  "rules": {
    "gas-named-return-values": "warn"
  }
}

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 4.5.0

Resources