Structures

The following structures are available globally.

Result builder

Property wrapper

  • A single parameter of a rule configuration.

    Apply it to a simple (e.g. boolean) property like

    @ConfigurationElement
    var property = true
    

    to add a (boolean) option to a configuration. The name of the option will be inferred from the name of the property. In this case, it’s just property. CamelCase names will translated into snake_case, i.e. myOption is going to be translated into my_option in the .swiftlint.yml configuration file.

    This mechanism may be overwritten with an explicitly set key:

    @ConfigurationElement(key: "foo_bar")
    var property = true
    

    If the wrapped element is an InlinableOptionType, there are three ways to represent it in the documentation:

    1. It can be inlined into the parent configuration. For that, add the parameter inline: true. E.g. swift @ConfigurationElement(inline: true) var levels = SeverityLevelsConfiguration(warning: 1, error: 2) will be documented as a linear list: warning: 1 error: 2
    2. It can be represented as a separate nested configuration. In this case, it must not have set the inline flag to true. E.g. swift @ConfigurationElement var levels = SeverityLevelsConfiguration(warning: 1, error: 2) will have a nested configuration section: levels: warning: 1 error: 2
    3. As mentioned in the beginning, the implicit key inference mechanism can be overruled by specifying a key as in: swift @ConfigurationElement(key: "foo") var levels = SeverityLevelsConfiguration(warning: 1, error: 2) It will appear in the documentation as: foo: warning: 1 error: 2
    See more

    Declaration

    Swift

    @propertyWrapper
    public struct ConfigurationElement<T> : Equatable where T : Equatable, T : AcceptableByConfigurationElement
  • A rule configuration that allows specifying the desired severity level for violations.

    See more

    Declaration

    Swift

    public struct SeverityConfiguration<Parent> : SeverityBasedRuleConfiguration, InlinableOptionType where Parent : Rule
  • A detailed description for a SwiftLint rule. Used for both documentation and testing purposes.

    See more

    Declaration

    Swift

    public struct RuleDescription : Equatable, Sendable
  • A list of available SwiftLint rules.

    See more

    Declaration

    Swift

    public struct RuleList
    extension RuleList: Equatable
  • A configuration parameter for rules.

    See more

    Declaration

    Swift

    public struct RuleParameter<T> : Equatable where T : Equatable
  • A value describing an instance of Swift source code that is considered invalid by a SwiftLint rule.

    See more

    Declaration

    Swift

    public struct StyleViolation : CustomStringConvertible, Codable, Hashable
  • Represents a Swift file’s syntax information.

    See more

    Declaration

    Swift

    public struct SwiftLintSyntaxMap
  • A SwiftLint-aware Swift syntax token.

    See more

    Declaration

    Swift

    public struct SwiftLintSyntaxToken
  • A value describing the version of the Swift compiler.

    See more

    Declaration

    Swift

    public struct SwiftVersion : RawRepresentable, Codable, VersionComparable, Sendable
  • A type describing the SwiftLint version.

    See more

    Declaration

    Swift

    public struct Version : VersionComparable

YamlParser