Empty Parameters
ID |
swift.empty_parameters |
Severity |
info |
Remediation Complexity |
medium |
Remediation Risk |
low |
Remediation Effort |
medium |
Resource |
Code Smell |
Language |
Swift |
Tags |
code-smell, style |
Description
Reports a function type written as (Void) → T. The idiomatic Swift
spelling for "function taking no arguments" is () → T.
typealias Bad = (Void) -> Int // FLAW
func f(_ cb: (Void) -> Int) {} // FLAW
typealias Good = () -> Int // OK
func g(_ cb: (Int) -> Int) {} // OK