Structures
The following structures are available globally.
-
User-facing documentation for a SwiftLint RuleList.
See moreDeclaration
Swift
public struct RuleListDocumentation
-
A basic stack type implementing the LIFO principle - only the last inserted element can be accessed and removed.
See moreDeclaration
Swift
public struct Stack<Element>
extension Stack: Sequence
extension Stack: CustomDebugStringConvertible where Element: CustomDebugStringConvertible
-
A set of violations that can be used to filter newly detected violations.
See moreDeclaration
Swift
public struct Baseline : Equatable
-
A rule configuration that allows to disable (
See moreoff
) an option of a rule or specify its severity level in which case it’s active.Declaration
Swift
public struct ChildOptionSeverityConfiguration<Parent> : RuleConfiguration, AcceptableByConfigurationElement where Parent : Rule
-
A SwiftLint-interpretable command to modify SwiftLint’s behavior embedded as comments in source code.
See moreDeclaration
Swift
public struct Command : Equatable
-
The configuration struct for SwiftLint. User-defined in the
See more.swiftlint.yml
file, drives the behavior of SwiftLint.Declaration
Swift
public struct Configuration
extension Configuration: Hashable
extension Configuration: CustomStringConvertible
-
A value describing a SwiftLint violation that was corrected.
See moreDeclaration
Swift
public struct Correction : Equatable, Sendable
-
Captures code and context information for an example of a triggering or non-triggering style
See moreDeclaration
Swift
public struct Example : Sendable
extension Example: Hashable
extension Example: Comparable
-
Represents a file that can be linted for style violations and corrections after being collected.
See moreDeclaration
Swift
public struct Linter
-
Represents a file that can compute style violations and corrections for a list of rules.
A
See moreCollectedLinter
is only created after aLinter
has run its collection steps inLinter.collect(into:)
.Declaration
Swift
public struct CollectedLinter
-
The placement of a segment of Swift in a collection of source files.
See moreDeclaration
Swift
public struct Location : CustomStringConvertible, Comparable, Codable, Sendable
-
A contiguous region of Swift source code.
See moreDeclaration
Swift
public struct Region : Equatable
-
Description of a rule configuration.
See moreDeclaration
Swift
public struct RuleConfigurationDescription : Equatable
extension RuleConfigurationDescription: Documentable
-
A single option of a
See moreRuleConfigurationDescription
.Declaration
Swift
public struct RuleConfigurationOption : Equatable
extension RuleConfigurationOption: Documentable
-
A result builder creating configuration descriptions.
Declaration
Swift
@resultBuilder public struct RuleConfigurationDescriptionBuilder
-
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 intomy_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:- 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
- It can be represented as a separate nested configuration. In this case, it must not have set the
inline
flag totrue
. E.g.swift @ConfigurationElement var levels = SeverityLevelsConfiguration(warning: 1, error: 2)
will have a nested configuration section:levels: warning: 1 error: 2
- 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
Declaration
Swift
@propertyWrapper public struct ConfigurationElement<T> : Equatable where T : Equatable, T : AcceptableByConfigurationElement
- It can be inlined into the parent configuration. For that, add the parameter
-
A rule configuration that allows specifying the desired severity level for violations.
See moreDeclaration
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 moreDeclaration
Swift
public struct RuleDescription : Equatable, Sendable
-
A list of available SwiftLint rules.
See moreDeclaration
Swift
public struct RuleList
extension RuleList: Equatable
-
A configuration parameter for rules.
See moreDeclaration
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 moreDeclaration
Swift
public struct StyleViolation : CustomStringConvertible, Codable, Hashable
-
Represents a Swift file’s syntax information.
See moreDeclaration
Swift
public struct SwiftLintSyntaxMap
-
A SwiftLint-aware Swift syntax token.
See moreDeclaration
Swift
public struct SwiftLintSyntaxToken
-
A value describing the version of the Swift compiler.
See moreDeclaration
Swift
public struct SwiftVersion : RawRepresentable, Codable, VersionComparable, Sendable
-
A type describing the SwiftLint version.
See moreDeclaration
Swift
public struct Version : VersionComparable
-
An interface for parsing YAML.
See moreDeclaration
Swift
public struct YamlParser
-
A violation produced by
See moreViolationsSyntaxVisitor
s.Declaration
Swift
public struct ReasonedRuleViolation : Comparable, Hashable
-
A rule configuration used for defining custom rules in yaml.
See moreDeclaration
Swift
public struct RegexConfiguration<Parent: Rule>: SeverityBasedRuleConfiguration, Hashable, CacheDescriptionProvider, InlinableOptionType
-
A rule configuration that allows specifying thresholds for
See morewarning
anderror
severities.Declaration
Swift
public struct SeverityLevelsConfiguration<Parent> : RuleConfiguration, InlinableOptionType where Parent : Rule