| description | Use the same pattern when defining parameters. |
|---|---|
| ms.date | 03/20/2026 |
| ms.topic | reference |
| title | UseConsistentParametersKind |
Severity Level: Warning
All functions should use the same pattern when defining parameters. Possible pattern types are:
-
Inlinefunction f([Parameter()]$FirstParam) { return }
-
ParamBlockfunction f { param([Parameter()]$FirstParam) return }
In simple scenarios, both function definitions shown are considered to be equal. The purpose of this rule is to enforce consistent code style across the codebase.
Rewrite function so it defines parameters as specified in the rule
When the rule sets parameters definition kind to Inline:
# Correct
function f([Parameter()]$FirstParam) {
return
}
# Incorrect
function g {
param([Parameter()]$FirstParam)
return
}When the rule sets parameters definition kind to ParamBlock:
# Incorrect
function f([Parameter()]$FirstParam) {
return
}
# Correct
function g {
param([Parameter()]$FirstParam)
return
}