SCWE-093: Unnamed Function Parameters
Stable Version v1.0
This content is in the version-(v1.0) and still under active development, so it is subject to change any time (e.g. structure, IDs, content, URLs, etc.).
Relationships¶
Description¶
This weakness occurs when functions declare parameters without names (only types). Unnamed parameters reduce code clarity and hinder maintainability, making it difficult for reviewers and future maintainers to understand the purpose and expected usage of each argument. In smart contracts, where correctness is critical, this ambiguity can result in misinterpretation, incorrect argument ordering in calls or refactors, and subtle logic errors.
Impact¶
Lack of clear parameter names can lead to:
- Misuse of function arguments due to misunderstanding of their meaning.
- Increased likelihood of logic bugs during refactoring and maintenance.
- Higher audit and review overhead; reduced readability and self-documentation.
- Potential security issues if parameters are confused (e.g., recipient vs. sender, amount vs. fee).
Remediation¶
- Always provide descriptive names for all function parameters.
- Choose meaningful, self-explanatory names consistent with a coding standard.
- Supplement with NatSpec where helpful to document parameter intent and units.
- Enforce naming conventions with linters and code review checklists.
Examples¶
-
Vulnerable Code (Unnamed parameters reduce clarity)
-
✅ Safe Code (Named parameters improve readability)