Linting rules
S002: explicit-return-type
Requires explicit return types for function declarations.
Metadata
Code:S002Rule:explicit-return-typeStatus: Stable sincev0.0.1Quick fix: sometimes available
What it does
Requires explicit return types for function declarations.
Why is this bad?
Omitting return types makes APIs less clear and can hide accidental signature changes.
Example
fun buildSlice() { return beginCell().toSlice();
}Use instead:
fun buildSlice(): slice {
return beginCell().toSlice();
}Behavior notes
- Contract entrypoints
main,onInternalMessage,onExternalMessage,onRunTickTock,onSplitPrepare,onSplitInstall, andonBouncedMessageare ignored by this rule. - Functions whose inferred return type is
voidare ignored by this rule.
Last updated on