Files
SwiftLint/Source/SwiftLintBuiltInRules/Rules/RuleConfigurations/FunctionParameterCountConfiguration.swift
Danny Mösch 82cad0bfff Allow to infer option names (#5505)
This allows to infer names of options from their names in a configuration. CamelCase is translated into snake_case automatically when `apply` is triggered.

* Don't have all `RuleConfiguration`s conform to `InlinableOptionType`. Mark types that must have this capability explicitly. Same for `AcceptableByConfigurationElement`.
* A type being an `InlinableOptionType` doesn't mean it's automatically inlined. This also doesn't depend on the fact of having a name for its key configured any longer. Instead, an `inline` attribute must explicitly be set to `true` in `@ConfigurationElement`.
* Key name inference is optional and can be overwritten by specifying a key name in the attribute.
* Inlined configurations only fail in `apply` when they are really sure that something is odd. Otherwise, they accept to not being updated.
2024-03-23 18:54:39 +01:00

12 lines
407 B
Swift

import SwiftLintCore
@AutoApply
struct FunctionParameterCountConfiguration: RuleConfiguration {
typealias Parent = FunctionParameterCountRule
@ConfigurationElement(inline: true)
private(set) var severityConfiguration = SeverityLevelsConfiguration<Parent>(warning: 5, error: 8)
@ConfigurationElement(key: "ignores_default_parameters")
private(set) var ignoresDefaultParameters = true
}