diff --git a/Classes.html b/Classes.html new file mode 100644 index 000000000..d6e8aed9f --- /dev/null +++ b/Classes.html @@ -0,0 +1,632 @@ + + + + Classes Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Classes

+

The following classes are available globally.

+ +
+
+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/Classes/BodyLengthRuleVisitor.html b/Classes/BodyLengthRuleVisitor.html new file mode 100644 index 000000000..08e431d8d --- /dev/null +++ b/Classes/BodyLengthRuleVisitor.html @@ -0,0 +1,670 @@ + + + + BodyLengthRuleVisitor Class Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

BodyLengthRuleVisitor

+
+
+ +
public final class BodyLengthRuleVisitor<Parent> : ViolationsSyntaxVisitor<SeverityLevelsConfiguration<Parent>> where Parent : Rule
+ +
+
+

Visitor that collection violations of code block lengths.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + Kind + +
    +
    +
    +
    +
    +
    +

    The code block types to check.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum Kind
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Initializer.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @inlinable
    +public init(kind: Kind, file: SwiftLintFile, configuration: SeverityLevelsConfiguration<Parent>)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + kind + + +
    +

    The code block type to check. See Kind.

    +
    +
    + + file + + +
    +

    The file to collect violation for.

    +
    +
    + + configuration + + +
    +

    The configuration that defines the acceptable limits.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override public func visitPost(_ node: EnumDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override public func visitPost(_ node: ClassDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override public func visitPost(_ node: StructDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override public func visitPost(_ node: ActorDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override public func visitPost(_ node: ClosureExprSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override public func visitPost(_ node: FunctionDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override public func visitPost(_ node: InitializerDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Classes/BodyLengthRuleVisitor/Kind.html b/Classes/BodyLengthRuleVisitor/Kind.html new file mode 100644 index 000000000..f6da26ebf --- /dev/null +++ b/Classes/BodyLengthRuleVisitor/Kind.html @@ -0,0 +1,454 @@ + + + + Kind Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Kind

+
+
+ +
public enum Kind
+ +
+
+

The code block types to check.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + closure + +
    +
    +
    +
    +
    +
    +

    Closure code blocks.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case closure
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + function + +
    +
    +
    +
    +
    +
    +

    Function body blocks.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case function
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + type + +
    +
    +
    +
    +
    +
    +

    Type (class, enum, …) member blocks.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case type
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Classes/CodeBlockVisitor.html b/Classes/CodeBlockVisitor.html new file mode 100644 index 000000000..2f477d24e --- /dev/null +++ b/Classes/CodeBlockVisitor.html @@ -0,0 +1,1050 @@ + + + + CodeBlockVisitor Class Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

CodeBlockVisitor

+
+
+ +
open class CodeBlockVisitor<Configuration> : ViolationsSyntaxVisitor<Configuration> where Configuration : RuleConfiguration
+ +
+
+

A visitor that collects style violations for all available code blocks.

+ + +
+
+ +
+
+
+
    +
  • + +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @inlinable
    +override public init(configuration: Configuration, file: SwiftLintFile)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: AccessorDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: ActorDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: CatchClauseSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: ClassDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: ClosureExprSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: DeferStmtSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: DoStmtSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: EnumDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: ExtensionDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: FunctionDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: ForStmtSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: GuardStmtSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: IfExprSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: InitializerDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: PatternBindingSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: PrecedenceGroupDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: ProtocolDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: RepeatStmtSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: StructDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: SwitchExprSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: WhileStmtSyntax)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Collects violations for the given braced item. Intended to be specialized by subclasses.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    open func collectViolations(for _: (some BracedSyntax)?)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + bracedItem + + +
    +

    The braced item to collect violations for.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Classes/CodeIndentingRewriter.html b/Classes/CodeIndentingRewriter.html new file mode 100644 index 000000000..fd09799cf --- /dev/null +++ b/Classes/CodeIndentingRewriter.html @@ -0,0 +1,473 @@ + + + + CodeIndentingRewriter Class Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

CodeIndentingRewriter

+
+
+ +
public class CodeIndentingRewriter : SyntaxRewriter
+ +
+
+

Rewriter that indents or unindents a syntax piece including comments and nested +AST nodes (e.g. a code block in a code block).

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + IndentationStyle + +
    +
    +
    +
    +
    +
    +

    Style defining whether the rewriter shall indent or unindent and whether it shall use tabs or spaces and +how many of them.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum IndentationStyle
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(style:) + +
    +
    +
    +
    +
    +
    +

    Initializer accepting an indentation style.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(style: IndentationStyle = .indentSpaces(4))
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + style + + +
    +

    Indentation style. The default is indentation by 4 spaces.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override public func visit(_ token: TokenSyntax) -> TokenSyntax
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Classes/CodeIndentingRewriter/IndentationStyle.html b/Classes/CodeIndentingRewriter/IndentationStyle.html new file mode 100644 index 000000000..44abb3dc2 --- /dev/null +++ b/Classes/CodeIndentingRewriter/IndentationStyle.html @@ -0,0 +1,485 @@ + + + + IndentationStyle Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

IndentationStyle

+
+
+ +
public enum IndentationStyle
+ +
+
+

Style defining whether the rewriter shall indent or unindent and whether it shall use tabs or spaces and +how many of them.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + indentSpaces(_:) + +
    +
    +
    +
    +
    +
    +

    Indentation with a number of spaces.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case indentSpaces(Int)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + unindentSpaces(_:) + +
    +
    +
    +
    +
    +
    +

    Reverse indentation of a number of spaces.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case unindentSpaces(Int)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + indentTabs(_:) + +
    +
    +
    +
    +
    +
    +

    Indentation with a number of tabs

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case indentTabs(Int)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + unindentTabs(_:) + +
    +
    +
    +
    +
    +
    +

    Reverse indentation of a number of tabs.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case unindentTabs(Int)
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Classes/DeclaredIdentifiersTrackingVisitor.html b/Classes/DeclaredIdentifiersTrackingVisitor.html new file mode 100644 index 000000000..21ea61909 --- /dev/null +++ b/Classes/DeclaredIdentifiersTrackingVisitor.html @@ -0,0 +1,737 @@ + + + + DeclaredIdentifiersTrackingVisitor Class Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

DeclaredIdentifiersTrackingVisitor

+
+
+ +
open class DeclaredIdentifiersTrackingVisitor<Configuration: RuleConfiguration>:
+        ViolationsSyntaxVisitor<Configuration>
+ +
+
+

A specialized ViolationsSyntaxVisitor that tracks declared identifiers per scope while traversing the AST.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + Scope + +
    +
    +
    +
    +
    +
    +

    A type that remembers the declared identifiers (in order) up to the current position in the code.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public typealias Scope = Stack<[IdentifierDeclaration]>
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + scope + +
    +
    +
    +
    +
    +
    +

    The hierarchical stack of identifiers declared up to the current position in the code.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var scope: Scope
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Initializer.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @inlinable
    +public init(configuration: Configuration, file: SwiftLintFile, scope: Scope = Scope())
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + configuration + + +
    +

    Configuration of a rule.

    +
    +
    + + file + + +
    +

    File from which the syntax tree stems from.

    +
    +
    + + scope + + +
    +

    A (potentially already pre-filled) scope to collect identifiers into.

    +
    +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Indicate whether a given identifier is in scope.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func hasSeenDeclaration(for identifier: String) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + identifier + + +
    +

    An identifier.

    +
    +
    +
    +
    +

    Return Value

    +

    true if the identifier was declared previously.

    +
    + +
    +
    +
  • +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visit(_ node: CodeBlockItemListSyntax) -> SyntaxVisitorContinueKind
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_: CodeBlockItemListSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: VariableDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: GuardStmtSyntax)
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Type declaration boundaries +

+
+
+
    +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visit(_ node: MemberBlockSyntax) -> SyntaxVisitorContinueKind
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: MemberBlockSyntax)
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Classes/RuleRegistry.html b/Classes/RuleRegistry.html new file mode 100644 index 000000000..5492e0035 --- /dev/null +++ b/Classes/RuleRegistry.html @@ -0,0 +1,531 @@ + + + + RuleRegistry Class Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

RuleRegistry

+
+
+ +
public final class RuleRegistry : @unchecked Sendable
+ +
+
+

Container to register and look up SwiftLint rules.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + shared + +
    +
    +
    +
    +
    +
    +

    Shared rule registry instance.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static let shared: RuleRegistry
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + list + +
    +
    +
    +
    +
    +
    +

    Rule list associated with this registry. Lazily created, and +immutable once looked up.

    +
    +

    Note

    + Adding registering more rules after this was first + accessed will not work. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public private(set) lazy var list: RuleList { get set }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + register(rules:) + +
    +
    +
    +
    +
    +
    +

    Register rules.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func register(rules: [any Rule.Type])
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + rules + + +
    +

    The rules to register.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + rule(forID:) + +
    +
    +
    +
    +
    +
    +

    Look up a rule for a given ID.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func rule(forID id: String) -> (any Rule.Type)?
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + id + + +
    +

    The ID for the rule to look up.

    +
    +
    +
    +
    +

    Return Value

    +

    The rule matching the specified ID, if one was found.

    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Classes/RuleStorage.html b/Classes/RuleStorage.html new file mode 100644 index 000000000..d0ea850de --- /dev/null +++ b/Classes/RuleStorage.html @@ -0,0 +1,421 @@ + + + + RuleStorage Class Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

RuleStorage

+
+
+ +
public class RuleStorage : CustomStringConvertible
+ +
+
+

A storage mechanism for aggregating the results of CollectingRules.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + description + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var description: String { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init() + +
    +
    +
    +
    +
    +
    +

    Creates a RuleStorage with no initial stored data.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init()
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Classes/SwiftLintFile.html b/Classes/SwiftLintFile.html new file mode 100644 index 000000000..666599bef --- /dev/null +++ b/Classes/SwiftLintFile.html @@ -0,0 +1,920 @@ + + + + SwiftLintFile Class Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

SwiftLintFile

+
+
+ +
public final class SwiftLintFile : Sendable
+
extension SwiftLintFile: Equatable, Hashable
+ +
+
+

A unit of Swift source code, either on disk or in memory.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + file + +
    +
    +
    +
    +
    +
    +

    The underlying SourceKitten file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let file: File
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + id + +
    +
    +
    +
    +
    +
    +

    The associated unique identifier for this file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let id: UUID
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + isTestFile + +
    +
    +
    +
    +
    +
    +

    Whether or not this is a file generated for testing purposes.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let isTestFile: Bool
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + isVirtual + +
    +
    +
    +
    +
    +
    +

    A file is virtual if it is not backed by a filesystem path.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let isVirtual: Bool
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a SwiftLintFile with a SourceKitten File.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(file: File, isTestFile: Bool = false, isVirtual: Bool = false)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + file + + +
    +

    A file from SourceKitten.

    +
    +
    + + isTestFile + + +
    +

    Mark the file as being generated for testing purposes only.

    +
    +
    + + isVirtual + + +
    +

    Mark the file as virtual (in-memory).

    +
    +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a SwiftLintFile by specifying its path on disk. +Fails if the file does not exist.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public convenience init?(path: String, isTestFile: Bool = false)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + path + + +
    +

    The path to a file on disk. Relative and absolute paths supported.

    +
    +
    + + isTestFile + + +
    +

    Mark the file as being generated for testing purposes only.

    +
    +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a SwiftLintFile by specifying its path on disk. Unlike the SwiftLintFile(path:) initializer, this +one does not read its contents immediately, but rather traps at runtime when attempting to access its contents.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public convenience init(pathDeferringReading path: String)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + path + + +
    +

    The path to a file on disk. Relative and absolute paths supported.

    +
    +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a SwiftLintFile that is not backed by a file on disk by specifying its contents.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public convenience init(contents: String, isTestFile: Bool = false)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + contents + + +
    +

    The contents of the file.

    +
    +
    + + isTestFile + + +
    +

    Mark the file as being generated for testing purposes only.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + path + +
    +
    +
    +
    +
    +
    +

    The path on disk for this file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var path: String? { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + contents + +
    +
    +
    +
    +
    +
    +

    The file’s contents.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var contents: String { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + stringView + +
    +
    +
    +
    +
    +
    +

    A string view into the contents of this file optimized for string manipulation operations.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var stringView: StringView { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + lines + +
    +
    +
    +
    +
    +
    +

    The parsed lines for this file’s contents.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var lines: [Line] { get }
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Hashable Conformance +

+
+
+
    +
  • +
    + + + + ==(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func == (lhs: SwiftLintFile, rhs: SwiftLintFile) -> Bool
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + hash(into:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func hash(into hasher: inout Hasher)
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Classes/ViolationsSyntaxRewriter.html b/Classes/ViolationsSyntaxRewriter.html new file mode 100644 index 000000000..940680688 --- /dev/null +++ b/Classes/ViolationsSyntaxRewriter.html @@ -0,0 +1,603 @@ + + + + ViolationsSyntaxRewriter Class Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

ViolationsSyntaxRewriter

+
+
+ +
open class ViolationsSyntaxRewriter<Configuration> : SyntaxRewriter where Configuration : RuleConfiguration
+ +
+
+

A SwiftSyntax SyntaxRewriter that produces absolute positions where corrections were applied.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + configuration + +
    +
    +
    +
    +
    +
    +

    A rule’s configuration.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let configuration: Configuration
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + file + +
    +
    +
    +
    +
    +
    +

    The file from which the traversed syntax tree stems from.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let file: SwiftLintFile
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + locationConverter + +
    +
    +
    +
    +
    +
    +

    A converter of positions in the traversed source file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public lazy var locationConverter: SourceLocationConverter { get set }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + disabledRegions + +
    +
    +
    +
    +
    +
    +

    The regions in the traversed file that are disabled by a command.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public lazy var disabledRegions: [SourceRange] { get set }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + correctionPositions + +
    +
    +
    +
    +
    +
    +

    Positions in a source file where corrections were applied.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var correctionPositions: [AbsolutePosition]
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Initializer for a ViolationsSyntaxRewriter.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @inlinable
    +public init(configuration: Configuration, file: SwiftLintFile)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + configuration + + +
    +

    Configuration of a rule.

    +
    +
    + + file + + +
    +

    File from which the syntax tree stems from.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitAny(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitAny(_ node: Syntax) -> Syntax?
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Classes/ViolationsSyntaxVisitor.html b/Classes/ViolationsSyntaxVisitor.html new file mode 100644 index 000000000..24a175fc4 --- /dev/null +++ b/Classes/ViolationsSyntaxVisitor.html @@ -0,0 +1,864 @@ + + + + ViolationsSyntaxVisitor Class Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

ViolationsSyntaxVisitor

+
+
+ +
open class ViolationsSyntaxVisitor<Configuration> : SyntaxVisitor where Configuration : RuleConfiguration
+ +
+
+

A SwiftSyntax SyntaxVisitor that produces absolute positions where violations should be reported.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + configuration + +
    +
    +
    +
    +
    +
    +

    A rule’s configuration.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let configuration: Configuration
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + file + +
    +
    +
    +
    +
    +
    +

    The file from which the traversed syntax tree stems from.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let file: SwiftLintFile
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + locationConverter + +
    +
    +
    +
    +
    +
    +

    A source location converter associated with the syntax tree being traversed.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public lazy var locationConverter: SourceLocationConverter { get set }
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Initializer for a ViolationsSyntaxVisitor.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @inlinable
    +public init(configuration: Configuration, file: SwiftLintFile)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + configuration + + +
    +

    Configuration of a rule.

    +
    +
    + + file + + +
    +

    File from which the syntax tree stems from.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + violations + +
    +
    +
    +
    +
    +
    +

    Positions in a source file where violations should be reported.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var violations: [ReasonedRuleViolation]
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + skippableDeclarations + +
    +
    +
    +
    +
    +
    +

    List of declaration types that shall be skipped while traversing the AST.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    open var skippableDeclarations: [any DeclSyntaxProtocol.Type] { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visit(_ node: ActorDeclSyntax) -> SyntaxVisitorContinueKind
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visit(_ node: ClassDeclSyntax) -> SyntaxVisitorContinueKind
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visit(_ node: EnumDeclSyntax) -> SyntaxVisitorContinueKind
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visit(_ node: ExtensionDeclSyntax) -> SyntaxVisitorContinueKind
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visit(_ node: FunctionDeclSyntax) -> SyntaxVisitorContinueKind
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visit(_ node: InitializerDeclSyntax) -> SyntaxVisitorContinueKind
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visit(_ node: ProtocolDeclSyntax) -> SyntaxVisitorContinueKind
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visit(_ node: StructDeclSyntax) -> SyntaxVisitorContinueKind
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visit(_ node: SubscriptDeclSyntax) -> SyntaxVisitorContinueKind
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visit(_ node: VariableDeclSyntax) -> SyntaxVisitorContinueKind
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Enums.html b/Enums.html new file mode 100644 index 000000000..cb62715ab --- /dev/null +++ b/Enums.html @@ -0,0 +1,636 @@ + + + + Enumerations Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Enumerations

+

The following enumerations are available globally.

+ +
+
+ +
+
+
+
    +
  • +
    + + + + AccessControlLevel + +
    +
    +
    +
    +
    +
    +

    The accessibility of a Swift source declaration.

    + + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum AccessControlLevel : String, CustomStringConvertible
    +
    extension AccessControlLevel: Comparable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + Issue + +
    +
    +
    +
    +
    +
    +

    All possible SwiftLint issues which are printed as warnings by default.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum Issue : LocalizedError, Equatable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + OptionType + +
    +
    +
    +
    +
    +
    +

    Type of an option.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum OptionType : Equatable, Sendable
    +
    extension OptionType: Documentable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + RuleIdentifier + +
    +
    +
    +
    +
    +
    +

    An identifier representing a SwiftLint rule, or all rules.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum RuleIdentifier : Hashable, ExpressibleByStringLiteral, Comparable, Sendable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + RuleKind + +
    +
    +
    +
    +
    +
    +

    All the possible rule kinds (categories).

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum RuleKind : String, Codable, Sendable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + RuleListError + +
    +
    +
    +
    +
    +
    +

    All possible rule list configuration errors.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum RuleListError : Error
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + SwiftExpressionKind + +
    +
    +
    +
    +
    +
    +

    The kind of expression for a contiguous set of Swift source tokens.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum SwiftExpressionKind : String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + ViolationSeverity + +
    +
    +
    +
    +
    +
    +

    The magnitude of a StyleViolation.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum ViolationSeverity : String, Comparable, Codable, Sendable, InlinableOptionType
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + IdentifierDeclaration + +
    +
    +
    +
    +
    +
    +

    An identifier declaration.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum IdentifierDeclaration : Hashable
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Enums/AccessControlLevel.html b/Enums/AccessControlLevel.html new file mode 100644 index 000000000..e262c6f3d --- /dev/null +++ b/Enums/AccessControlLevel.html @@ -0,0 +1,685 @@ + + + + AccessControlLevel Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

AccessControlLevel

+
+
+ +
public enum AccessControlLevel : String, CustomStringConvertible
+
extension AccessControlLevel: Comparable
+ +
+
+

The accessibility of a Swift source declaration.

+ + + +
+
+ +
+
+
+
    +
  • +
    + + + + private + +
    +
    +
    +
    +
    +
    +

    Accessible by the declaration’s immediate lexical scope.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case `private` = "source.lang.swift.accessibility.private"
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + fileprivate + +
    +
    +
    +
    +
    +
    +

    Accessible by the declaration’s same file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case `fileprivate` = "source.lang.swift.accessibility.fileprivate"
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + internal + +
    +
    +
    +
    +
    +
    +

    Accessible by the declaration’s same module, or modules importing it with the @testable attribute.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case `internal` = "source.lang.swift.accessibility.internal"
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + package + +
    +
    +
    +
    +
    +
    +

    Accessible by all the modules defined in the same Swift package.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case package = "source.lang.swift.accessibility.package"
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + public + +
    +
    +
    +
    +
    +
    +

    Accessible by the declaration’s same program.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case `public` = "source.lang.swift.accessibility.public"
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + open + +
    +
    +
    +
    +
    +
    +

    Accessible and customizable (via subclassing or overrides) by the declaration’s same program.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case open = "source.lang.swift.accessibility.open"
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(description:) + +
    +
    +
    +
    +
    +
    +

    Initializes an access control level by its Swift source keyword value.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init?(description value: String)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + value + + +
    +

    The value used to describe this level in Swift source code.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + description + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var description: String { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + isPrivate + +
    +
    +
    +
    +
    +
    +

    Returns true if is private or fileprivate

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var isPrivate: Bool { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + <(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func < (lhs: AccessControlLevel, rhs: AccessControlLevel) -> Bool
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Enums/IdentifierDeclaration.html b/Enums/IdentifierDeclaration.html new file mode 100644 index 000000000..282d7c2cb --- /dev/null +++ b/Enums/IdentifierDeclaration.html @@ -0,0 +1,574 @@ + + + + IdentifierDeclaration Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

IdentifierDeclaration

+
+
+ +
public enum IdentifierDeclaration : Hashable
+ +
+
+

An identifier declaration.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + parameter(name:) + +
    +
    +
    +
    +
    +
    +

    Parameter declaration with a name token.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case parameter(name: TokenSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + localVariable(name:) + +
    +
    +
    +
    +
    +
    +

    Local variable declaration with a name token.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case localVariable(name: TokenSyntax)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    A variable that is implicitly added by the compiler (e.g. error in catch clauses).

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case implicitVariable(name: String)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + wildcard + +
    +
    +
    +
    +
    +
    +

    A variable hidden from scope because its name is a wildcard _.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case wildcard
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + lookupBoundary + +
    +
    +
    +
    +
    +
    +

    Special case that marks a type boundary at which name lookup stops.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case lookupBoundary
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Check whether self declares a variable given by name.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func declares(id: String, disregardBackticks: Bool = true) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + id + + +
    +

    Name of the variable.

    +
    +
    + + disregardBackticks + + +
    +

    If true, normalize all names before comparison by removing all backticks. This is the + default since backticks only disambiguate, but don’t contribute to name resolution.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Enums/Issue.html b/Enums/Issue.html new file mode 100644 index 000000000..be5e88f9d --- /dev/null +++ b/Enums/Issue.html @@ -0,0 +1,1173 @@ + + + + Issue Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Issue

+
+
+ +
public enum Issue : LocalizedError, Equatable
+ +
+
+

All possible SwiftLint issues which are printed as warnings by default.

+ + +
+
+ +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    The configuration didn’t match internal expectations.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case invalidConfiguration(ruleID: String, message: String? = nil)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Issued when a regular expression pattern is invalid.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case invalidRegexPattern(ruleID: String, pattern: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Issued when an option is deprecated. Suggests an alternative optionally.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case deprecatedConfigurationOption(ruleID: String, key: String, alternative: String? = nil)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Used in configuration parsing when no changes have been applied. Use only internally!

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case nothingApplied(ruleID: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Rule is listed multiple times in the configuration.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case listedMultipleTime(ruleID: String, times: Int)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    An identifier old has been renamed to new.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case renamedIdentifier(old: String, new: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Some configuration keys are invalid.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case invalidConfigurationKeys(ruleID: String, keys: Set<String>)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    The configuration is inconsistent, that is options are mutually exclusive or one drives other values +irrelevant.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case inconsistentConfiguration(ruleID: String, message: String)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + invalidRuleIDs(_:) + +
    +
    +
    +
    +
    +
    +

    Used rule IDs are invalid.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case invalidRuleIDs(Set<String>)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Found a rule configuration for a rule that is not present in only_rules.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case ruleNotPresentInOnlyRules(ruleID: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Found a rule configuration for a rule that is disabled.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case ruleDisabledInDisabledRules(ruleID: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Found a rule configuration for a rule that is disabled in the parent configuration.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case ruleDisabledInParentConfiguration(ruleID: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Found a rule configuration for a rule that is not enabled in opt_in_rules.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case ruleNotEnabledInOptInRules(ruleID: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Found a rule configuration for a rule that is not enabled in parent only_rules.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case ruleNotEnabledInParentOnlyRules(ruleID: String)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + genericWarning(_:) + +
    +
    +
    +
    +
    +
    +

    A generic warning specified by a string.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case genericWarning(String)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + genericError(_:) + +
    +
    +
    +
    +
    +
    +

    A generic error specified by a string.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case genericError(String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    A deprecation warning for a rule.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case ruleDeprecated(ruleID: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    The initial configuration file was not found.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case initialFileNotFound(path: String)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + fileNotFound(path:) + +
    +
    +
    +
    +
    +
    +

    A file at specified path was not found.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case fileNotFound(path: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    The file at path is not readable or cannot be opened.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case fileNotReadable(path: String?, ruleID: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    The file at path is not writable.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case fileNotWritable(path: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    The file at path cannot be indexed by a specific rule.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case indexingError(path: String?, ruleID: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    No arguments were provided to compile a file at path within a specific rule.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case missingCompilerArguments(path: String?, ruleID: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Cursor information cannot be extracted from a specific location.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case missingCursorInfo(path: String?, ruleID: String)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + yamlParsing(_:) + +
    +
    +
    +
    +
    +
    +

    An error that occurred when parsing YAML.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case yamlParsing(String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    The baseline file at path is not readable or cannot be opened.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case baselineNotReadable(path: String)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + print() + +
    +
    +
    +
    +
    +
    +

    Print the issue to the console.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func print()
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Enums/OptionType.html b/Enums/OptionType.html new file mode 100644 index 000000000..237ed785f --- /dev/null +++ b/Enums/OptionType.html @@ -0,0 +1,880 @@ + + + + OptionType Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

OptionType

+
+
+ +
public enum OptionType : Equatable, Sendable
+
extension OptionType: Documentable
+ +
+
+

Type of an option.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + empty + +
    +
    +
    +
    +
    +
    +

    An irrelevant option. It will be ignored in documentation serialization.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case empty
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + flag(_:) + +
    +
    +
    +
    +
    +
    +

    A boolean flag.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case flag(Bool)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + string(_:) + +
    +
    +
    +
    +
    +
    +

    A string option.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case string(String)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + symbol(_:) + +
    +
    +
    +
    +
    +
    +

    Like a string option but without quotes in the serialized output.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case symbol(String)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + integer(_:) + +
    +
    +
    +
    +
    +
    +

    An integer option.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case integer(Int)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + float(_:) + +
    +
    +
    +
    +
    +
    +

    A floating point number option.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case float(Double)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + severity(_:) + +
    +
    +
    +
    +
    +
    +

    Special option for a ViolationSeverity.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case severity(ViolationSeverity)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + list(_:) + +
    +
    +
    +
    +
    +
    +

    A list of options.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case list([`Self`])
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + nested(_:) + +
    +
    +
    +
    +
    +
    +

    An option which is another set of configuration options to be nested in the serialized output.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case nested(RuleConfigurationDescription)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + hasContent + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var hasContent: Bool { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + markdown() + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func markdown() -> String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + oneLiner() + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func oneLiner() -> String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + yaml() + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func yaml() -> String
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Result builder +

+
+
+
    +
  • +
    + + + + =>(_:_:) + +
    +
    +
    +
    +
    +
    +

    Operator enabling an easy way to create a configuration option.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static func => (key: String, value: OptionType) -> RuleConfigurationOption
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + key + + +
    +

    Name of the option.

    +
    +
    + + value + + +
    +

    Value of the option.

    +
    +
    +
    +
    +

    Return Value

    +

    A configuration option built up by the given data.

    +
    + +
    +
    +
  • +
  • +
    + + + + nest(_:) + +
    +
    +
    +
    +
    +
    +

    Create an option defined by nested configuration description.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static func nest(@RuleConfigurationDescriptionBuilder _ description: () -> RuleConfigurationDescription) -> OptionType
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + description + + +
    +

    A configuration description buildable by applying the result builder syntax.

    +
    +
    +
    +
    +

    Return Value

    +

    A configuration option with a value being another configuration description.

    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Enums/RuleIdentifier.html b/Enums/RuleIdentifier.html new file mode 100644 index 000000000..b019177d0 --- /dev/null +++ b/Enums/RuleIdentifier.html @@ -0,0 +1,622 @@ + + + + RuleIdentifier Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

RuleIdentifier

+
+
+ +
public enum RuleIdentifier : Hashable, ExpressibleByStringLiteral, Comparable, Sendable
+ +
+
+

An identifier representing a SwiftLint rule, or all rules.

+ + +
+
+ +
+
+
+
+ + +
+ +

Values +

+
+
+
    +
  • +
    + + + + all + +
    +
    +
    +
    +
    +
    +

    Special identifier that should be treated as referring to ‘all’ SwiftLint rules. One helpful usecase is in +disabling all SwiftLint rules in a given file by adding a // swiftlint:disable all comment at the top of the +file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case all
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + single(identifier:) + +
    +
    +
    +
    +
    +
    +

    Represents a single SwiftLint rule with the specified identifier.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case single(identifier: String)
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Properties +

+
+
+
    +
  • +
    + + + + stringRepresentation + +
    +
    +
    +
    +
    +
    +

    The spelling of the string for this identifier.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var stringRepresentation: String { get }
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Initializers +

+
+
+
    +
  • +
    + + + + init(_:) + +
    +
    +
    +
    +
    +
    +

    Creates a RuleIdentifier by its string representation.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(_ value: String)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + value + + +
    +

    The string representation.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

ExpressibleByStringLiteral Conformance +

+
+
+ +
+
+
+ + +
+ +

Comparable Conformance +

+
+
+
    +
  • +
    + + + + <(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func < (lhs: `Self`, rhs: `Self`) -> Bool
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Enums/RuleKind.html b/Enums/RuleKind.html new file mode 100644 index 000000000..01a1c6442 --- /dev/null +++ b/Enums/RuleKind.html @@ -0,0 +1,512 @@ + + + + RuleKind Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

RuleKind

+
+
+ +
public enum RuleKind : String, Codable, Sendable
+ +
+
+

All the possible rule kinds (categories).

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + lint + +
    +
    +
    +
    +
    +
    +

    Describes rules that validate Swift source conventions.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case lint
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + idiomatic + +
    +
    +
    +
    +
    +
    +

    Describes rules that validate common practices in the Swift community.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case idiomatic
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + style + +
    +
    +
    +
    +
    +
    +

    Describes rules that validate stylistic choices.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case style
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + metrics + +
    +
    +
    +
    +
    +
    +

    Describes rules that validate magnitudes or measurements of Swift source.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case metrics
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + performance + +
    +
    +
    +
    +
    +
    +

    Describes rules that validate that code patterns with poor performance are avoided.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case performance
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Enums/RuleListError.html b/Enums/RuleListError.html new file mode 100644 index 000000000..b0d10a0ef --- /dev/null +++ b/Enums/RuleListError.html @@ -0,0 +1,392 @@ + + + + RuleListError Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

RuleListError

+
+
+ +
public enum RuleListError : Error
+ +
+
+

All possible rule list configuration errors.

+ + +
+
+ +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    The rule list contains more than one configuration for the specified rule.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case duplicatedConfigurations(rule: any Rule.Type)
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Enums/SwiftExpressionKind.html b/Enums/SwiftExpressionKind.html new file mode 100644 index 000000000..2324e5c9d --- /dev/null +++ b/Enums/SwiftExpressionKind.html @@ -0,0 +1,572 @@ + + + + SwiftExpressionKind Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

SwiftExpressionKind

+
+
+ +
public enum SwiftExpressionKind : String
+ +
+
+

The kind of expression for a contiguous set of Swift source tokens.

+ + +
+
+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/Enums/ViolationSeverity.html b/Enums/ViolationSeverity.html new file mode 100644 index 000000000..9edce8ecb --- /dev/null +++ b/Enums/ViolationSeverity.html @@ -0,0 +1,464 @@ + + + + ViolationSeverity Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

ViolationSeverity

+
+
+ +
public enum ViolationSeverity : String, Comparable, Codable, Sendable, InlinableOptionType
+ +
+
+

The magnitude of a StyleViolation.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + warning + +
    +
    +
    +
    +
    +
    +

    Non-fatal. If using SwiftLint as an Xcode build phase, Xcode will mark the build as having succeeded.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case warning
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + error + +
    +
    +
    +
    +
    +
    +

    Fatal. If using SwiftLint as an Xcode build phase, Xcode will mark the build as having failed.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case error
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Comparable +

+
+
+
    +
  • +
    + + + + <(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func < (lhs: `Self`, rhs: `Self`) -> Bool
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Extensions.html b/Extensions.html new file mode 100644 index 000000000..236b770eb --- /dev/null +++ b/Extensions.html @@ -0,0 +1,556 @@ + + + + Extensions Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Extensions

+

The following extensions are available globally.

+ +
+
+ +
+
+
+ +
+
+
+ + +
+ +

AcceptableByConfigurationElement conformances +

+
+
+ +
+
+
+ +
+
+ + + diff --git a/Extensions/Array.html b/Extensions/Array.html new file mode 100644 index 000000000..09748232b --- /dev/null +++ b/Extensions/Array.html @@ -0,0 +1,903 @@ + + + + Array Extension Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Array

+
+
+ +
public extension Array where Element == Example
+
extension Array: AcceptableByConfigurationElement where Element: AcceptableByConfigurationElement
+
public extension Array where Element == SwiftLintSyntaxToken
+
public extension Array where Element == ReasonedRuleViolation
+
public extension Array where Element == any DeclSyntaxProtocol.Type
+ +
+
+ +
+
+ +
+
+
+
+ + +
+ +

Available where Element == Example +

+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    Make these examples skip wrapping in comment tests.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func skipWrappingInCommentTests() -> Array<Element>
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Make these examples skip wrapping in string tests.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func skipWrappingInStringTests() -> Array<Element>
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Make these examples skip multi-byte offset tests.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func skipMultiByteOffsetTests() -> Array<Element>
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Make these examples skip disable command tests.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func skipDisableCommandTests() -> Array<Element>
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Remove all violation markers from the examples.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func removingViolationMarker() -> Array<Element>
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Available where Element: AcceptableByConfigurationElement +

+
+
+ +
+
+
+ + +
+ +

Available where Element == SwiftLintSyntaxToken +

+
+
+
    +
  • +
    + + + + kinds + +
    +
    +
    +
    +
    +
    +

    The kinds for these tokens.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    var kinds: [SyntaxKind] { get }
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Available where Element == ReasonedRuleViolation +

+
+
+
    +
  • +
    + + + + append(_:) + +
    +
    +
    +
    +
    +
    +

    Add a violation at the specified position using the default description and severity.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    mutating func append(_ position: AbsolutePosition)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + position + + +
    +

    The position for the violation to append.

    +
    +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Add a violation and the correction at the specified position using the default description and severity.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    mutating func append(at position: AbsolutePosition, correction: ReasonedRuleViolation.ViolationCorrection? = nil)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + position + + +
    +

    The position for the violation to append.

    +
    +
    + + correction + + +
    +

    An optional correction to be applied when running with --fix.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + append(contentsOf:) + +
    +
    +
    +
    +
    +
    +

    Add violations for the specified positions using the default description and severity.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    mutating func append(contentsOf positions: [AbsolutePosition])
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + positions + + +
    +

    The positions for the violations to append.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Available where Element == anyDeclSyntaxProtocol.Type +

+
+
+
    +
  • +
    + + + + all + +
    +
    +
    +
    +
    +
    +

    All visitable declaration syntax types.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let all: `Self`
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + allExcept(_:) + +
    +
    +
    +
    +
    +
    +

    All declarations except for the specified ones.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static func allExcept(_ declarations: Element...) -> Array<Element>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + declarations + + +
    +

    The declarations to exclude from all declarations.

    +
    +
    +
    +
    +

    Return Value

    +

    All declarations except for the specified ones.

    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Extensions/Bool.html b/Extensions/Bool.html new file mode 100644 index 000000000..e7d2e4e75 --- /dev/null +++ b/Extensions/Bool.html @@ -0,0 +1,416 @@ + + + + Bool Extension Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Bool

+
+
+ +
extension Bool: AcceptableByConfigurationElement
+ +
+
+ +
+
+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/Extensions/Double.html b/Extensions/Double.html new file mode 100644 index 000000000..310ccab7a --- /dev/null +++ b/Extensions/Double.html @@ -0,0 +1,416 @@ + + + + Double Extension Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Double

+
+
+ +
extension Double: AcceptableByConfigurationElement
+ +
+
+ +
+
+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/Extensions/Int.html b/Extensions/Int.html new file mode 100644 index 000000000..cb0c1ad37 --- /dev/null +++ b/Extensions/Int.html @@ -0,0 +1,416 @@ + + + + Int Extension Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Int

+
+
+ +
extension Int: AcceptableByConfigurationElement
+ +
+
+ +
+
+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/Extensions/Optional.html b/Extensions/Optional.html new file mode 100644 index 000000000..7ea53f2c1 --- /dev/null +++ b/Extensions/Optional.html @@ -0,0 +1,425 @@ + + + + Optional Extension Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Optional

+
+
+ +
extension Optional: AcceptableByConfigurationElement where Wrapped: AcceptableByConfigurationElement
+ +
+
+ +
+
+ +
+
+
+
+ + +
+ +

Available where Wrapped: AcceptableByConfigurationElement +

+
+
+ +
+
+
+ +
+
+ + + diff --git a/Extensions/Set.html b/Extensions/Set.html new file mode 100644 index 000000000..f225fd070 --- /dev/null +++ b/Extensions/Set.html @@ -0,0 +1,425 @@ + + + + Set Extension Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Set

+
+
+ +
extension Set: AcceptableByConfigurationElement where Element: AcceptableByConfigurationElement & Comparable
+ +
+
+ +
+
+ +
+
+
+
+ + +
+ +

Available where Element: AcceptableByConfigurationElement & Comparable +

+
+
+ +
+
+
+ +
+
+ + + diff --git a/Extensions/String.html b/Extensions/String.html new file mode 100644 index 000000000..58690ad9a --- /dev/null +++ b/Extensions/String.html @@ -0,0 +1,416 @@ + + + + String Extension Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

String

+
+
+ +
extension String: AcceptableByConfigurationElement
+ +
+
+ +
+
+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/Guides.html b/Guides.html new file mode 100644 index 000000000..445442698 --- /dev/null +++ b/Guides.html @@ -0,0 +1,2555 @@ + + + + Guides Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Guides

+

The following guides are available globally.

+ +
+
+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/Macros.html b/Macros.html new file mode 100644 index 000000000..378e48add --- /dev/null +++ b/Macros.html @@ -0,0 +1,513 @@ + + + + Macros Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Macros

+

The following macros are available globally.

+ +
+
+ +
+
+
+
    +
  • +
    + + + + AutoConfigParser() + +
    +
    +
    +
    +
    +
    +

    Macro to be attached to rule configurations. It generates the configuration parsing logic +automatically based on the defined @ConfigurationElements.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @attached(member, names: named(apply)
    +) public macro AutoConfigParser() = #externalMacro(
    +    module: "SwiftLintCoreMacros",
    +    type: "AutoConfigParser"
    +)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Macro that lets an enum with a String raw type automatically conform to AcceptableByConfigurationElement.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @attached(extension, conformances: AcceptableByConfigurationElement, names: named(init(fromAny:context:)
    +), named(asOption)) public macro AcceptableByConfigurationElement() = #externalMacro(
    +    module: "SwiftLintCoreMacros",
    +    type: "AcceptableByConfigurationElement"
    +)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Macro that adds a conformance to the SwiftSyntaxRule protocol and a default makeVisitor(file:) implementation +that creates a visitor defined in the rule struct.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @attached(extension, conformances: SwiftSyntaxRule, SwiftSyntaxCorrectableRule, OptInRule, Rule, names: named(makeVisitor(file:)
    +), named(preprocess(file:)), named(makeRewriter(file:))) public macro SwiftSyntaxRule(foldExpressions: Bool = false, explicitRewriter: Bool = false, correctable: Bool = false, optIn: Bool = false) = #externalMacro(
    +    module: "SwiftLintCoreMacros",
    +    type: "SwiftSyntaxRule"
    +)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + +
    + + foldExpressions + + +
    +

    Setting it to true adds an implementation of preprocess(file:) which folds expressions + before they are passed to the visitor.

    +
    +
    + + explicitRewriter + + +
    +

    Set it to true to add a makeRewriter(file:) implementation which creates a rewriter + defined in the rule struct. In this case, the rule automatically conforms to + SwiftSyntaxCorrectableRule.

    +
    +
    + + correctable + + +
    +

    Set it to true to make the rule conform to SwiftSyntaxCorrectableRule without an explicit + rewriter.

    +
    +
    + + optIn + + +
    +

    Set it to true to make the rule conform to OptInRule.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Protocols.html b/Protocols.html new file mode 100644 index 000000000..c626bd9b3 --- /dev/null +++ b/Protocols.html @@ -0,0 +1,932 @@ + + + + Protocols Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Protocols

+

The following protocols are available globally.

+ +
+
+ +
+
+
+
    +
  • +
    + + + + Documentable + +
    +
    +
    +
    +
    +
    +

    A type that can be converted into a human-readable representation.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol Documentable
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Property wrapper +

+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    Type of an object that can be used as a configuration element.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol AcceptableByConfigurationElement
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + InlinableOptionType + +
    +
    +
    +
    +
    +
    +

    An option type that can appear inlined into its using configuration.

    + +

    The ConfigurationElement must opt into this behavior. In this case, the option does not have a key. This is +almost exclusively useful for common RuleConfigurations that are used in many other rules as child +configurations.

    +
    +

    Warning

    +

    A type conforming to this protocol is assumed to throw an issue in its apply method only when it’s +absolutely clear that there is an error in the YAML configuration passed in. Since it may be used in a nested +context and doesn’t know about the outer configuration, it’s not always clear if a certain key-value is really +unacceptable.

    + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol InlinableOptionType : AcceptableByConfigurationElement
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + VersionComparable + +
    +
    +
    +
    +
    +
    +

    A comparable major.minor.patch version number.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol VersionComparable : Comparable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + ASTRule + +
    +
    +
    +
    +
    +
    +

    A rule that leverages the Swift source’s pre-typechecked Abstract Syntax Tree to recurse into the source’s +structure, validating the rule recursively in nested source bodies.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol ASTRule : Rule
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Interface providing access to a cache description.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol CacheDescriptionProvider
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + AnyCollectingRule + +
    +
    +
    +
    +
    +
    +

    Type-erased protocol used to check whether a rule is collectable.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol AnyCollectingRule : Rule
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + CollectingRule + +
    +
    +
    +
    +
    +
    +

    A rule that requires knowledge of all other files being linted.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol CollectingRule : AnyCollectingRule
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + Rule + +
    +
    +
    +
    +
    +
    +

    An executable value that can identify issues (violations) in Swift source code.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol Rule
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + OptInRule + +
    +
    +
    +
    +
    +
    +

    A rule that is not enabled by default. Rules conforming to this need to be explicitly enabled by users.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol OptInRule : Rule
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + CorrectableRule + +
    +
    +
    +
    +
    +
    +

    A rule that can correct violations.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol CorrectableRule : Rule
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    A correctable rule that can apply its corrections by replacing the content of ranges in the offending file with +updated content.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol SubstitutionCorrectableRule : CorrectableRule
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + SourceKitFreeRule + +
    +
    +
    +
    +
    +
    +

    A rule that does not need SourceKit to operate and can still operate even after SourceKit has crashed.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol SourceKitFreeRule : Rule
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + AnalyzerRule + +
    +
    +
    +
    +
    +
    +

    A rule that can operate on the post-typechecked AST using compiler arguments. Performs rules that are more like +static analysis than syntactic checks.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol AnalyzerRule : OptInRule
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + RuleConfiguration + +
    +
    +
    +
    +
    +
    +

    A configuration value for a rule to allow users to modify its behavior.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol RuleConfiguration : Equatable
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    A configuration for a rule that allows to configure at least the severity.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol SeverityBasedRuleConfiguration : RuleConfiguration
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    A SwiftLint CorrectableRule that performs its corrections using a SwiftSyntax SyntaxRewriter.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol SwiftSyntaxCorrectableRule : CorrectableRule, SwiftSyntaxRule
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + SwiftSyntaxRule + +
    +
    +
    +
    +
    +
    +

    A SwiftLint Rule backed by SwiftSyntax that does not use SourceKit requests.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol SwiftSyntaxRule : SourceKitFreeRule
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Protocols/ASTRule.html b/Protocols/ASTRule.html new file mode 100644 index 000000000..197129254 --- /dev/null +++ b/Protocols/ASTRule.html @@ -0,0 +1,626 @@ + + + + ASTRule Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

ASTRule

+
+
+ +
public protocol ASTRule : Rule
+ +
+
+

A rule that leverages the Swift source’s pre-typechecked Abstract Syntax Tree to recurse into the source’s +structure, validating the rule recursively in nested source bodies.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + KindType + +
    +
    +
    +
    +
    +
    +

    The kind of token being recursed over.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    associatedtype KindType : RawRepresentable
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Executes the rule on a file and a subset of its AST structure, returning any violations to the rule’s +expectations.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func validate(file: SwiftLintFile, kind: KindType, dictionary: SourceKittenDictionary) -> [StyleViolation]
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + file + + +
    +

    The file for which to execute the rule.

    +
    +
    + + kind + + +
    +

    The kind of token being recursed over.

    +
    +
    + + dictionary + + +
    +

    The dictionary for an AST subset to validate.

    +
    +
    +
    +
    +

    Return Value

    +

    All style violations to the rule’s expectations.

    +
    + +
    +
    +
  • +
  • +
    + + + + kind(from:) + +
    +
    +
    +
    +
    +
    +

    Get the kind from the specified dictionary.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func kind(from dictionary: SourceKittenDictionary) -> KindType?
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + dictionary + + +
    +

    The SourceKittenDictionary representing the source structure from which to extract the + kind.

    +
    +
    +
    +
    +

    Return Value

    +

    The kind from the specified dictionary, if one was found.

    +
    + +
    +
    +
  • +
  • +
    + + + + validate(file:) + + + Extension method + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func validate(file: SwiftLintFile) -> [StyleViolation]
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + validate(file:dictionary:) + + + Extension method + +
    +
    +
    +
    +
    +
    +

    Executes the rule on a file and a subset of its AST structure, returning any violations to the rule’s +expectations.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func validate(file: SwiftLintFile, dictionary: SourceKittenDictionary) -> [StyleViolation]
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + file + + +
    +

    The file for which to execute the rule.

    +
    +
    + + dictionary + + +
    +

    The dictionary for an AST subset to validate.

    +
    +
    +
    +
    +

    Return Value

    +

    All style violations to the rule’s expectations.

    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Protocols/AcceptableByConfigurationElement.html b/Protocols/AcceptableByConfigurationElement.html new file mode 100644 index 000000000..1142df697 --- /dev/null +++ b/Protocols/AcceptableByConfigurationElement.html @@ -0,0 +1,585 @@ + + + + AcceptableByConfigurationElement Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

AcceptableByConfigurationElement

+
+
+ +
public protocol AcceptableByConfigurationElement
+ +
+
+

Type of an object that can be used as a configuration element.

+ + +
+
+ +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    Initializer taking a value from a configuration to create an element of Self.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    init(fromAny value: Any, context ruleID: String) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + value + + +
    +

    Value from a configuration.

    +
    +
    + + ruleID + + +
    +

    The rule’s identifier in which context the configuration parsing runs.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + asOption() + +
    +
    +
    +
    +
    +
    +

    Make the object an option.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func asOption() -> OptionType
    + +
    +
    +
    +

    Return Value

    +

    Option representing the object.

    +
    + +
    +
    +
  • +
  • +
    + + + + asDescription(with:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Make the object a description.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func asDescription(with key: String) -> RuleConfigurationDescription
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + key + + +
    +

    Name of the option to be put into the description.

    +
    +
    +
    +
    +

    Return Value

    +

    Configuration description of this object.

    +
    + +
    +
    +
  • +
  • +
    + + + + apply(_:ruleID:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Update the object.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    mutating func apply(_ value: Any, ruleID: String) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + value + + +
    +

    New underlying data for the object.

    +
    +
    + + ruleID + + +
    +

    The rule’s identifier in which context the configuration parsing runs.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Protocols/AnalyzerRule.html b/Protocols/AnalyzerRule.html new file mode 100644 index 000000000..059a6dba2 --- /dev/null +++ b/Protocols/AnalyzerRule.html @@ -0,0 +1,395 @@ + + + + AnalyzerRule Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

AnalyzerRule

+
+
+ +
public protocol AnalyzerRule : OptInRule
+ +
+
+

A rule that can operate on the post-typechecked AST using compiler arguments. Performs rules that are more like +static analysis than syntactic checks.

+ + +
+
+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/Protocols/CacheDescriptionProvider.html b/Protocols/CacheDescriptionProvider.html new file mode 100644 index 000000000..fe9e313bb --- /dev/null +++ b/Protocols/CacheDescriptionProvider.html @@ -0,0 +1,393 @@ + + + + CacheDescriptionProvider Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

CacheDescriptionProvider

+
+
+ +
public protocol CacheDescriptionProvider
+ +
+
+

Interface providing access to a cache description.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + cacheDescription + +
    +
    +
    +
    +
    +
    +

    The cache description which will be used to determine if a previous +cached value is still valid given the new cache value.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    var cacheDescription: String { get }
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Protocols/CollectingRule.html b/Protocols/CollectingRule.html new file mode 100644 index 000000000..47786092d --- /dev/null +++ b/Protocols/CollectingRule.html @@ -0,0 +1,798 @@ + + + + CollectingRule Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

CollectingRule

+
+
+ +
public protocol CollectingRule : AnyCollectingRule
+ +
+
+

A rule that requires knowledge of all other files being linted.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + FileInfo + +
    +
    +
    +
    +
    +
    +

    The kind of information to collect for each file being linted for this rule.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    associatedtype FileInfo
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + collectInfo(for:compilerArguments:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Collects information for the specified file, to be analyzed by a CollectedLinter.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func collectInfo(for file: SwiftLintFile, compilerArguments: [String]) -> FileInfo
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + file + + +
    +

    The file for which to collect info.

    +
    +
    + + compilerArguments + + +
    +

    The compiler arguments needed to compile this file.

    +
    +
    +
    +
    +

    Return Value

    +

    The collected file information.

    +
    + +
    +
    +
  • +
  • +
    + + + + collectInfo(for:) + +
    +
    +
    +
    +
    +
    +

    Collects information for the specified file, to be analyzed by a CollectedLinter.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func collectInfo(for file: SwiftLintFile) -> FileInfo
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + file + + +
    +

    The file for which to collect info.

    +
    +
    +
    +
    +

    Return Value

    +

    The collected file information.

    +
    + +
    +
    +
  • +
  • +
    + + + + validate(file:collectedInfo:compilerArguments:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Executes the rule on a file after collecting file info for all files and returns any violations to the rule’s +expectations.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func validate(file: SwiftLintFile,
    +              collectedInfo: [SwiftLintFile: FileInfo],
    +              compilerArguments: [String]) -> [StyleViolation]
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + file + + +
    +

    The file for which to execute the rule.

    +
    +
    + + collectedInfo + + +
    +

    All collected info for all files.

    +
    +
    + + compilerArguments + + +
    +

    The compiler arguments needed to compile this file.

    +
    +
    +
    +
    +

    Return Value

    +

    All style violations to the rule’s expectations.

    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Executes the rule on a file after collecting file info for all files and returns any violations to the rule’s +expectations.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func validate(file: SwiftLintFile, collectedInfo: [SwiftLintFile : FileInfo]) -> [StyleViolation]
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + file + + +
    +

    The file for which to execute the rule.

    +
    +
    + + collectedInfo + + +
    +

    All collected info for all files.

    +
    +
    +
    +
    +

    Return Value

    +

    All style violations to the rule’s expectations.

    +
    + +
    +
    +
  • +
  • +
    + + + + collectInfo(for:into:compilerArguments:) + + + Extension method + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func collectInfo(for file: SwiftLintFile, into storage: RuleStorage, compilerArguments: [String])
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + validate(file:using:compilerArguments:) + + + Extension method + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func validate(file: SwiftLintFile, using storage: RuleStorage, compilerArguments: [String]) -> [StyleViolation]
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + validate(file:) + + + Extension method + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func validate(file _: SwiftLintFile) -> [StyleViolation]
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + validate(file:compilerArguments:) + + + Extension method + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func validate(file _: SwiftLintFile, compilerArguments _: [String]) -> [StyleViolation]
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Protocols/CorrectableRule.html b/Protocols/CorrectableRule.html new file mode 100644 index 000000000..fa671d7f3 --- /dev/null +++ b/Protocols/CorrectableRule.html @@ -0,0 +1,577 @@ + + + + CorrectableRule Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

CorrectableRule

+
+
+ +
public protocol CorrectableRule : Rule
+ +
+
+

A rule that can correct violations.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + correct(file:compilerArguments:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Attempts to correct the violations to this rule in the specified file.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func correct(file: SwiftLintFile, compilerArguments: [String]) -> [Correction]
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + file + + +
    +

    The file for which to correct violations.

    +
    +
    + + compilerArguments + + +
    +

    The compiler arguments needed to compile this file.

    +
    +
    +
    +
    +

    Return Value

    +

    All corrections that were applied.

    +
    + +
    +
    +
  • +
  • +
    + + + + correct(file:) + +
    +
    +
    +
    +
    +
    +

    Attempts to correct the violations to this rule in the specified file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func correct(file: SwiftLintFile) -> [Correction]
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + file + + +
    +

    The file for which to correct violations.

    +
    +
    +
    +
    +

    Return Value

    +

    All corrections that were applied.

    +
    + +
    +
    +
  • +
  • +
    + + + + correct(file:using:compilerArguments:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Attempts to correct the violations to this rule in the specified file after collecting file info for all files +and returns all corrections that were applied.

    +
    +

    Note

    +

    This function is called by the linter and is always implemented in extensions.

    + +
    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func correct(file: SwiftLintFile, using storage: RuleStorage, compilerArguments: [String]) -> [Correction]
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + file + + +
    +

    The file for which to execute the rule.

    +
    +
    + + storage + + +
    +

    The storage object containing all collected info.

    +
    +
    + + compilerArguments + + +
    +

    The compiler arguments needed to compile this file.

    +
    +
    +
    +
    +

    Return Value

    +

    All corrections that were applied.

    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Protocols/Documentable.html b/Protocols/Documentable.html new file mode 100644 index 000000000..d50dd96bf --- /dev/null +++ b/Protocols/Documentable.html @@ -0,0 +1,494 @@ + + + + Documentable Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Documentable

+
+
+ +
public protocol Documentable
+ +
+
+

A type that can be converted into a human-readable representation.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + markdown() + +
    +
    +
    +
    +
    +
    +

    Convert an object to Markdown.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func markdown() -> String
    + +
    +
    +
    +

    Return Value

    +

    A Markdown string describing the object.

    +
    + +
    +
    +
  • +
  • +
    + + + + oneLiner() + +
    +
    +
    +
    +
    +
    +

    Convert an object to a single line string.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func oneLiner() -> String
    + +
    +
    +
    +

    Return Value

    +

    A “one liner” describing the object.

    +
    + +
    +
    +
  • +
  • +
    + + + + hasContent + +
    +
    +
    +
    +
    +
    +

    Indicate if the item has some content that is useful to document.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    var hasContent: Bool { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + yaml() + +
    +
    +
    +
    +
    +
    +

    Convert an object to YAML as used in .swiftlint.yml.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func yaml() -> String
    + +
    +
    +
    +

    Return Value

    +

    A YAML snippet that can be used in configuration files.

    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Protocols/Rule.html b/Protocols/Rule.html new file mode 100644 index 000000000..210f1024f --- /dev/null +++ b/Protocols/Rule.html @@ -0,0 +1,1190 @@ + + + + Rule Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Rule

+
+
+ +
public protocol Rule
+ +
+
+

An executable value that can identify issues (violations) in Swift source code.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + ConfigurationType + +
    +
    +
    +
    +
    +
    +

    The type of the configuration used to configure this rule.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    associatedtype ConfigurationType : RuleConfiguration
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + description + +
    +
    +
    +
    +
    +
    +

    A verbose description of many of this rule’s properties.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static var description: RuleDescription { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + configuration + +
    +
    +
    +
    +
    +
    +

    This rule’s configuration.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    var configuration: ConfigurationType { get set }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + shouldLintEmptyFiles + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Whether this rule should be used on empty files. Defaults to false.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    var shouldLintEmptyFiles: Bool { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init() + +
    +
    +
    +
    +
    +
    +

    A default initializer for rules. All rules need to be trivially initializable.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    init()
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(configuration:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Creates a rule by applying its configuration.

    +
    +

    Throws

    +

    Throws if the configuration didn’t match the expected format.

    + +
    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    init(configuration: Any) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + configuration + + +
    +

    The untyped configuration value to apply.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + createConfigurationDescription(exclusiveOptions:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Create a description of how this rule has been configured to run.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func createConfigurationDescription(exclusiveOptions: Set<String>) -> RuleConfigurationDescription
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + validate(file:compilerArguments:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Executes the rule on a file and returns any violations to the rule’s expectations.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func validate(file: SwiftLintFile, compilerArguments: [String]) -> [StyleViolation]
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + file + + +
    +

    The file for which to execute the rule.

    +
    +
    + + compilerArguments + + +
    +

    The compiler arguments needed to compile this file.

    +
    +
    +
    +
    +

    Return Value

    +

    All style violations to the rule’s expectations.

    +
    + +
    +
    +
  • +
  • +
    + + + + validate(file:) + +
    +
    +
    +
    +
    +
    +

    Executes the rule on a file and returns any violations to the rule’s expectations.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func validate(file: SwiftLintFile) -> [StyleViolation]
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + file + + +
    +

    The file for which to execute the rule.

    +
    +
    +
    +
    +

    Return Value

    +

    All style violations to the rule’s expectations.

    +
    + +
    +
    +
  • +
  • +
    + + + + isEqualTo(_:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Whether or not the specified rule is equivalent to the current rule.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func isEqualTo(_ rule: any Rule) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + rule + + +
    +

    The rule value to compare against.

    +
    +
    +
    +
    +

    Return Value

    +

    Whether or not the specified rule is equivalent to the current rule.

    +
    + +
    +
    +
  • +
  • +
    + + + + collectInfo(for:into:compilerArguments:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Collects information for the specified file in a storage object, to be analyzed by a CollectedLinter.

    +
    +

    Note

    +

    This function is called by the linter and is always implemented in extensions.

    + +
    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func collectInfo(for file: SwiftLintFile, into storage: RuleStorage, compilerArguments: [String])
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + file + + +
    +

    The file for which to collect info.

    +
    +
    + + storage + + +
    +

    The storage object where collected info should be saved.

    +
    +
    + + compilerArguments + + +
    +

    The compiler arguments needed to compile this file.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + validate(file:using:compilerArguments:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Executes the rule on a file after collecting file info for all files and returns any violations to the rule’s +expectations.

    +
    +

    Note

    +

    This function is called by the linter and is always implemented in extensions.

    + +
    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func validate(file: SwiftLintFile, using storage: RuleStorage, compilerArguments: [String]) -> [StyleViolation]
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + file + + +
    +

    The file for which to execute the rule.

    +
    +
    + + storage + + +
    +

    The storage object containing all collected info.

    +
    +
    + + compilerArguments + + +
    +

    The compiler arguments needed to compile this file.

    +
    +
    +
    +
    +

    Return Value

    +

    All style violations to the rule’s expectations.

    +
    + +
    +
    +
  • +
  • +
    + + + + canBeDisabled(violation:by:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Checks if a style violation can be disabled by a command specifying a rule ID. Only the rule can claim that for +sure since it knows all the possible identifiers.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func canBeDisabled(violation: StyleViolation, by ruleID: RuleIdentifier) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + violation + + +
    +

    A style violation.

    +
    +
    + + ruleID + + +
    +

    The name of a rule as used in a disable command.

    +
    +
    +
    +
    +

    Return Value

    +

    A boolean value indicating whether the violation can be disabled by the given ID.

    +
    + +
    +
    +
  • +
  • +
    + + + + isEnabled(in:for:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Checks if a the rule is enabled in a given region. A specific rule ID can be provided in case a rule supports +more than one identifier.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func isEnabled(in region: Region, for ruleID: String) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + region + + +
    +

    The region to check.

    +
    +
    + + ruleID + + +
    +

    Rule identifier deviating from the default rule’s name.

    +
    +
    +
    +
    +

    Return Value

    +

    A boolean value indicating whether the rule is enabled in the given region.

    +
    + +
    +
    +
  • +
  • +
    + + + + cacheDescription + + + Extension method + +
    +
    +
    +
    +
    +
    +

    The cache description which will be used to determine if a previous +cached value is still valid given the new cache value.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    var cacheDescription: String { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + identifier + + + Extension method + +
    +
    +
    +
    +
    +
    +

    The rule’s unique identifier which is the same as Rule.description.identifier.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static var identifier: String { get }
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Protocols/RuleConfiguration.html b/Protocols/RuleConfiguration.html new file mode 100644 index 000000000..5ebacbece --- /dev/null +++ b/Protocols/RuleConfiguration.html @@ -0,0 +1,555 @@ + + + + RuleConfiguration Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

RuleConfiguration

+
+
+ +
public protocol RuleConfiguration : Equatable
+ +
+
+

A configuration value for a rule to allow users to modify its behavior.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + Parent + +
    +
    +
    +
    +
    +
    +

    The type of the rule that’s using this configuration.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    associatedtype Parent : Rule
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + parameterDescription + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    A description for this configuration’s parameters. It can be built using the annotated result builder.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @RuleConfigurationDescriptionBuilder
    +var parameterDescription: RuleConfigurationDescription? { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + apply(configuration:) + +
    +
    +
    +
    +
    +
    +

    Apply an untyped configuration to the current value.

    +
    +

    Throws

    +

    Throws if the configuration is not in the expected format.

    + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    mutating func apply(configuration: Any) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + configuration + + +
    +

    The untyped configuration value to apply.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + validate() + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Run a sanity check on the configuration, perform optional postprocessing steps and/or warn about potential +issues.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    mutating func validate() throws
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + supportedKeys + + + Extension method + +
    +
    +
    +
    +
    +
    +

    All keys supported by this configuration.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    var supportedKeys: Set<String> { get }
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Protocols/SeverityBasedRuleConfiguration.html b/Protocols/SeverityBasedRuleConfiguration.html new file mode 100644 index 000000000..cced7a5c2 --- /dev/null +++ b/Protocols/SeverityBasedRuleConfiguration.html @@ -0,0 +1,425 @@ + + + + SeverityBasedRuleConfiguration Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

SeverityBasedRuleConfiguration

+
+
+ +
public protocol SeverityBasedRuleConfiguration : RuleConfiguration
+ +
+
+

A configuration for a rule that allows to configure at least the severity.

+ + +
+
+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/Protocols/SubstitutionCorrectableRule.html b/Protocols/SubstitutionCorrectableRule.html new file mode 100644 index 000000000..6da1e08f3 --- /dev/null +++ b/Protocols/SubstitutionCorrectableRule.html @@ -0,0 +1,513 @@ + + + + SubstitutionCorrectableRule Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

SubstitutionCorrectableRule

+
+
+ +
public protocol SubstitutionCorrectableRule : CorrectableRule
+ +
+
+

A correctable rule that can apply its corrections by replacing the content of ranges in the offending file with +updated content.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + violationRanges(in:) + +
    +
    +
    +
    +
    +
    +

    Returns the NSString-based NSRanges to be replaced in the specified file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func violationRanges(in file: SwiftLintFile) -> [NSRange]
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + file + + +
    +

    The file in which to find ranges of violations for this rule.

    +
    +
    +
    +
    +

    Return Value

    +

    The NSString-based NSRanges to be replaced in the specified file.

    +
    + +
    +
    +
  • +
  • +
    + + + + substitution(for:in:) + +
    +
    +
    +
    +
    +
    +

    Returns the substitution to apply for the given range.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func substitution(for violationRange: NSRange, in file: SwiftLintFile) -> (NSRange, String)?
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + violationRange + + +
    +

    The NSString-based NSRange of the violation that should be replaced.

    +
    +
    + + file + + +
    +

    The file in which the violation should be replaced.

    +
    +
    +
    +
    +

    Return Value

    +

    The range of the correction and its contents, if one could be computed.

    +
    + +
    +
    +
  • +
  • +
    + + + + correct(file:) + + + Extension method + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func correct(file: SwiftLintFile) -> [Correction]
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Protocols/SwiftSyntaxCorrectableRule.html b/Protocols/SwiftSyntaxCorrectableRule.html new file mode 100644 index 000000000..55cc7f575 --- /dev/null +++ b/Protocols/SwiftSyntaxCorrectableRule.html @@ -0,0 +1,455 @@ + + + + SwiftSyntaxCorrectableRule Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

SwiftSyntaxCorrectableRule

+
+
+ +
public protocol SwiftSyntaxCorrectableRule : CorrectableRule, SwiftSyntaxRule
+ +
+
+

A SwiftLint CorrectableRule that performs its corrections using a SwiftSyntax SyntaxRewriter.

+ + +
+
+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/Protocols/SwiftSyntaxRule.html b/Protocols/SwiftSyntaxRule.html new file mode 100644 index 000000000..45798e3f4 --- /dev/null +++ b/Protocols/SwiftSyntaxRule.html @@ -0,0 +1,583 @@ + + + + SwiftSyntaxRule Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

SwiftSyntaxRule

+
+
+ +
public protocol SwiftSyntaxRule : SourceKitFreeRule
+ +
+
+

A SwiftLint Rule backed by SwiftSyntax that does not use SourceKit requests.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + makeVisitor(file:) + +
    +
    +
    +
    +
    +
    +

    Produce a ViolationsSyntaxVisitor for the given file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func makeVisitor(file: SwiftLintFile) -> ViolationsSyntaxVisitor<ConfigurationType>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + file + + +
    +

    The file for which to produce the visitor.

    +
    +
    +
    +
    +

    Return Value

    +

    A ViolationsSyntaxVisitor for the given file.

    +
    + +
    +
    +
  • +
  • +
    + + + + makeViolation(file:violation:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Produce a violation for the given file and absolute position.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func makeViolation(file: SwiftLintFile, violation: ReasonedRuleViolation) -> StyleViolation
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + file + + +
    +

    The file for which to produce the violation.

    +
    +
    + + violation + + +
    +

    A violation in the file.

    +
    +
    +
    +
    +

    Return Value

    +

    A violation for the given file and absolute position.

    +
    + +
    +
    +
  • +
  • +
    + + + + preprocess(file:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Gives a chance for the rule to do some pre-processing on the syntax tree. +One typical example is using SwiftOperators to “fold” the tree, resolving operators precedence. +This can also be used to skip validation in a given file. +By default, it just returns the file’s syntaxTree.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func preprocess(file: SwiftLintFile) -> SourceFileSyntax?
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + file + + +
    +

    The file to run pre-processing on.

    +
    +
    +
    +
    +

    Return Value

    +

    The tree that will be used to check for violations. If nil, this rule will return no violations.

    +
    + +
    +
    +
  • +
  • +
    + + + + validate(file:) + + + Extension method + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @inlinable
    +func validate(file: SwiftLintFile) -> [StyleViolation]
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Protocols/VersionComparable.html b/Protocols/VersionComparable.html new file mode 100644 index 000000000..115f94542 --- /dev/null +++ b/Protocols/VersionComparable.html @@ -0,0 +1,456 @@ + + + + VersionComparable Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

VersionComparable

+
+
+ +
public protocol VersionComparable : Comparable
+ +
+
+

A comparable major.minor.patch version number.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + rawValue + +
    +
    +
    +
    +
    +
    +

    The version string.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    var rawValue: String { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + ==(_:_:) + + + Extension method + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func == (lhs: Self, rhs: Self) -> Bool
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + <(_:_:) + + + Extension method + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func < (lhs: Self, rhs: Self) -> Bool
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Rules.html b/Rules.html new file mode 100644 index 000000000..5aa949c35 --- /dev/null +++ b/Rules.html @@ -0,0 +1,358 @@ + + + + Rules Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Rules

+ +
+
+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/Structs.html b/Structs.html new file mode 100644 index 000000000..b91e5fb74 --- /dev/null +++ b/Structs.html @@ -0,0 +1,1152 @@ + + + + Structures Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Structures

+

The following structures are available globally.

+ +
+
+ +
+
+
+
    +
  • +
    + + + + Stack + +
    +
    +
    +
    +
    +
    +

    A basic stack type implementing the LIFO principle - only the last inserted element can be accessed and removed.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct Stack<Element>
    +
    extension Stack: Sequence
    +
    extension Stack: CustomDebugStringConvertible where Element: CustomDebugStringConvertible
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + Baseline + +
    +
    +
    +
    +
    +
    +

    A set of violations that can be used to filter newly detected violations.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct Baseline : Equatable
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    A rule configuration that allows to disable (off) an option of a rule or specify its severity level in which +case it’s active.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct ChildOptionSeverityConfiguration<Parent: Rule>: RuleConfiguration,
    +                                                              AcceptableByConfigurationElement,
    +                                                              Sendable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + Command + +
    +
    +
    +
    +
    +
    +

    A SwiftLint-interpretable command to modify SwiftLint’s behavior embedded as comments in source code.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct Command : Equatable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + Correction + +
    +
    +
    +
    +
    +
    +

    A value describing a SwiftLint violation that was corrected.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct Correction : Equatable, Sendable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + Example + +
    +
    +
    +
    +
    +
    +

    Captures code and context information for an example of a triggering or +non-triggering style

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct Example : Sendable
    +
    extension Example: Hashable
    +
    extension Example: Comparable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + Location + +
    +
    +
    +
    +
    +
    +

    The placement of a segment of Swift in a collection of source files.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct Location : CustomStringConvertible, Comparable, Codable, Sendable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + Region + +
    +
    +
    +
    +
    +
    +

    A contiguous region of Swift source code.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct Region : Equatable, Sendable
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Description of a rule configuration.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct RuleConfigurationDescription : Equatable, Sendable
    +
    extension RuleConfigurationDescription: Documentable
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    A single option of a RuleConfigurationDescription.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct RuleConfigurationOption : Equatable, Sendable
    +
    extension RuleConfigurationOption: Documentable
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Result builder +

+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    A result builder creating configuration descriptions.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @resultBuilder
    +public struct RuleConfigurationDescriptionBuilder
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Property wrapper +

+
+
+
    +
  • +
    + + + + ConfigurationElement + +
    +
    +
    +
    +
    +
    +

    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. +
    3. 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 +
    4. +
    5. 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 +
    6. +
    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @propertyWrapper
    +public struct ConfigurationElement<T> : Equatable, Sendable where T : Equatable, T : Sendable, T : AcceptableByConfigurationElement
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + SeverityConfiguration + +
    +
    +
    +
    +
    +
    +

    A rule configuration that allows specifying the desired severity level for violations.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct SeverityConfiguration<Parent> : SeverityBasedRuleConfiguration, InlinableOptionType, Sendable where Parent : Rule
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + RuleDescription + +
    +
    +
    +
    +
    +
    +

    A detailed description for a SwiftLint rule. Used for both documentation and testing purposes.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct RuleDescription : Equatable, Sendable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + RuleList + +
    +
    +
    +
    +
    +
    +

    A list of available SwiftLint rules.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct RuleList
    +
    extension RuleList: Equatable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + RuleParameter + +
    +
    +
    +
    +
    +
    +

    A configuration parameter for rules.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct RuleParameter<T> : Equatable where T : Equatable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + StyleViolation + +
    +
    +
    +
    +
    +
    +

    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
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + SwiftLintSyntaxMap + +
    +
    +
    +
    +
    +
    +

    Represents a Swift file’s syntax information.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct SwiftLintSyntaxMap
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + SwiftLintSyntaxToken + +
    +
    +
    +
    +
    +
    +

    A SwiftLint-aware Swift syntax token.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct SwiftLintSyntaxToken
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + SwiftVersion + +
    +
    +
    +
    +
    +
    +

    A value describing the version of the Swift compiler.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct SwiftVersion : RawRepresentable, Codable, VersionComparable, Sendable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + ReasonedRuleViolation + +
    +
    +
    +
    +
    +
    +

    A violation produced by ViolationsSyntaxVisitors.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct ReasonedRuleViolation : Comparable, Hashable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + RegexConfiguration + +
    +
    +
    +
    +
    +
    +

    A rule configuration used for defining custom rules in yaml.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct RegexConfiguration<Parent: Rule>: SeverityBasedRuleConfiguration, Hashable,
    +                                                CacheDescriptionProvider, InlinableOptionType
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    A rule configuration that allows specifying thresholds for warning and error severities.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct SeverityLevelsConfiguration<Parent> : RuleConfiguration, InlinableOptionType, Sendable where Parent : Rule
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/Baseline.html b/Structs/Baseline.html new file mode 100644 index 000000000..5a8f4e46b --- /dev/null +++ b/Structs/Baseline.html @@ -0,0 +1,645 @@ + + + + Baseline Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Baseline

+
+
+ +
public struct Baseline : Equatable
+ +
+
+

A set of violations that can be used to filter newly detected violations.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + violations + +
    +
    +
    +
    +
    +
    +

    The stored violations.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var violations: [StyleViolation] { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(fromPath:) + +
    +
    +
    +
    +
    +
    +

    Creates a Baseline from a saved file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(fromPath path: String) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + fromPath + + +
    +

    The path to read from.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(violations:) + +
    +
    +
    +
    +
    +
    +

    Creates a Baseline from a list of violations.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(violations: [StyleViolation])
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + violations + + +
    +

    The violations for the baseline.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + write(toPath:) + +
    +
    +
    +
    +
    +
    +

    Writes a Baseline to disk in JSON format.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func write(toPath path: String) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + toPath + + +
    +

    The path to write to.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + filter(_:) + +
    +
    +
    +
    +
    +
    +

    Filters out violations that are present in the Baseline.

    + +

    Assumes that all violations are from the same file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func filter(_ violations: [StyleViolation]) -> [StyleViolation]
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + violations + + +
    +

    The violations to filter.

    +
    +
    +
    +
    +

    Return Value

    +

    The new violations.

    +
    + +
    +
    +
  • +
  • +
    + + + + compare(_:) + +
    +
    +
    +
    +
    +
    +

    Returns the violations that are present in another Baseline, but not in this one.

    + +

    The violations are filtered using the same algorithm as the filter method above.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func compare(_ otherBaseline: `Self`) -> [StyleViolation]
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + otherBaseline + + +
    +

    The other Baseline.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/ChildOptionSeverityConfiguration.html b/Structs/ChildOptionSeverityConfiguration.html new file mode 100644 index 000000000..36dfe07a6 --- /dev/null +++ b/Structs/ChildOptionSeverityConfiguration.html @@ -0,0 +1,544 @@ + + + + ChildOptionSeverityConfiguration Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

ChildOptionSeverityConfiguration

+
+
+ +
public struct ChildOptionSeverityConfiguration<Parent: Rule>: RuleConfiguration,
+                                                              AcceptableByConfigurationElement,
+                                                              Sendable
+ +
+
+

A rule configuration that allows to disable (off) an option of a rule or specify its severity level in which +case it’s active.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + error + +
    +
    +
    +
    +
    +
    +

    Configuration with a warning severity.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static var error: `Self` { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + warning + +
    +
    +
    +
    +
    +
    +

    Configuration with an error severity.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static var warning: `Self` { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + off + +
    +
    +
    +
    +
    +
    +

    Configuration disabling an option.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static var off: `Self` { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + severity + +
    +
    +
    +
    +
    +
    +

    The ChildOptionSeverityConfiguration mapped to a usually used ViolationSeverity. It’s nil if the option +is set to off.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var severity: ViolationSeverity? { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + apply(configuration:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public mutating func apply(configuration: Any) throws
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + asOption() + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func asOption() -> OptionType
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/Command.html b/Structs/Command.html new file mode 100644 index 000000000..befd2f746 --- /dev/null +++ b/Structs/Command.html @@ -0,0 +1,763 @@ + + + + Command Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Command

+
+
+ +
public struct Command : Equatable
+ +
+
+

A SwiftLint-interpretable command to modify SwiftLint’s behavior embedded as comments in source code.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + Action + +
    +
    +
    +
    +
    +
    +

    The action (verb) that SwiftLint should perform when interpreting this command.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum Action : String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + Modifier + +
    +
    +
    +
    +
    +
    +

    The modifier for a command, used to modify its scope.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum Modifier : String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + action + +
    +
    +
    +
    +
    +
    +

    The action (verb) that SwiftLint should perform when interpreting this command.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let action: Action
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + ruleIdentifiers + +
    +
    +
    +
    +
    +
    +

    The identifiers for the rules associated with this command.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let ruleIdentifiers: Set<RuleIdentifier>
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + line + +
    +
    +
    +
    +
    +
    +

    The line in the source file where this command is defined.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let line: Int
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + character + +
    +
    +
    +
    +
    +
    +

    The character offset within the line in the source file where this command is defined.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let character: Int?
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + modifier + +
    +
    +
    +
    +
    +
    +

    This command’s modifier, if any.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let modifier: Modifier?
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a command based on the specified parameters.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(action: Action,
    +            ruleIdentifiers: Set<RuleIdentifier> = [],
    +            line: Int = 0,
    +            character: Int? = nil,
    +            modifier: Modifier? = nil,
    +            trailingComment: String? = nil)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + action + + +
    +

    This command’s action.

    +
    +
    + + ruleIdentifiers + + +
    +

    The identifiers for the rules associated with this command.

    +
    +
    + + line + + +
    +

    The line in the source file where this command is defined.

    +
    +
    + + character + + +
    +

    The character offset within the line in the source file where this command is + defined.

    +
    +
    + + modifier + + +
    +

    This command’s modifier, if any.

    +
    +
    + + trailingComment + + +
    +

    The comment following this command’s - delimiter, if any.

    +
    +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a command based on the specified parameters.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(actionString: String, line: Int, character: Int)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + actionString + + +
    +

    The string in the command’s definition describing its action.

    +
    +
    + + line + + +
    +

    The line in the source file where this command is defined.

    +
    +
    + + character + + +
    +

    The character offset within the line in the source file where this command is + defined.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/Command/Action.html b/Structs/Command/Action.html new file mode 100644 index 000000000..a8feb5c9f --- /dev/null +++ b/Structs/Command/Action.html @@ -0,0 +1,454 @@ + + + + Action Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Action

+
+
+ +
public enum Action : String
+ +
+
+

The action (verb) that SwiftLint should perform when interpreting this command.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + enable + +
    +
    +
    +
    +
    +
    +

    The rule(s) associated with this command should be enabled by the SwiftLint engine.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case enable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + disable + +
    +
    +
    +
    +
    +
    +

    The rule(s) associated with this command should be disabled by the SwiftLint engine.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case disable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + invalid + +
    +
    +
    +
    +
    +
    +

    The action string was invalid.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case invalid
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/Command/Modifier.html b/Structs/Command/Modifier.html new file mode 100644 index 000000000..a0ada1d49 --- /dev/null +++ b/Structs/Command/Modifier.html @@ -0,0 +1,484 @@ + + + + Modifier Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Modifier

+
+
+ +
public enum Modifier : String
+ +
+
+

The modifier for a command, used to modify its scope.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + previous + +
    +
    +
    +
    +
    +
    +

    The command should only apply to the line preceding its definition.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case previous
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + this + +
    +
    +
    +
    +
    +
    +

    The command should only apply to the same line as its definition.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case this
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + next + +
    +
    +
    +
    +
    +
    +

    The command should only apply to the line following its definition.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case next
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + invalid + +
    +
    +
    +
    +
    +
    +

    The modifier string was invalid.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case invalid
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/ConfigurationElement.html b/Structs/ConfigurationElement.html new file mode 100644 index 000000000..b60118411 --- /dev/null +++ b/Structs/ConfigurationElement.html @@ -0,0 +1,858 @@ + + + + ConfigurationElement Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

ConfigurationElement

+
+
+ +
@propertyWrapper
+public struct ConfigurationElement<T> : Equatable, Sendable where T : Equatable, T : Sendable, T : AcceptableByConfigurationElement
+ +
+
+

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. +
  3. 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 +
  4. +
  5. 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 +
  6. +
+ + +
+
+ +
+
+
+
    +
  • +
    + + + + DeprecationNotice + +
    +
    +
    +
    +
    +
    +

    A deprecation notice.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum DeprecationNotice : Sendable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + wrappedValue + +
    +
    +
    +
    +
    +
    +

    Wrapped option value.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var wrappedValue: T { get set }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + projectedValue + +
    +
    +
    +
    +
    +
    +

    The wrapper itself providing access to all its data. This field can only be accessed by the +element’s name prefixed with a $.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var projectedValue: `Self` { get set }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + key + +
    +
    +
    +
    +
    +
    +

    Name of this configuration entry.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var key: String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + inline + +
    +
    +
    +
    +
    +
    +

    Whether this configuration element will be inlined into its description.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let inline: Bool
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Default constructor.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(wrappedValue value: T,
    +            key: String,
    +            deprecationNotice: DeprecationNotice? = nil,
    +            postprocessor: @escaping @Sendable (inout T) -> Void = { _ in })
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + +
    + + value + + +
    +

    Value to be wrapped.

    +
    +
    + + key + + +
    +

    Optional name of the option. If not specified, it will be inferred from the attributed property.

    +
    +
    + + deprecationNotice + + +
    +

    An optional deprecation notice in case an option is outdated and/or has been replaced by + an alternative.

    +
    +
    + + postprocessor + + +
    +

    Function to be applied to the wrapped value after parsing to validate and modify it.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(key:) + +
    +
    +
    +
    +
    +
    +

    Constructor for optional values.

    + +

    It allows to skip explicit initialization of the property with nil.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init<Wrapped>(key: String) where T == Wrapped?, Wrapped : Equatable, Wrapped : Sendable, Wrapped : AcceptableByConfigurationElement
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + key + + +
    +

    Optional name of the option. If not specified, it will be inferred from the attributed property.

    +
    +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Constructor for an InlinableOptionType without a key.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(wrappedValue value: T, inline: Bool) where T : InlinableOptionType
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + value + + +
    +

    Value to be wrapped.

    +
    +
    + + inline + + +
    +

    If true, the option will be handled as it would be part of its parent. All of its options + will be inlined. Otherwise, it will be treated as a normal nested configuration with its name + inferred from the name of the attributed property.

    +
    +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Constructor for an InlinableOptionType with a name. The configuration will explicitly not be inlined.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(wrappedValue value: T, key: String) where T : InlinableOptionType
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + value + + +
    +

    Value to be wrapped.

    +
    +
    + + key + + +
    +

    Name of the option.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + ==(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func == (lhs: `Self`, rhs: `Self`) -> Bool
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/ConfigurationElement/DeprecationNotice.html b/Structs/ConfigurationElement/DeprecationNotice.html new file mode 100644 index 000000000..00a20f4a7 --- /dev/null +++ b/Structs/ConfigurationElement/DeprecationNotice.html @@ -0,0 +1,394 @@ + + + + DeprecationNotice Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

DeprecationNotice

+
+
+ +
public enum DeprecationNotice : Sendable
+ +
+
+

A deprecation notice.

+ + +
+
+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/Structs/Correction.html b/Structs/Correction.html new file mode 100644 index 000000000..729959541 --- /dev/null +++ b/Structs/Correction.html @@ -0,0 +1,513 @@ + + + + Correction Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Correction

+
+
+ +
public struct Correction : Equatable, Sendable
+ +
+
+

A value describing a SwiftLint violation that was corrected.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + ruleDescription + +
    +
    +
    +
    +
    +
    +

    The description of the rule for which this correction was applied.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let ruleDescription: RuleDescription
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + location + +
    +
    +
    +
    +
    +
    +

    The location of the original violation that was corrected.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let location: Location
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + consoleDescription + +
    +
    +
    +
    +
    +
    +

    The console-printable description for this correction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var consoleDescription: String { get }
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Memberwise initializer.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(ruleDescription: RuleDescription, location: Location)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + ruleDescription + + +
    +

    The description of the rule for which this correction was applied.

    +
    +
    + + location + + +
    +

    The location of the original violation that was corrected.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/Example.html b/Structs/Example.html new file mode 100644 index 000000000..9ca029b21 --- /dev/null +++ b/Structs/Example.html @@ -0,0 +1,911 @@ + + + + Example Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Example

+
+
+ +
public struct Example : Sendable
+
extension Example: Hashable
+
extension Example: Comparable
+ +
+
+

Captures code and context information for an example of a triggering or +non-triggering style

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + code + +
    +
    +
    +
    +
    +
    +

    The contents of the example

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public private(set) var code: String { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + configuration + +
    +
    +
    +
    +
    +
    +

    The untyped configuration to apply to the rule, if deviating from the default configuration. +The structure should match what is expected as a configuration value for the rule being tested.

    + +

    For example, if the following YAML would be used to configure the rule:

    +
    severity: warning
    +
    + +

    Then the equivalent configuration value would be ["severity": "warning"].

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public private(set) var configuration: [String : any Sendable]? { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + testMultiByteOffsets + +
    +
    +
    +
    +
    +
    +

    Whether the example should be tested by prepending multibyte grapheme clusters

    +
    +

    See also

    + addEmoji(_:) + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public private(set) var testMultiByteOffsets: Bool { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + testOnLinux + +
    +
    +
    +
    +
    +
    +

    Whether the example should be tested on Linux

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public private(set) var testOnLinux: Bool { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + file + +
    +
    +
    +
    +
    +
    +

    The path to the file where the example was created

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public private(set) var file: StaticString { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + line + +
    +
    +
    +
    +
    +
    +

    The line in the file where the example was created

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var line: UInt
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Create a new Example with the specified code, file, and line.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    init(_ code: String,
    +     configuration: [String: any Sendable]? = nil,
    +     testMultiByteOffsets: Bool = true,
    +     testWrappingInComment: Bool = true,
    +     testWrappingInString: Bool = true,
    +     testDisableCommand: Bool = true,
    +     testOnLinux: Bool = true,
    +     file: StaticString = #filePath,
    +     line: UInt = #line,
    +     excludeFromDocumentation: Bool = false)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + code + + +
    +

    The contents of the example.

    +
    +
    + + configuration + + +
    +

    The untyped configuration to apply to the rule, if deviating from the default + configuration.

    +
    +
    + + testMultibyteOffsets + + +
    +

    Whether the example should be tested by prepending multibyte grapheme clusters.

    +
    +
    + + testWrappingInComment + + +
    +

    Whether test shall verify that the example wrapped in a comment doesn’t trigger.

    +
    +
    + + testWrappingInString + + +
    +

    Whether tests shall verify that the example wrapped into a string doesn’t trigger.

    +
    +
    + + testDisableCommand + + +
    +

    Whether tests shall verify that the disabled rule (comment in the example) doesn’t + trigger.

    +
    +
    + + testOnLinux + + +
    +

    Whether the example should be tested on Linux.

    +
    +
    + + file + + +
    +

    The path to the file where the example is located. + Defaults to the file where this initializer is called.

    +
    +
    + + line + + +
    +

    The line in the file where the example is located. + Defaults to the line where this initializer is called.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + with(code:) + +
    +
    +
    +
    +
    +
    +

    Returns the same example, but with the code that is passed in

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func with(code: String) -> Example
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + code + + +
    +

    the new code to use in the modified example

    +
    +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Returns a copy of the Example with all instances of the “↓” character removed.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func removingViolationMarkers() -> Example
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + focused() + +
    +
    +
    +
    +
    +
    +

    Makes the current example focused. This is for debugging purposes only.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func focused() -> Example
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + ==(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func == (lhs: Example, rhs: Example) -> Bool
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + hash(into:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func hash(into hasher: inout Hasher)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + <(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func < (lhs: Example, rhs: Example) -> Bool
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/Location.html b/Structs/Location.html new file mode 100644 index 000000000..0ed9edba6 --- /dev/null +++ b/Structs/Location.html @@ -0,0 +1,813 @@ + + + + Location Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Location

+
+
+ +
public struct Location : CustomStringConvertible, Comparable, Codable, Sendable
+ +
+
+

The placement of a segment of Swift in a collection of source files.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + file + +
    +
    +
    +
    +
    +
    +

    The file path on disk for this location.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let file: String?
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + line + +
    +
    +
    +
    +
    +
    +

    The line offset in the file for this location. 1-indexed.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let line: Int?
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + character + +
    +
    +
    +
    +
    +
    +

    The character offset in the file for this location. 1-indexed.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let character: Int?
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + description + +
    +
    +
    +
    +
    +
    +

    A lossless printable description of this location.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var description: String { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + relativeFile + +
    +
    +
    +
    +
    +
    +

    The file path for this location relative to the current working directory.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var relativeFile: String? { get }
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a Location by specifying its properties directly.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(file: String?, line: Int? = nil, character: Int? = nil)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + file + + +
    +

    The file path on disk for this location.

    +
    +
    + + line + + +
    +

    The line offset in the file for this location. 1-indexed.

    +
    +
    + + character + + +
    +

    The character offset in the file for this location. 1-indexed.

    +
    +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a Location based on a SwiftLintFile and a byte-offset into the file. +Fails if the specified offset was not a valid location in the file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(file: SwiftLintFile, byteOffset offset: ByteCount)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + file + + +
    +

    The file for this location.

    +
    +
    + + offset + + +
    +

    The offset in bytes into the file for this location.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(file:position:) + +
    +
    +
    +
    +
    +
    +

    Creates a Location based on a SwiftLintFile and a SwiftSyntax AbsolutePosition into the file. +Fails if the specified offset was not a valid location in the file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(file: SwiftLintFile, position: AbsolutePosition)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + file + + +
    +

    The file for this location.

    +
    +
    + + position + + +
    +

    The absolute position returned from SwiftSyntax.

    +
    +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a Location based on a SwiftLintFile and a UTF8 character-offset into the file. +Fails if the specified offset was not a valid location in the file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(file: SwiftLintFile, characterOffset offset: Int)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + file + + +
    +

    The file for this location.

    +
    +
    + + offset + + +
    +

    The offset in UTF8 fragments into the file for this location.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Comparable +

+
+
+
    +
  • +
    + + + + <(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func < (lhs: `Self`, rhs: `Self`) -> Bool
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/ReasonedRuleViolation.html b/Structs/ReasonedRuleViolation.html new file mode 100644 index 000000000..e01953c93 --- /dev/null +++ b/Structs/ReasonedRuleViolation.html @@ -0,0 +1,632 @@ + + + + ReasonedRuleViolation Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

ReasonedRuleViolation

+
+
+ +
public struct ReasonedRuleViolation : Comparable, Hashable
+ +
+
+

A violation produced by ViolationsSyntaxVisitors.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + ViolationCorrection + +
    +
    +
    +
    +
    +
    +

    The correction of a violation that is basically the violation’s range in the source code and a +replacement for this range that would fix the violation.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct ViolationCorrection : Hashable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + position + +
    +
    +
    +
    +
    +
    +

    The violation’s position.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let position: AbsolutePosition
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + reason + +
    +
    +
    +
    +
    +
    +

    A specific reason for the violation.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let reason: String?
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + severity + +
    +
    +
    +
    +
    +
    +

    The violation’s severity.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let severity: ViolationSeverity?
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + correction + +
    +
    +
    +
    +
    +
    +

    An optional correction of the violation to be used in rewriting (see SwiftSyntaxCorrectableRule). Can be +left unset when creating a violation, especially if the rule is not correctable or provides a custom rewriter.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let correction: ViolationCorrection?
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a ReasonedRuleViolation.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(position: AbsolutePosition,
    +            reason: String? = nil,
    +            severity: ViolationSeverity? = nil,
    +            correction: ViolationCorrection? = nil)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + +
    + + position + + +
    +

    The violations position in the analyzed source file.

    +
    +
    + + reason + + +
    +

    The reason for the violation if different from the rule’s description.

    +
    +
    + + severity + + +
    +

    The severity of the violation if different from the rule’s default configured severity.

    +
    +
    + + correction + + +
    +

    An optional correction of the violation to be used in rewriting.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + <(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func < (lhs: `Self`, rhs: `Self`) -> Bool
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/ReasonedRuleViolation/ViolationCorrection.html b/Structs/ReasonedRuleViolation/ViolationCorrection.html new file mode 100644 index 000000000..b82b9b592 --- /dev/null +++ b/Structs/ReasonedRuleViolation/ViolationCorrection.html @@ -0,0 +1,438 @@ + + + + ViolationCorrection Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

ViolationCorrection

+
+
+ +
public struct ViolationCorrection : Hashable
+ +
+
+

The correction of a violation that is basically the violation’s range in the source code and a +replacement for this range that would fix the violation.

+ + +
+
+ +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    Create a ViolationCorrection.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(start: AbsolutePosition, end: AbsolutePosition, replacement: String)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + start + + +
    +

    Start position of the violation range.

    +
    +
    + + end + + +
    +

    End position of the violation range.

    +
    +
    + + replacement + + +
    +

    Replacement for the violating range.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/RegexConfiguration.html b/Structs/RegexConfiguration.html new file mode 100644 index 000000000..10d44e97b --- /dev/null +++ b/Structs/RegexConfiguration.html @@ -0,0 +1,770 @@ + + + + RegexConfiguration Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

RegexConfiguration

+
+
+ +
public struct RegexConfiguration<Parent: Rule>: SeverityBasedRuleConfiguration, Hashable,
+                                                CacheDescriptionProvider, InlinableOptionType
+ +
+
+

A rule configuration used for defining custom rules in yaml.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + identifier + +
    +
    +
    +
    +
    +
    +

    The identifier for this custom rule.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let identifier: String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + name + +
    +
    +
    +
    +
    +
    +

    The name for this custom rule.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var name: String?
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + message + +
    +
    +
    +
    +
    +
    +

    The message to be presented when producing violations.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var message: String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + included + +
    +
    +
    +
    +
    +
    +

    Regular expressions to include when matching the file path.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var included: [RegularExpression]
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + excluded + +
    +
    +
    +
    +
    +
    +

    Regular expressions to exclude when matching the file path.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var excluded: [RegularExpression]
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + excludedMatchKinds + +
    +
    +
    +
    +
    +
    +

    The syntax kinds to exclude from matches. If the regex matched syntax kinds from this list, it would +be ignored and not count as a rule violation.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var excludedMatchKinds: Set<SyntaxKind>
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + severityConfiguration + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @ConfigurationElement
    +public var severityConfiguration: SeverityConfiguration<Parent> { get set }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + captureGroup + +
    +
    +
    +
    +
    +
    +

    The index of the regex capture group to match.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var captureGroup: Int
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + cacheDescription + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var cacheDescription: String { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + description + +
    +
    +
    +
    +
    +
    +

    The RuleDescription for the custom rule defined here.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var description: RuleDescription { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(identifier:) + +
    +
    +
    +
    +
    +
    +

    Create a RegexConfiguration with the specified identifier, with other properties to be set later.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(identifier: String)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + identifier + + +
    +

    The rule identifier to use.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + apply(configuration:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public mutating func apply(configuration: Any) throws
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + hash(into:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func hash(into hasher: inout Hasher)
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/Region.html b/Structs/Region.html new file mode 100644 index 000000000..1439663ae --- /dev/null +++ b/Structs/Region.html @@ -0,0 +1,800 @@ + + + + Region Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Region

+
+
+ +
public struct Region : Equatable, Sendable
+ +
+
+

A contiguous region of Swift source code.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + start + +
    +
    +
    +
    +
    +
    +

    The location describing the start of the region. All locations that are less than this value +(earlier in the source file) are not contained in this region.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let start: Location
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + end + +
    +
    +
    +
    +
    +
    +

    The location describing the end of the region. All locations that are greater than this value +(later in the source file) are not contained in this region.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let end: Location
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    All SwiftLint rule identifiers that are disabled in this region.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let disabledRuleIdentifiers: Set<RuleIdentifier>
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a Region by setting explicit values for all its properties.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(start: Location, end: Location, disabledRuleIdentifiers: Set<RuleIdentifier>)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + start + + +
    +

    The region’s starting location.

    +
    +
    + + end + + +
    +

    The region’s ending location.

    +
    +
    + + disabledRuleIdentifiers + + +
    +

    All SwiftLint rule identifiers that are disabled in this region.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + contains(_:) + +
    +
    +
    +
    +
    +
    +

    Whether the specific location is contained in this region.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func contains(_ location: Location) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + location + + +
    +

    The location to check for containment.

    +
    +
    +
    +
    +

    Return Value

    +

    True if the specific location is contained in this region.

    +
    + +
    +
    +
  • +
  • +
    + + + + isRuleEnabled(_:) + +
    +
    +
    +
    +
    +
    +

    Whether the specified rule is enabled in this region.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func isRuleEnabled(_ rule: some Rule) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + rule + + +
    +

    The rule whose status should be determined.

    +
    +
    +
    +
    +

    Return Value

    +

    True if the specified rule is enabled in this region.

    +
    + +
    +
    +
  • +
  • +
    + + + + isRuleDisabled(_:) + +
    +
    +
    +
    +
    +
    +

    Whether the specified rule is disabled in this region.

    +
    +

    Note

    +

    For CustomRules, this will only return true if the custom_rules identifier + is used with the swiftlint disable command, but this method is never + called for CustomRules.

    + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func isRuleDisabled(_ rule: some Rule) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + rule + + +
    +

    The rule whose status should be determined.

    +
    +
    +
    +
    +

    Return Value

    +

    True if the specified rule is disabled in this region.

    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Whether the given rules are disabled in this region.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func areRulesDisabled(ruleIDs: [String]) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + ruleIDs + + +
    +

    A list of rule IDs. Typically all identifiers of a single rule.

    +
    +
    +
    +
    +

    Return Value

    +

    True if the specified rules are disabled in this region.

    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Returns the deprecated rule aliases that are disabling the specified rule in this region. +Returns the empty set if the rule isn’t disabled in this region.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func deprecatedAliasesDisabling(rule: some Rule) -> Set<String>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + rule + + +
    +

    The rule to check.

    +
    +
    +
    +
    +

    Return Value

    +

    Deprecated rule aliases.

    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/RuleConfigurationDescription.html b/Structs/RuleConfigurationDescription.html new file mode 100644 index 000000000..2b580efa6 --- /dev/null +++ b/Structs/RuleConfigurationDescription.html @@ -0,0 +1,479 @@ + + + + RuleConfigurationDescription Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

RuleConfigurationDescription

+
+
+ +
public struct RuleConfigurationDescription : Equatable, Sendable
+
extension RuleConfigurationDescription: Documentable
+ +
+
+

Description of a rule configuration.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + hasContent + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var hasContent: Bool { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + oneLiner() + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func oneLiner() -> String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + markdown() + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func markdown() -> String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + yaml() + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func yaml() -> String
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/RuleConfigurationOption.html b/Structs/RuleConfigurationOption.html new file mode 100644 index 000000000..23619612d --- /dev/null +++ b/Structs/RuleConfigurationOption.html @@ -0,0 +1,509 @@ + + + + RuleConfigurationOption Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

RuleConfigurationOption

+
+
+ +
public struct RuleConfigurationOption : Equatable, Sendable
+
extension RuleConfigurationOption: Documentable
+ +
+
+

A single option of a RuleConfigurationDescription.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + noOptions + +
    +
    +
    +
    +
    +
    +

    An option serving as a marker for an empty configuration description.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static let noOptions: RuleConfigurationOption
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + hasContent + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var hasContent: Bool { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + markdown() + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func markdown() -> String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + oneLiner() + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func oneLiner() -> String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + yaml() + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func yaml() -> String
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/RuleDescription.html b/Structs/RuleDescription.html new file mode 100644 index 000000000..888509782 --- /dev/null +++ b/Structs/RuleDescription.html @@ -0,0 +1,951 @@ + + + + RuleDescription Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

RuleDescription

+
+
+ +
public struct RuleDescription : Equatable, Sendable
+ +
+
+

A detailed description for a SwiftLint rule. Used for both documentation and testing purposes.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + identifier + +
    +
    +
    +
    +
    +
    +

    The rule’s unique identifier, to be used in configuration files and SwiftLint commands. +Should be short and only comprised of lowercase latin alphabet letters and underscores formatted in snake case.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let identifier: String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + name + +
    +
    +
    +
    +
    +
    +

    The rule’s human-readable name. Should be short, descriptive and formatted in Title Case. May contain spaces.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let name: String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + description + +
    +
    +
    +
    +
    +
    +

    The rule’s verbose description. Should read as a sentence or short paragraph. Good things to include are an +explanation of the rule’s purpose and rationale.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let description: String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + kind + +
    +
    +
    +
    +
    +
    +

    The RuleKind that best categorizes this rule.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let kind: RuleKind
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + nonTriggeringExamples + +
    +
    +
    +
    +
    +
    +

    Swift source examples that do not trigger a violation for this rule. Used for documentation purposes to inform +users of various samples of code that are considered valid by this rule. Should be valid Swift syntax but is not +required to compile.

    + +

    These examples are also used for automatic testing purposes. Tests will validate that the rule does not trigger +any violations for these examples.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let nonTriggeringExamples: [Example]
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + triggeringExamples + +
    +
    +
    +
    +
    +
    +

    Swift source examples that do trigger one or more violations for this rule. Used for documentation purposes to +inform users of various samples of code that are considered invalid by this rule. Should be valid Swift syntax +but is not required to compile.

    + +

    Violations should occur where ↓ markers are located.

    + +

    These examples are also used for automatic testing purposes. Tests will validate that the rule triggers +violations for these examples wherever ↓ markers are located.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let triggeringExamples: [Example]
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + corrections + +
    +
    +
    +
    +
    +
    +

    Pairs of Swift source examples, where keys are examples that trigger violations for this rule, and the values +are the expected value after applying corrections with the rule.

    + +

    Rules that aren’t correctable (conforming to the CorrectableRule protocol) should leave property empty.

    + +

    These examples are used for testing purposes if the rule conforms to AutomaticTestableRule. Tests will +validate that the rule corrects all keys to their corresponding values.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let corrections: [Example : Example]
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + deprecatedAliases + +
    +
    +
    +
    +
    +
    +

    Any previous iteration of the rule’s identifier that was previously shipped with SwiftLint.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let deprecatedAliases: Set<String>
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + minSwiftVersion + +
    +
    +
    +
    +
    +
    +

    The oldest version of the Swift compiler supported by this rule.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let minSwiftVersion: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + requiresFileOnDisk + +
    +
    +
    +
    +
    +
    +

    Whether or not this rule can only be executed on a file physically on-disk. Typically necessary for rules +conforming to AnalyzerRule.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let requiresFileOnDisk: Bool
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + consoleDescription + +
    +
    +
    +
    +
    +
    +

    The console-printable string for this description.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var consoleDescription: String { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + allIdentifiers + +
    +
    +
    +
    +
    +
    +

    All identifiers that have been used to uniquely identify this rule in past and current SwiftLint versions.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var allIdentifiers: [String] { get }
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a RuleDescription by specifying all its properties directly.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(identifier: String,
    +            name: String,
    +            description: String,
    +            kind: RuleKind,
    +            minSwiftVersion: SwiftVersion = .five,
    +            nonTriggeringExamples: [Example] = [],
    +            triggeringExamples: [Example] = [],
    +            corrections: [Example: Example] = [:],
    +            deprecatedAliases: Set<String> = [],
    +            requiresFileOnDisk: Bool = false)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + identifier + + +
    +

    Sets the description’s identifier property.

    +
    +
    + + name + + +
    +

    Sets the description’s name property.

    +
    +
    + + description + + +
    +

    Sets the description’s description property.

    +
    +
    + + kind + + +
    +

    Sets the description’s kind property.

    +
    +
    + + minSwiftVersion + + +
    +

    Sets the description’s minSwiftVersion property.

    +
    +
    + + nonTriggeringExamples + + +
    +

    Sets the description’s nonTriggeringExamples property.

    +
    +
    + + triggeringExamples + + +
    +

    Sets the description’s triggeringExamples property.

    +
    +
    + + corrections + + +
    +

    Sets the description’s corrections property.

    +
    +
    + + deprecatedAliases + + +
    +

    Sets the description’s deprecatedAliases property.

    +
    +
    + + requiresFileOnDisk + + +
    +

    Sets the description’s requiresFileOnDisk property.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Equatable +

+
+
+
    +
  • +
    + + + + ==(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func == (lhs: `Self`, rhs: `Self`) -> Bool
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/RuleList.html b/Structs/RuleList.html new file mode 100644 index 000000000..37b94698a --- /dev/null +++ b/Structs/RuleList.html @@ -0,0 +1,533 @@ + + + + RuleList Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

RuleList

+
+
+ +
public struct RuleList
+
extension RuleList: Equatable
+ +
+
+

A list of available SwiftLint rules.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + list + +
    +
    +
    +
    +
    +
    +

    The rules contained in this list.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let list: [String : any Rule.Type]
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Initializers +

+
+
+
    +
  • +
    + + + + init(rules:) + +
    +
    +
    +
    +
    +
    +

    Creates a RuleList by specifying all its rules.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(rules: any Rule.Type...)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + rules + + +
    +

    The rules to be contained in this list.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(rules:) + +
    +
    +
    +
    +
    +
    +

    Creates a RuleList by specifying all its rules.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(rules: [any Rule.Type])
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + rules + + +
    +

    The rules to be contained in this list.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + ==(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func == (lhs: RuleList, rhs: RuleList) -> Bool
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/RuleParameter.html b/Structs/RuleParameter.html new file mode 100644 index 000000000..b8f74441e --- /dev/null +++ b/Structs/RuleParameter.html @@ -0,0 +1,483 @@ + + + + RuleParameter Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

RuleParameter

+
+
+ +
public struct RuleParameter<T> : Equatable where T : Equatable
+ +
+
+

A configuration parameter for rules.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + severity + +
    +
    +
    +
    +
    +
    +

    The severity that should be assigned to the violation of this parameter’s value is met.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let severity: ViolationSeverity
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + value + +
    +
    +
    +
    +
    +
    +

    The value to configure the rule.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let value: T
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(severity:value:) + +
    +
    +
    +
    +
    +
    +

    Creates a RuleParameter by specifying its properties directly.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(severity: ViolationSeverity, value: T)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + severity + + +
    +

    The severity that should be assigned to the violation of this parameter’s value is met.

    +
    +
    + + value + + +
    +

    The value to configure the rule.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/SeverityConfiguration.html b/Structs/SeverityConfiguration.html new file mode 100644 index 000000000..940fc2c3f --- /dev/null +++ b/Structs/SeverityConfiguration.html @@ -0,0 +1,573 @@ + + + + SeverityConfiguration Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

SeverityConfiguration

+
+
+ +
public struct SeverityConfiguration<Parent> : SeverityBasedRuleConfiguration, InlinableOptionType, Sendable where Parent : Rule
+ +
+
+

A rule configuration that allows specifying the desired severity level for violations.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + error + +
    +
    +
    +
    +
    +
    +

    Configuration with a warning severity.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static var error: `Self` { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + warning + +
    +
    +
    +
    +
    +
    +

    Configuration with an error severity.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static var warning: `Self` { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + severityConfiguration + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var severityConfiguration: `Self` { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(_:) + +
    +
    +
    +
    +
    +
    +

    Create a SeverityConfiguration with the specified severity.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(_ severity: ViolationSeverity)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + severity + + +
    +

    The severity that should be used when emitting violations.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + apply(configuration:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public mutating func apply(configuration: Any) throws
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

RuleConfiguration conformances +

+
+
+
    +
  • +
    + + + + asDescription(with:) + +
    +
    +
    +
    +
    +
    +

    Severity configurations are special in that they shall not be nested when an option name is provided. +Instead, their only option value must be used together with the option name.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func asDescription(with key: String) -> RuleConfigurationDescription
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/SeverityLevelsConfiguration.html b/Structs/SeverityLevelsConfiguration.html new file mode 100644 index 000000000..fcf59318d --- /dev/null +++ b/Structs/SeverityLevelsConfiguration.html @@ -0,0 +1,544 @@ + + + + SeverityLevelsConfiguration Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

SeverityLevelsConfiguration

+
+
+ +
public struct SeverityLevelsConfiguration<Parent> : RuleConfiguration, InlinableOptionType, Sendable where Parent : Rule
+ +
+
+

A rule configuration that allows specifying thresholds for warning and error severities.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + warning + +
    +
    +
    +
    +
    +
    +

    The threshold for a violation to be a warning.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @ConfigurationElement
    +public var warning: Int { get set }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + error + +
    +
    +
    +
    +
    +
    +

    The threshold for a violation to be an error.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @ConfigurationElement
    +public var error: Int? { get set }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(warning:error:) + +
    +
    +
    +
    +
    +
    +

    Create a SeverityLevelsConfiguration based on the specified warning and error thresholds.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(warning: Int, error: Int? = nil)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + warning + + +
    +

    The threshold for a violation to be a warning.

    +
    +
    + + error + + +
    +

    The threshold for a violation to be an error.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + params + +
    +
    +
    +
    +
    +
    +

    The rule parameters that define the thresholds that should map to each severity.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var params: [RuleParameter<Int>] { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + apply(configuration:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public mutating func apply(configuration: Any) throws
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/Stack.html b/Structs/Stack.html new file mode 100644 index 000000000..5d23682e1 --- /dev/null +++ b/Structs/Stack.html @@ -0,0 +1,712 @@ + + + + Stack Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Stack

+
+
+ +
public struct Stack<Element>
+
extension Stack: Sequence
+
extension Stack: CustomDebugStringConvertible where Element: CustomDebugStringConvertible
+ +
+
+

A basic stack type implementing the LIFO principle - only the last inserted element can be accessed and removed.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + init() + +
    +
    +
    +
    +
    +
    +

    Creates an empty Stack.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init()
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + count + +
    +
    +
    +
    +
    +
    +

    The number of elements in this stack.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var count: Int { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + push(_:) + +
    +
    +
    +
    +
    +
    +

    Pushes (appends) an element onto the stack.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public mutating func push(_ element: Element)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + element + + +
    +

    The element to push onto the stack.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + pop() + +
    +
    +
    +
    +
    +
    +

    Removes and returns the last element of the stack.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @discardableResult
    +public mutating func pop() -> Element?
    + +
    +
    +
    +

    Return Value

    +

    The last element of the stack if the stack is not empty; otherwise, nil.

    +
    + +
    +
    +
  • +
  • +
    + + + + peek() + +
    +
    +
    +
    +
    +
    +

    Returns the last element of the stack if the stack is not empty; otherwise, nil.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func peek() -> Element?
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + contains(where:) + +
    +
    +
    +
    +
    +
    +

    Check whether the sequence contains an element that satisfies the given predicate.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func contains(where predicate: (Element) -> Bool) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + predicate + + +
    +

    A closure that takes an element of the sequence +and returns whether it represents a match.

    +
    +
    +
    +
    +

    Return Value

    +

    true if the sequence contains an element that satisfies predicate.

    +
    + +
    +
    +
  • +
  • +
    + + + + modifyLast(by:) + +
    +
    +
    +
    +
    +
    +

    Modify the last element.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public mutating func modifyLast(by modifier: (inout Element) -> Void)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + modifier + + +
    +

    A function to be applied to the last element to modify the same in place.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + makeIterator() + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func makeIterator() -> [Element].Iterator
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Available where Element: CustomDebugStringConvertible +

+
+
+
    +
  • +
    + + + + debugDescription + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var debugDescription: String { get }
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/StyleViolation.html b/Structs/StyleViolation.html new file mode 100644 index 000000000..9f4c6d0d8 --- /dev/null +++ b/Structs/StyleViolation.html @@ -0,0 +1,788 @@ + + + + StyleViolation Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

StyleViolation

+
+
+ +
public struct StyleViolation : CustomStringConvertible, Codable, Hashable
+ +
+
+

A value describing an instance of Swift source code that is considered invalid by a SwiftLint rule.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + ruleIdentifier + +
    +
    +
    +
    +
    +
    +

    The identifier of the rule that generated this violation.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let ruleIdentifier: String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + ruleDescription + +
    +
    +
    +
    +
    +
    +

    The description of the rule that generated this violation.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let ruleDescription: String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + ruleName + +
    +
    +
    +
    +
    +
    +

    The name of the rule that generated this violation.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let ruleName: String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + severity + +
    +
    +
    +
    +
    +
    +

    The severity of this violation.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public private(set) var severity: ViolationSeverity { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + location + +
    +
    +
    +
    +
    +
    +

    The location of this violation.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public private(set) var location: Location { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + reason + +
    +
    +
    +
    +
    +
    +

    The justification for this violation.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let reason: String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + description + +
    +
    +
    +
    +
    +
    +

    A printable description for this violation.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var description: String { get }
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a StyleViolation by specifying its properties directly.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(ruleDescription: RuleDescription,
    +            severity: ViolationSeverity = .warning,
    +            location: Location,
    +            reason: String? = nil)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + +
    + + ruleDescription + + +
    +

    The description of the rule that generated this violation.

    +
    +
    + + severity + + +
    +

    The severity of this violation.

    +
    +
    + + location + + +
    +

    The location of this violation.

    +
    +
    + + reason + + +
    +

    The justification for this violation. If not specified the rule’s description will + be used.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + with(severity:) + +
    +
    +
    +
    +
    +
    +

    Returns the same violation, but with the severity that is passed in

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func with(severity: ViolationSeverity) -> StyleViolation
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + severity + + +
    +

    the new severity to use in the modified violation

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + with(location:) + +
    +
    +
    +
    +
    +
    +

    Returns the same violation, but with the location that is passed in

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func with(location: Location) -> StyleViolation
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + location + + +
    +

    the new location to use in the modified violation

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + hash(into:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func hash(into hasher: inout Hasher)
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/SwiftLintSyntaxMap.html b/Structs/SwiftLintSyntaxMap.html new file mode 100644 index 000000000..dc76ba187 --- /dev/null +++ b/Structs/SwiftLintSyntaxMap.html @@ -0,0 +1,577 @@ + + + + SwiftLintSyntaxMap Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

SwiftLintSyntaxMap

+
+
+ +
public struct SwiftLintSyntaxMap
+ +
+
+

Represents a Swift file’s syntax information.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + value + +
    +
    +
    +
    +
    +
    +

    The raw SyntaxMap obtained by SourceKitten.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let value: SyntaxMap
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + tokens + +
    +
    +
    +
    +
    +
    +

    The SwiftLint-specific syntax tokens for this syntax map.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let tokens: [SwiftLintSyntaxToken]
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(value:) + +
    +
    +
    +
    +
    +
    +

    Creates a SwiftLintSyntaxMap from the raw SyntaxMap obtained by SourceKitten.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(value: SyntaxMap)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + value + + +
    +

    The raw SyntaxMap obtained by SourceKitten.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + tokens(inByteRange:) + +
    +
    +
    +
    +
    +
    +

    Returns array of syntax tokens intersecting with byte range.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func tokens(inByteRange byteRange: ByteRange) -> [SwiftLintSyntaxToken]
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + byteRange + + +
    +

    Byte-based NSRange.

    +
    +
    +
    +
    +

    Return Value

    +

    The array of syntax tokens intersecting with byte range.

    +
    + +
    +
    +
  • +
  • +
    + + + + kinds(inByteRange:) + +
    +
    +
    +
    +
    +
    +

    Returns the syntax kinds in the specified byte range.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func kinds(inByteRange byteRange: ByteRange) -> [SyntaxKind]
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + byteRange + + +
    +

    Byte range.

    +
    +
    +
    +
    +

    Return Value

    +

    The syntax kinds in the specified byte range.

    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/SwiftLintSyntaxToken.html b/Structs/SwiftLintSyntaxToken.html new file mode 100644 index 000000000..683499cab --- /dev/null +++ b/Structs/SwiftLintSyntaxToken.html @@ -0,0 +1,561 @@ + + + + SwiftLintSyntaxToken Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

SwiftLintSyntaxToken

+
+
+ +
public struct SwiftLintSyntaxToken
+ +
+
+

A SwiftLint-aware Swift syntax token.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + value + +
    +
    +
    +
    +
    +
    +

    The raw SyntaxToken obtained by SourceKitten.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let value: SyntaxToken
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + kind + +
    +
    +
    +
    +
    +
    +

    The syntax kind associated with is token.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let kind: SyntaxKind?
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(value:) + +
    +
    +
    +
    +
    +
    +

    Creates a SwiftLintSyntaxToken from the raw SyntaxToken obtained by SourceKitten.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(value: SyntaxToken)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + value + + +
    +

    The raw SyntaxToken obtained by SourceKitten.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + range + +
    +
    +
    +
    +
    +
    +

    The byte range in a source file for this token.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var range: ByteRange { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + offset + +
    +
    +
    +
    +
    +
    +

    The starting byte offset in a source file for this token.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var offset: ByteCount { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + length + +
    +
    +
    +
    +
    +
    +

    The length in bytes for this token.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var length: ByteCount { get }
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/Structs/SwiftVersion.html b/Structs/SwiftVersion.html new file mode 100644 index 000000000..05dce299e --- /dev/null +++ b/Structs/SwiftVersion.html @@ -0,0 +1,814 @@ + + + + SwiftVersion Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

SwiftVersion

+
+
+ +
public struct SwiftVersion : RawRepresentable, Codable, VersionComparable, Sendable
+ +
+
+

A value describing the version of the Swift compiler.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + RawValue + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public typealias RawValue = String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + rawValue + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let rawValue: String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(rawValue:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(rawValue: String)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + five + +
    +
    +
    +
    +
    +
    +

    Swift 5

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let five: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + fiveDotOne + +
    +
    +
    +
    +
    +
    +

    Swift 5.1

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let fiveDotOne: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + fiveDotTwo + +
    +
    +
    +
    +
    +
    +

    Swift 5.2

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let fiveDotTwo: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + fiveDotThree + +
    +
    +
    +
    +
    +
    +

    Swift 5.3

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let fiveDotThree: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + fiveDotFour + +
    +
    +
    +
    +
    +
    +

    Swift 5.4

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let fiveDotFour: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + fiveDotFive + +
    +
    +
    +
    +
    +
    +

    Swift 5.5

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let fiveDotFive: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + fiveDotSix + +
    +
    +
    +
    +
    +
    +

    Swift 5.6

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let fiveDotSix: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + fiveDotSeven + +
    +
    +
    +
    +
    +
    +

    Swift 5.7

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let fiveDotSeven: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + fiveDotEight + +
    +
    +
    +
    +
    +
    +

    Swift 5.8

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let fiveDotEight: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + fiveDotNine + +
    +
    +
    +
    +
    +
    +

    Swift 5.9

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let fiveDotNine: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + six + +
    +
    +
    +
    +
    +
    +

    Swift 6

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let six: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + current + +
    +
    +
    +
    +
    +
    +

    The current detected Swift compiler version, based on the currently accessible SourceKit version.

    +
    +

    Note

    + Override by setting the SWIFTLINT_SWIFT_VERSION environment variable. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let current: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/accessibility_label_for_image.html b/accessibility_label_for_image.html new file mode 100644 index 000000000..bbcffb8f8 --- /dev/null +++ b/accessibility_label_for_image.html @@ -0,0 +1,608 @@ + + + + accessibility_label_for_image Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Accessibility Label for Image

+ +

Images that provide context should have an accessibility label or should be explicitly hidden from accessibility

+ +
    +
  • Identifier: accessibility_label_for_image
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.1.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
struct MyView: View {
+    var body: some View {
+        Image(decorative: "my-image")
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Image("my-image", label: Text("Alt text for my image"))
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Image("my-image")
+            .accessibility(hidden: true)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Image("my-image")
+            .accessibilityHidden(true)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Image("my-image")
+            .accessibility(label: Text("Alt text for my image"))
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Image("my-image")
+            .accessibilityLabel(Text("Alt text for my image"))
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Image(uiImage: myUiImage)
+            .renderingMode(.template)
+            .foregroundColor(.blue)
+            .accessibilityHidden(true)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Image(uiImage: myUiImage)
+            .accessibilityLabel(Text("Alt text for my image"))
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        SwiftUI.Image(uiImage: "my-image").resizable().accessibilityHidden(true)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        VStack {
+            Image(decorative: "my-image")
+                .renderingMode(.template)
+                .foregroundColor(.blue)
+            Image("my-image")
+                .accessibility(label: Text("Alt text for my image"))
+        }
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        VStack {
+            Image("my-image")
+                .renderingMode(.template)
+                .foregroundColor(.blue)
+            Image("my-image")
+                .accessibility(label: Text("Alt text for my image"))
+        }.accessibilityElement()
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        VStack {
+            Image("my-image")
+                .renderingMode(.template)
+                .foregroundColor(.blue)
+            Image("my-image")
+                .accessibility(label: Text("Alt text for my image"))
+        }.accessibilityHidden(true)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        HStack(spacing: 8) {
+            Image(decorative: "my-image")
+                .renderingMode(.template)
+                .foregroundColor(.blue)
+            Text("Text to accompany my image")
+        }.accessibilityElement(children: .combine)
+        .padding(16)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        HStack(spacing: 8) {
+            Image("my-image")
+                .renderingMode(.template)
+                .foregroundColor(.blue)
+            Text("Text to accompany my image")
+        }.accessibilityElement(children: .ignore)
+        .padding(16)
+        .accessibilityLabel(Text("Label for my image and text"))
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Button(action: { doAction() }) {
+            Image("my-image")
+                .renderingMode(.template)
+                .foregroundColor(.blue)
+        }
+        .accessibilityLabel(Text("Label for my image"))
+    }
+}
+
+

Triggering Examples

+
struct MyView: View {
+    var body: some View {
+        ↓Image("my-image")
+            .resizable(true)
+            .frame(width: 48, height: 48)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        ↓Image(uiImage: myUiImage)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        ↓SwiftUI.Image(uiImage: "my-image").resizable().accessibilityHidden(false)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Image(uiImage: myUiImage)
+            .resizable()
+            .frame(width: 48, height: 48)
+            .accessibilityLabel(Text("Alt text for my image"))
+        ↓Image("other image")
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Image(decorative: "image1")
+        ↓Image("image2")
+        Image(uiImage: "image3")
+            .accessibility(label: Text("a pretty picture"))
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        VStack {
+            Image(decorative: "my-image")
+                .renderingMode(.template)
+                .foregroundColor(.blue)
+            ↓Image("my-image")
+        }
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        VStack {
+            ↓Image("my-image")
+                .renderingMode(.template)
+                .foregroundColor(.blue)
+            Image("my-image")
+                .accessibility(label: Text("Alt text for my image"))
+        }.accessibilityElement(children: .contain)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        VStack {
+            ↓Image("my-image")
+                .renderingMode(.template)
+                .foregroundColor(.blue)
+            Image("my-image")
+                .accessibility(label: Text("Alt text for my image"))
+        }.accessibilityHidden(false)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        HStack(spacing: 8) {
+            ↓Image("my-image")
+                .renderingMode(.template)
+                .foregroundColor(.blue)
+            Text("Text to accompany my image")
+        }.accessibilityElement(children: .combine)
+        .padding(16)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Button(action: { doAction() }) {
+            ↓Image("my-image")
+                .renderingMode(.template)
+                .foregroundColor(.blue)
+        }
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        ↓Image(systemName: "circle.plus")
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/accessibility_trait_for_button.html b/accessibility_trait_for_button.html new file mode 100644 index 000000000..72861dd35 --- /dev/null +++ b/accessibility_trait_for_button.html @@ -0,0 +1,611 @@ + + + + accessibility_trait_for_button Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Accessibility Trait for Button

+ +

All views with tap gestures added should include the .isButton or the .isLink accessibility traits

+ +
    +
  • Identifier: accessibility_trait_for_button
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.1.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
struct MyView: View {
+    var body: some View {
+        Button {
+            print("tapped")
+        } label: {
+            Text("Learn more")
+        }
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Link("Open link", destination: myUrl)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Text("Learn more")
+            .onTapGesture {
+                print("tapped - open URL")
+            }
+            .accessibility(addTraits: .isLink)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Text("Learn more")
+            .accessibilityAddTraits(.isButton)
+            .onTapGesture {
+                print("tapped")
+            }
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Text("Learn more")
+            .accessibility(addTraits: [.isButton, .isHeader])
+            .onTapGesture {
+                print("tapped")
+            }
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Text("Learn more")
+            .onTapGesture {
+                print("tapped - open URL")
+            }
+            .accessibilityAddTraits([.isHeader, .isLink])
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Text("Learn more")
+            .onTapGesture(count: 1) {
+                print("tapped")
+            }
+            .accessibility(addTraits: .isButton)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Text("Learn more")
+            .onTapGesture(count: 1, perform: {
+                print("tapped")
+            })
+            .accessibility(addTraits: .isButton)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Text("Learn more")
+            // This rule does not include tap gestures with multiple taps for now.
+            // Custom gestures like this are also not very accessible, but require
+            // alternative ways to accomplish the same task with assistive tech.
+            .onTapGesture(count: 2) {
+                print("double-tapped")
+            }
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Label("Learn more", systemImage: "info.circle")
+            .onTapGesture(count: 1) {
+                print("tapped")
+            }
+            .accessibility(addTraits: .isButton)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        HStack {
+            Image(systemName: "info.circle")
+            Text("Learn more")
+        }
+        .onTapGesture {
+            print("tapped")
+        }
+        // This modifier is not strictly required — each subview will inherit the button trait.
+        // That said, grouping a tappable stack into a single element is a good way to reduce
+        // the number of swipes required for a VoiceOver user to navigate the page.
+        .accessibilityElement(children: .combine)
+        .accessibility(addTraits: .isButton)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Text("Learn more")
+            .gesture(TapGesture().onEnded {
+                print("tapped")
+            })
+            .accessibilityAddTraits(.isButton)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Text("Learn more")
+            .simultaneousGesture(TapGesture(count: 1).onEnded {
+                print("tapped - open URL")
+            })
+            .accessibilityAddTraits(.isLink)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Text("Learn more")
+            .highPriorityGesture(TapGesture().onEnded {
+                print("tapped")
+            })
+            .accessibility(addTraits: [.isButton])
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Text("Learn more")
+            .gesture(TapGesture(count: 2).onEnded {
+                print("tapped")
+            })
+    }
+}
+
+

Triggering Examples

+
struct MyView: View {
+    var body: some View {
+        ↓Text("Learn more")
+            .onTapGesture {
+                print("tapped")
+            }
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        ↓Text("Learn more")
+            .accessibility(addTraits: .isHeader)
+            .onTapGesture {
+                print("tapped")
+            }
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        ↓Text("Learn more")
+            .onTapGesture(count: 1) {
+                print("tapped")
+            }
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        ↓Text("Learn more")
+            .onTapGesture(count: 1, perform: {
+                print("tapped")
+            })
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        ↓Label("Learn more", systemImage: "info.circle")
+            .onTapGesture(count: 1) {
+                print("tapped")
+            }
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        ↓HStack {
+            Image(systemName: "info.circle")
+            Text("Learn more")
+        }
+        .onTapGesture {
+            print("tapped")
+        }
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        ↓Text("Learn more")
+            .gesture(TapGesture().onEnded {
+                print("tapped")
+            })
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        ↓Text("Learn more")
+            .simultaneousGesture(TapGesture(count: 1).onEnded {
+                print("tapped")
+            })
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        ↓Text("Learn more")
+            .highPriorityGesture(TapGesture().onEnded {
+                print("tapped")
+            })
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/anonymous_argument_in_multiline_closure.html b/anonymous_argument_in_multiline_closure.html new file mode 100644 index 000000000..314e3addb --- /dev/null +++ b/anonymous_argument_in_multiline_closure.html @@ -0,0 +1,388 @@ + + + + anonymous_argument_in_multiline_closure Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Anonymous Argument in Multiline Closure

+ +

Use named arguments in multiline closures

+ +
    +
  • Identifier: anonymous_argument_in_multiline_closure
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
closure { $0 }
+
+
closure { print($0) }
+
+
closure { arg in
+    print(arg)
+}
+
+
closure { arg in
+    nestedClosure { $0 + arg }
+}
+
+

Triggering Examples

+
closure {
+    print(↓$0)
+}
+
+ +
+
+ + +
+
+ + + diff --git a/array_init.html b/array_init.html new file mode 100644 index 000000000..a5f04c710 --- /dev/null +++ b/array_init.html @@ -0,0 +1,418 @@ + + + + array_init Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Array Init

+ +

Prefer using Array(seq) over seq.map { $0 } to convert a sequence into an Array

+ +
    +
  • Identifier: array_init
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
Array(foo)
+
+
foo.map { $0.0 }
+
+
foo.map { $1 }
+
+
foo.map { $0() }
+
+
foo.map { ((), $0) }
+
+
foo.map { $0! }
+
+
foo.map { $0! /* force unwrap */ }
+
+
foo.something { RouteMapper.map($0) }
+
+
foo.map { !$0 }
+
+
foo.map { /* a comment */ !$0 }
+
+

Triggering Examples

+
foo.↓map({ $0 })
+
+
foo.↓map { $0 }
+
+
foo.↓map { return $0 }
+
+
foo.↓map { elem in
+    elem
+}
+
+
foo.↓map { elem in
+    return elem
+}
+
+
foo.↓map { (elem: String) in
+    elem
+}
+
+
foo.↓map { elem -> String in
+    elem
+}
+
+
foo.↓map { $0 /* a comment */ }
+
+
foo.↓map { /* a comment */ $0 }
+
+ +
+
+ + +
+
+ + + diff --git a/async_without_await.html b/async_without_await.html new file mode 100644 index 000000000..e38abc133 --- /dev/null +++ b/async_without_await.html @@ -0,0 +1,574 @@ + + + + async_without_await Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Async Without Await

+ +

Declaration should not be async if it doesn’t use await

+ +
    +
  • Identifier: async_without_await
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func test() {
+    func test() async {
+        await test()
+    }
+},
+
+
func test() {
+    func test() async {
+        await test().value
+    }
+},
+
+
func test() async {
+    await scheduler.task { foo { bar() } }
+}
+
+
func test() async {
+    perform(await try foo().value)
+}
+
+
func test() async {
+    perform(try await foo())
+}
+
+
func test() async {
+    await perform()
+    func baz() {
+        qux()
+    }
+}
+
+
let x: () async -> Void = {
+    await test()
+}
+
+
let x: () async -> Void = {
+    await { await test() }()
+}
+
+
func test() async {
+    await foo()
+}
+let x = { bar() }
+
+
let x: (() async -> Void)? = {
+    await { await test() }()
+}
+
+
let x: (() async -> Void)? = nil
+let x: () -> Void = { test() }
+
+
var test: Int {
+    get async throws {
+        try await foo()
+    }
+}
+var foo: Int {
+    get throws {
+        try bar()
+    }
+}
+
+
init() async {
+    await foo()
+}
+
+
init() async {
+    func test() async {
+        await foo()
+    }
+    await { await foo() }()
+}
+
+
subscript(row: Int) -> Double {
+    get async {
+        await foo()
+    }
+}
+
+
func foo() async -> Int
+func bar() async -> Int
+
+
var foo: Int { get async }
+var bar: Int { get async }
+
+
init(foo: bar) async
+init(baz: qux) async
+let baz = { qux() }
+
+
typealias Foo = () async -> Void
+typealias Bar = () async -> Void
+let baz = { qux() }
+
+
func test() async {
+    for await foo in bar {}
+}
+
+
func test() async {
+    while let foo = await bar() {}
+}
+
+
func test() async {
+    async let foo = bar()
+    let baz = await foo
+}
+
+
func test() async {
+    async let foo = bar()
+    await foo
+}
+
+
func test() async {
+    async let foo = bar()
+}
+
+
func foo(bar: () async -> Void) { { } }
+
+
func foo(bar: () async -> Void = { await baz() }) { {} }
+
+
func foo() -> (() async -> Void)? { {} }
+
+
func foo(
+    bar: () async -> Void,
+    baz: () -> Void = {}
+) { { } }
+
+
func foo(bar: () async -> Void = {}) { }
+
+

Triggering Examples

+
func test() ↓async {
+    perform()
+}
+
+
func test() {
+    func baz() ↓async {
+        qux()
+    }
+    perform()
+    func baz() {
+        qux()
+    }
+}
+
+
func test() ↓async {
+    func baz() async {
+        await qux()
+    }
+}
+
+
func test() ↓async {
+  func foo() ↓async {}
+  let bar = { await foo() }
+}
+
+
func test() ↓async {
+    let bar = {
+        func foo() ↓async {}
+    }
+}
+
+
let x: (() ↓async -> Void)? = { test() }
+
+
var test: Int {
+    get ↓async throws {
+        foo()
+    }
+}
+
+
var test: Int {
+    get ↓async throws {
+        func foo() ↓async {}
+        let bar = { await foo() }
+    }
+}
+
+
var test: Int {
+    get throws {
+        func foo() {}
+        let bar: () ↓async -> Void = { foo() }
+    }
+}
+
+
init() ↓async {}
+
+
init() ↓async {
+    func foo() ↓async {}
+    let bar: () ↓async -> Void = { foo() }
+}
+
+
subscript(row: Int) -> Double {
+    get ↓async {
+        1.0
+    }
+}
+
+
func test() ↓async {
+    for foo in bar {}
+}
+
+
func test() ↓async {
+    while let foo = bar() {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/attribute_name_spacing.html b/attribute_name_spacing.html new file mode 100644 index 000000000..10c17d109 --- /dev/null +++ b/attribute_name_spacing.html @@ -0,0 +1,426 @@ + + + + attribute_name_spacing Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Attribute Name Spacing

+ +

This rule prevents trailing spaces after attribute names, ensuring compatibility with Swift 6 where a space between an attribute name and the opening parenthesis results in a compilation error (e.g. @MyPropertyWrapper (), private (set)).

+ +
    +
  • Identifier: attribute_name_spacing
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +error +
  • +
+

Non Triggering Examples

+
private(set) var foo: Bool = false
+
+
fileprivate(set) var foo: Bool = false
+
+
@MainActor class Foo {}
+
+
func funcWithEscapingClosure(_ x: @escaping () -> Int) {}
+
+
@available(*, deprecated)
+
+
@MyPropertyWrapper(param: 2) 
+
+
nonisolated(unsafe) var _value: X?
+
+
@testable import SwiftLintCore
+
+
func func_type_attribute_with_space(x: @convention(c) () -> Int) {}
+
+
@propertyWrapper
+struct MyPropertyWrapper {
+    var wrappedValue: Int = 1
+
+    init(param: Int) {}
+}
+
+
let closure2 = { @MainActor
+  (a: Int, b: Int) in
+}
+
+

Triggering Examples

+
private ↓(set) var foo: Bool = false
+
+
fileprivate ↓(set) var foo: Bool = false
+
+
public ↓(set) var foo: Bool = false
+
+
  public  ↓(set) var foo: Bool = false
+
+
@ ↓MainActor class Foo {}
+
+
func funcWithEscapingClosure(_ x: @ ↓escaping () -> Int) {}
+
+
func funcWithEscapingClosure(_ x: @escaping↓() -> Int) {}
+
+
@available ↓(*, deprecated)
+
+
@MyPropertyWrapper ↓(param: 2) 
+
+
nonisolated ↓(unsafe) var _value: X?
+
+
@MyProperty ↓() class Foo {}
+
+
let closure1 = { @MainActor ↓(a, b) in
+}
+
+ +
+
+ + +
+
+ + + diff --git a/attributes.html b/attributes.html new file mode 100644 index 000000000..0ae65bd2f --- /dev/null +++ b/attributes.html @@ -0,0 +1,627 @@ + + + + attributes Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Attributes

+ +

Attributes should be on their own lines in functions and types, but on the same line as variables and imports

+ +
    +
  • Identifier: attributes
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +attributes_with_arguments_always_on_line_above + +true +
    +always_on_same_line + +[“@IBAction”, “@NSManaged”] +
    +always_on_line_above + +[] +
  • +
+

Non Triggering Examples

+
@objc var x: String
+
+
@objc private var x: String
+
+
@nonobjc var x: String
+
+
@IBOutlet private var label: UILabel
+
+
@IBOutlet @objc private var label: UILabel
+
+
@NSCopying var name: NSString
+
+
@NSManaged var name: String?
+
+
@IBInspectable var cornerRadius: CGFloat
+
+
@available(iOS 9.0, *)
+ let stackView: UIStackView
+
+
@NSManaged func addSomeObject(book: SomeObject)
+
+
@IBAction func buttonPressed(button: UIButton)
+
+
@objc
+ @IBAction func buttonPressed(button: UIButton)
+
+
@available(iOS 9.0, *)
+ func animate(view: UIStackView)
+
+
@available(*, deprecated, message: "A message")
+ func animate(view: UIStackView)
+
+
@nonobjc
+ final class X {}
+
+
@available(iOS 9.0, *)
+ class UIStackView {}
+
+
@NSApplicationMain
+ class AppDelegate: NSObject, NSApplicationDelegate {}
+
+
@UIApplicationMain
+ class AppDelegate: NSObject, UIApplicationDelegate {}
+
+
@IBDesignable
+ class MyCustomView: UIView {}
+
+
@testable import SourceKittenFramework
+
+
@objc(foo_x)
+ var x: String
+
+
@available(iOS 9.0, *)
+@objc(abc_stackView)
+ let stackView: UIStackView
+
+
@objc(abc_addSomeObject:)
+ @NSManaged func addSomeObject(book: SomeObject)
+
+
@objc(ABCThing)
+ @available(iOS 9.0, *)
+ class Thing {}
+
+
class Foo: NSObject {
+ override var description: String { return "" }
+}
+
+
class Foo: NSObject {
+
+ override func setUp() {}
+}
+
+
@objc
+class ⽺ {}
+
+
extension Property {
+
+    @available(*, unavailable, renamed: "isOptional")
+    public var optional: Bool { fatalError() }
+}
+
+
@GKInspectable var maxSpeed: Float
+
+
@discardableResult
+ func a() -> Int
+
+
@objc
+ @discardableResult
+ func a() -> Int
+
+
func increase(f: @autoclosure () -> Int) -> Int
+
+
func foo(completionHandler: @escaping () -> Void)
+
+
private struct DefaultError: Error {}
+
+
@testable import foo
+
+private let bar = 1
+
+
import XCTest
+@testable import DeleteMe
+
+@available (iOS 11.0, *)
+class DeleteMeTests: XCTestCase {
+}
+
+
@objc
+internal func foo(identifier: String, completion: @escaping (() -> Void)) {}
+
+
@objc
+internal func foo(identifier: String, completion: @autoclosure (() -> Bool)) {}
+
+
func printBoolOrTrue(_ expression: @autoclosure () throws -> Bool?) rethrows {
+  try print(expression() ?? true)
+}
+
+
import Foundation
+
+class MyClass: NSObject {
+  @objc(
+    first:
+  )
+  static func foo(first: String) {}
+}
+
+
func refreshable(action: @escaping @Sendable () async -> Void) -> some View {
+    modifier(RefreshableModifier(action: action))
+}
+
+
import AppKit
+
+@NSApplicationMain
+@MainActor
+final class AppDelegate: NSAppDelegate {}
+
+

Triggering Examples

+
@objc
+ ↓var x: String
+
+
@objc
+
+ ↓var x: String
+
+
@objc
+ private ↓var x: String
+
+
@nonobjc
+ ↓var x: String
+
+
@IBOutlet
+ private ↓var label: UILabel
+
+
@IBOutlet
+
+ private ↓var label: UILabel
+
+
@NSCopying
+ ↓var name: NSString
+
+
@NSManaged
+ ↓var name: String?
+
+
@IBInspectable
+ ↓var cornerRadius: CGFloat
+
+
@available(iOS 9.0, *) ↓let stackView: UIStackView
+
+
@NSManaged
+ ↓func addSomeObject(book: SomeObject)
+
+
@IBAction
+ ↓func buttonPressed(button: UIButton)
+
+
@IBAction
+ @objc
+ ↓func buttonPressed(button: UIButton)
+
+
@available(iOS 9.0, *) ↓func animate(view: UIStackView)
+
+
@nonobjc final ↓class X {}
+
+
@available(iOS 9.0, *) ↓class UIStackView {}
+
+
@available(iOS 9.0, *)
+ @objc ↓class UIStackView {}
+
+
@available(iOS 9.0, *) @objc
+ ↓class UIStackView {}
+
+
@available(iOS 9.0, *)
+
+ ↓class UIStackView {}
+
+
@UIApplicationMain ↓class AppDelegate: NSObject, UIApplicationDelegate {}
+
+
@IBDesignable ↓class MyCustomView: UIView {}
+
+
@testable
+↓import SourceKittenFramework
+
+
@testable
+
+
+↓import SourceKittenFramework
+
+
@available(iOS 9.0, *) @objc(abc_stackView)
+ ↓let stackView: UIStackView
+
+
@objc(abc_addSomeObject:) @NSManaged
+ ↓func addSomeObject(book: SomeObject)
+
+
@objc(abc_addSomeObject:)
+ @NSManaged
+ ↓func addSomeObject(book: SomeObject)
+
+
@available(iOS 9.0, *)
+ @objc(ABCThing) ↓class Thing {}
+
+
@GKInspectable
+ ↓var maxSpeed: Float
+
+
@discardableResult ↓func a() -> Int
+
+
@objc
+ @discardableResult ↓func a() -> Int
+
+
@objc
+
+ @discardableResult
+ ↓func a() -> Int
+
+ +
+
+ + +
+
+ + + diff --git a/badge.svg b/badge.svg new file mode 100644 index 000000000..a096feca8 --- /dev/null +++ b/badge.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + documentation + + + documentation + + + 100% + + + 100% + + + diff --git a/balanced_xctest_lifecycle.html b/balanced_xctest_lifecycle.html new file mode 100644 index 000000000..9c53ce3e2 --- /dev/null +++ b/balanced_xctest_lifecycle.html @@ -0,0 +1,456 @@ + + + + balanced_xctest_lifecycle Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Balanced XCTest Life Cycle

+ +

Test classes must implement balanced setUp and tearDown methods

+ +
    +
  • Identifier: balanced_xctest_lifecycle
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +test_parent_classes + +[“QuickSpec”, “XCTestCase”] +
  • +
+

Non Triggering Examples

+
final class FooTests: XCTestCase {
+    override func setUp() {}
+    override func tearDown() {}
+}
+
+
final class FooTests: XCTestCase {
+    override func setUpWithError() throws {}
+    override func tearDown() {}
+}
+
+
final class FooTests: XCTestCase {
+    override func setUp() {}
+    override func tearDownWithError() throws {}
+}
+
+
final class FooTests: XCTestCase {
+    override func setUpWithError() throws {}
+    override func tearDownWithError() throws {}
+}
+final class BarTests: XCTestCase {
+    override func setUpWithError() throws {}
+    override func tearDownWithError() throws {}
+}
+
+
struct FooTests {
+    override func setUp() {}
+}
+class BarTests {
+    override func setUpWithError() throws {}
+}
+
+
final class FooTests: XCTestCase {
+    override func setUpAlLExamples() {}
+}
+
+
final class FooTests: XCTestCase {
+    class func setUp() {}
+    class func tearDown() {}
+}
+
+

Triggering Examples

+
final class ↓FooTests: XCTestCase {
+    override func setUp() {}
+}
+
+
final class ↓FooTests: XCTestCase {
+    override func setUpWithError() throws {}
+}
+
+
final class FooTests: XCTestCase {
+    override func setUp() {}
+    override func tearDownWithError() throws {}
+}
+final class ↓BarTests: XCTestCase {
+    override func setUpWithError() throws {}
+}
+
+
final class ↓FooTests: XCTestCase {
+    class func tearDown() {}
+}
+
+
final class ↓FooTests: XCTestCase {
+    override func tearDown() {}
+}
+
+
final class ↓FooTests: XCTestCase {
+    override func tearDownWithError() throws {}
+}
+
+
final class FooTests: XCTestCase {
+    override func setUp() {}
+    override func tearDownWithError() throws {}
+}
+final class ↓BarTests: XCTestCase {
+    override func tearDownWithError() throws {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/blanket_disable_command.html b/blanket_disable_command.html new file mode 100644 index 000000000..a1b5fc4bb --- /dev/null +++ b/blanket_disable_command.html @@ -0,0 +1,412 @@ + + + + blanket_disable_command Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Blanket Disable Command

+ +

swiftlint:disable commands should use next, this or previous to disable rules for a single line, or swiftlint:enable to re-enable the rules immediately after the violations to be ignored, instead of disabling the rule for the rest of the file.

+ +
    +
  • Identifier: blanket_disable_command
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +allowed_rules + +[“file_header”, “file_length”, “file_name”, “file_name_no_space”, “single_test_class”] +
    +always_blanket_disable + +[] +
  • +
+

Non Triggering Examples

+
// swiftlint:disable unused_import
+// swiftlint:enable unused_import
+
+
// swiftlint:disable unused_import unused_declaration
+// swiftlint:enable unused_import
+// swiftlint:enable unused_declaration
+
+
// swiftlint:disable:this unused_import
+
+
// swiftlint:disable:next unused_import
+
+
// swiftlint:disable:previous unused_import
+
+

Triggering Examples

+
// swiftlint:disable ↓unused_import
+
+
// swiftlint:disable unused_import ↓unused_declaration
+// swiftlint:enable unused_import
+
+
// swiftlint:disable unused_import
+// swiftlint:disable ↓unused_import
+// swiftlint:enable unused_import
+
+
// swiftlint:enable ↓unused_import
+
+ +
+
+ + +
+
+ + + diff --git a/block_based_kvo.html b/block_based_kvo.html new file mode 100644 index 000000000..ad09c15c3 --- /dev/null +++ b/block_based_kvo.html @@ -0,0 +1,388 @@ + + + + block_based_kvo Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Block Based KVO

+ +

Prefer the new block based KVO API with keypaths when using Swift 3.2 or later

+ +
    +
  • Identifier: block_based_kvo
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let observer = foo.observe(\.value, options: [.new]) { (foo, change) in
+   print(change.newValue)
+}
+
+

Triggering Examples

+
class Foo: NSObject {
+  override ↓func observeValue(forKeyPath keyPath: String?, of object: Any?,
+                              change: [NSKeyValueChangeKey : Any]?,
+                              context: UnsafeMutableRawPointer?) {}
+}
+
+
class Foo: NSObject {
+  override ↓func observeValue(forKeyPath keyPath: String?, of object: Any?,
+                              change: Dictionary<NSKeyValueChangeKey, Any>?,
+                              context: UnsafeMutableRawPointer?) {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/capture_variable.html b/capture_variable.html new file mode 100644 index 000000000..4a1d01973 --- /dev/null +++ b/capture_variable.html @@ -0,0 +1,493 @@ + + + + capture_variable Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Capture Variable

+ +

Non-constant variables should not be listed in a closure’s capture list to avoid confusion about closures capturing variables at creation time

+ +
    +
  • Identifier: capture_variable
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: Yes
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class C {
+    let i: Int
+    init(_ i: Int) { self.i = i }
+}
+
+let j: Int = 0
+let c = C(1)
+
+let closure: () -> Void = { [j, c] in
+    print(c.i, j)
+}
+
+closure()
+
+
let iGlobal: Int = 0
+
+class C {
+    class var iClass: Int { 0 }
+    static let iStatic: Int = 0
+    let iInstance: Int = 0
+
+    func callTest() {
+        var iLocal: Int = 0
+        test { [unowned self, iGlobal, iInstance, iLocal, iClass=C.iClass, iStatic=C.iStatic] j in
+            print(iGlobal, iClass, iStatic, iInstance, iLocal, j)
+        }
+    }
+
+    func test(_ completionHandler: @escaping (Int) -> Void) {
+    }
+}
+
+
var j: Int!
+j = 0
+
+let closure: () -> Void = { [j] in
+    print(j)
+}
+
+closure()
+j = 1
+closure()
+
+
lazy var j: Int = { 0 }()
+
+let closure: () -> Void = { [j] in
+    print(j)
+}
+
+closure()
+j = 1
+closure()
+
+

Triggering Examples

+
var j: Int = 0
+
+let closure: () -> Void = { [j] in
+    print(j)
+}
+
+closure()
+j = 1
+closure()
+
+
class C {
+    let i: Int
+    init(_ i: Int) { self.i = i }
+}
+
+var c = C(0)
+let closure: () -> Void = { [c] in
+    print(c.i)
+}
+
+closure()
+c = C(1)
+closure()
+
+
var iGlobal: Int = 0
+
+class C {
+    func callTest() {
+        test { [iGlobal] j in
+            print(iGlobal, j)
+        }
+    }
+
+    func test(_ completionHandler: @escaping (Int) -> Void) {
+    }
+}
+
+
class C {
+    static var iStatic: Int = 0
+
+    static func callTest() {
+        test { [↓iStatic] j in
+            print(iStatic, j)
+        }
+    }
+
+    static func test(_ completionHandler: @escaping (Int) -> Void) {
+        completionHandler(2)
+        C.iStatic = 1
+        completionHandler(3)
+    }
+}
+
+C.callTest()
+
+
class C {
+    var iInstance: Int = 0
+
+    func callTest() {
+        test { [iInstance] j in
+            print(iInstance, j)
+        }
+    }
+
+    func test(_ completionHandler: @escaping (Int) -> Void) {
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/class_delegate_protocol.html b/class_delegate_protocol.html new file mode 100644 index 000000000..cf117145b --- /dev/null +++ b/class_delegate_protocol.html @@ -0,0 +1,403 @@ + + + + class_delegate_protocol Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Class Delegate Protocol

+ +

Delegate protocols should be class-only so they can be weakly referenced

+ +
    +
  • Identifier: class_delegate_protocol
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
protocol FooDelegate: class {}
+
+
protocol FooDelegate: class, BarDelegate {}
+
+
protocol Foo {}
+
+
class FooDelegate {}
+
+
@objc protocol FooDelegate {}
+
+
@objc(MyFooDelegate)
+ protocol FooDelegate {}
+
+
protocol FooDelegate: BarDelegate {}
+
+
protocol FooDelegate: AnyObject {}
+
+
protocol FooDelegate: NSObjectProtocol {}
+
+
protocol FooDelegate where Self: BarDelegate {}
+
+
protocol FooDelegate where Self: AnyObject {}
+
+
protocol FooDelegate where Self: NSObjectProtocol {}
+
+

Triggering Examples

+
↓protocol FooDelegate {}
+
+
↓protocol FooDelegate: Bar {}
+
+
↓protocol FooDelegate where Self: StringProtocol {}
+
+ +
+
+ + +
+
+ + + diff --git a/closing_brace.html b/closing_brace.html new file mode 100644 index 000000000..e1fdd9607 --- /dev/null +++ b/closing_brace.html @@ -0,0 +1,382 @@ + + + + closing_brace Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Closing Brace Spacing

+ +

Closing brace with closing parenthesis should not have any whitespaces in the middle

+ +
    +
  • Identifier: closing_brace
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
[].map({ })
+
+
[].map(
+  { }
+)
+
+

Triggering Examples

+
[].map({ ↓} )
+
+
[].map({ ↓}   )
+
+ +
+
+ + +
+
+ + + diff --git a/closure_body_length.html b/closure_body_length.html new file mode 100644 index 000000000..e77df7202 --- /dev/null +++ b/closure_body_length.html @@ -0,0 +1,1070 @@ + + + + closure_body_length Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Closure Body Length

+ +

Closure bodies should not span too many lines

+ +
    +
  • Identifier: closure_body_length
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: metrics
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +warning + +30 +
    +error + +100 +
  • +
+

Non Triggering Examples

+
foo.bar { $0 }
+
+
foo.bar { toto in
+}
+
+
foo.bar { toto in
+    let a0 = 0
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+
foo.bar { toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+}
+
+
foo.bar { toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+
foo.bar({ toto in
+})
+
+
foo.bar({ toto in
+    let a0 = 0
+})
+
+
foo.bar({ toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+})
+
+
foo.bar(label: { toto in
+})
+
+
foo.bar(label: { toto in
+    let a0 = 0
+})
+
+
foo.bar(label: { toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+})
+
+
foo.bar(label: { toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+}, anotherLabel: { toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+})
+
+
foo.bar(label: { toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+}) { toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+}
+
+
let foo: Bar = { toto in
+    let bar = Bar()
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    return bar
+}()
+
+

Triggering Examples

+
foo.bar ↓{ toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+    let a29 = 0
+    let a30 = 0
+}
+
+
foo.bar ↓{ toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+    let a29 = 0
+    let a30 = 0
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+
+
+
+
+
+
+
+
+
+
+}
+
+
foo.bar(↓{ toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+    let a29 = 0
+    let a30 = 0
+})
+
+
foo.bar(label: ↓{ toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+    let a29 = 0
+    let a30 = 0
+})
+
+
foo.bar(label: ↓{ toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+    let a29 = 0
+    let a30 = 0
+}, anotherLabel: ↓{ toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+    let a29 = 0
+    let a30 = 0
+})
+
+
foo.bar(label: ↓{ toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+    let a29 = 0
+    let a30 = 0
+}) ↓{ toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+    let a29 = 0
+    let a30 = 0
+}
+
+
let foo: Bar = ↓{ toto in
+    let bar = Bar()
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+    return bar
+}()
+
+ +
+
+ + +
+
+ + + diff --git a/closure_end_indentation.html b/closure_end_indentation.html new file mode 100644 index 000000000..e483a446e --- /dev/null +++ b/closure_end_indentation.html @@ -0,0 +1,442 @@ + + + + closure_end_indentation Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Closure End Indentation

+ +

Closure end should have the same indentation as the line that started it.

+ +
    +
  • Identifier: closure_end_indentation
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
SignalProducer(values: [1, 2, 3])
+   .startWithNext { number in
+       print(number)
+   }
+
+
+
[1, 2].map { $0 + 1 }
+
+
+
return match(pattern: pattern, with: [.comment]).flatMap { range in
+   return Command(string: contents, range: range)
+}.flatMap { command in
+   return command.expand()
+}
+
+
+
foo(foo: bar,
+    options: baz) { _ in }
+
+
+
someReallyLongProperty.chainingWithAnotherProperty
+   .foo { _ in }
+
+
foo(abc, 123)
+{ _ in }
+
+
+
function(
+    closure: { x in
+        print(x)
+    },
+    anotherClosure: { y in
+        print(y)
+    })
+
+
function(parameter: param,
+         closure: { x in
+    print(x)
+})
+
+
function(parameter: param, closure: { x in
+        print(x)
+    },
+    anotherClosure: { y in
+        print(y)
+    })
+
+
(-variable).foo()
+
+

Triggering Examples

+
SignalProducer(values: [1, 2, 3])
+   .startWithNext { number in
+       print(number)
+↓}
+
+
+
return match(pattern: pattern, with: [.comment]).flatMap { range in
+   return Command(string: contents, range: range)
+   ↓}.flatMap { command in
+   return command.expand()
+↓}
+
+
+
function(
+    closure: { x in
+        print(x)
+↓},
+    anotherClosure: { y in
+        print(y)
+↓})
+
+ +
+
+ + +
+
+ + + diff --git a/closure_parameter_position.html b/closure_parameter_position.html new file mode 100644 index 000000000..5690511dc --- /dev/null +++ b/closure_parameter_position.html @@ -0,0 +1,458 @@ + + + + closure_parameter_position Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Closure Parameter Position

+ +

Closure parameters should be on the same line as opening brace

+ +
    +
  • Identifier: closure_parameter_position
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
[1, 2].map { $0 + 1 }
+
+
[1, 2].map({ $0 + 1 })
+
+
[1, 2].map { number in
+ number + 1 
+}
+
+
[1, 2].map { number -> Int in
+ number + 1 
+}
+
+
[1, 2].map { (number: Int) -> Int in
+ number + 1 
+}
+
+
[1, 2].map { [weak self] number in
+ number + 1 
+}
+
+
[1, 2].something(closure: { number in
+ number + 1 
+})
+
+
let isEmpty = [1, 2].isEmpty()
+
+
rlmConfiguration.migrationBlock.map { rlmMigration in
+    return { migration, schemaVersion in
+        rlmMigration(migration.rlmMigration, schemaVersion)
+    }
+}
+
+
let mediaView: UIView = { [weak self] index in
+   return UIView()
+}(index)
+
+

Triggering Examples

+
[1, 2].map {
+    ↓number in
+    number + 1
+}
+
+
[1, 2].map {
+    ↓number -> Int in
+    number + 1
+}
+
+
[1, 2].map {
+    (↓number: Int) -> Int in
+    number + 1
+}
+
+
[1, 2].map {
+    [weak ↓self] ↓number in
+    number + 1
+}
+
+
[1, 2].map { [weak self]
+    ↓number in
+    number + 1
+}
+
+
[1, 2].map({
+    ↓number in
+    number + 1
+})
+
+
[1, 2].something(closure: {
+    ↓number in
+    number + 1
+})
+
+
[1, 2].reduce(0) {
+    ↓sum, ↓number in
+    number + sum
+})
+
+
f.completionHandler = {
+    ↓thing in
+    doStuff()
+}
+
+
foo {
+    [weak ↓self] in
+    self?.bar()
+}
+
+ +
+
+ + +
+
+ + + diff --git a/closure_spacing.html b/closure_spacing.html new file mode 100644 index 000000000..92f966452 --- /dev/null +++ b/closure_spacing.html @@ -0,0 +1,390 @@ + + + + closure_spacing Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Closure Spacing

+ +

Closure expressions should have a single space inside each brace

+ +
    +
  • Identifier: closure_spacing
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
[].map ({ $0.description })
+
+
[].filter { $0.contains(location) }
+
+
extension UITableViewCell: ReusableView { }
+
+
extension UITableViewCell: ReusableView {}
+
+

Triggering Examples

+
[].filter↓{ $0.contains(location) }
+
+
[].filter(↓{$0.contains(location)})
+
+
[].map(↓{$0})
+
+
(↓{each in return result.contains(where: ↓{e in return e}) }).count
+
+
filter ↓{ sorted ↓{ $0 < $1}}
+
+ +
+
+ + +
+
+ + + diff --git a/collection_alignment.html b/collection_alignment.html new file mode 100644 index 000000000..784346183 --- /dev/null +++ b/collection_alignment.html @@ -0,0 +1,459 @@ + + + + collection_alignment Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Collection Element Alignment

+ +

All elements in a collection literal should be vertically aligned

+ +
    +
  • Identifier: collection_alignment
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +align_colons + +false +
  • +
+

Non Triggering Examples

+
doThings(arg: [
+    "foo": 1,
+    "bar": 2,
+    "fizz": 2,
+    "buzz": 2
+])
+
+
let abc = [
+    "alpha": "a",
+    "beta": "b",
+    "gamma": "g",
+    "delta": "d",
+    "epsilon": "e"
+]
+
+
let meals = [
+                "breakfast": "oatmeal",
+                "lunch": "sandwich",
+                "dinner": "burger"
+]
+
+
NSAttributedString(string: "…", attributes: [.font: UIFont.systemFont(ofSize: 12, weight: .regular),
+                                             .foregroundColor: UIColor(white: 0, alpha: 0.2)])
+
+
let coordinates = [
+    CLLocationCoordinate2D(latitude: 0, longitude: 33),
+    CLLocationCoordinate2D(latitude: 0, longitude: 66),
+    CLLocationCoordinate2D(latitude: 0, longitude: 99)
+]
+
+
var evenNumbers: Set<Int> = [
+    2,
+    4,
+    6
+]
+
+
let abc = [1, 2, 3, 4]
+
+
let abc = [
+    1, 2, 3, 4
+]
+
+
let abc = [
+    "foo": "bar", "fizz": "buzz"
+]
+
+

Triggering Examples

+
doThings(arg: [
+    "foo": 1,
+    "bar": 2,
+   ↓"fizz": 2,
+   ↓"buzz": 2
+])
+
+
let abc = [
+    "alpha": "a",
+     ↓"beta": "b",
+    "gamma": "g",
+    "delta": "d",
+  ↓"epsilon": "e"
+]
+
+
let meals = [
+                "breakfast": "oatmeal",
+                "lunch": "sandwich",
+    ↓"dinner": "burger"
+]
+
+
let coordinates = [
+    CLLocationCoordinate2D(latitude: 0, longitude: 33),
+        ↓CLLocationCoordinate2D(latitude: 0, longitude: 66),
+    CLLocationCoordinate2D(latitude: 0, longitude: 99)
+]
+
+
var evenNumbers: Set<Int> = [
+    2,
+  ↓4,
+    6
+]
+
+ +
+
+ + +
+
+ + + diff --git a/colon.html b/colon.html new file mode 100644 index 000000000..bfdd6d377 --- /dev/null +++ b/colon.html @@ -0,0 +1,600 @@ + + + + colon Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Colon Spacing

+ +

Colons should be next to the identifier when specifying a type and next to the key in dictionary literals

+ +
    +
  • Identifier: colon
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +flexible_right_spacing + +false +
    +apply_to_dictionaries + +true +
  • +
+

Non Triggering Examples

+
let abc: Void
+
+
let abc: [Void: Void]
+
+
let abc: (Void, Void)
+
+
let abc: ([Void], String, Int)
+
+
let abc: [([Void], String, Int)]
+
+
let abc: String="def"
+
+
let abc: Int=0
+
+
let abc: Enum=Enum.Value
+
+
func abc(def: Void) {}
+
+
func abc(def: Void, ghi: Void) {}
+
+
let abc: String = "abc:"
+
+
let abc = [Void: Void]()
+
+
let abc = [1: [3: 2], 3: 4]
+
+
let abc = ["string": "string"]
+
+
let abc = ["string:string": "string"]
+
+
let abc: [String: Int]
+
+
func foo(bar: [String: Int]) {}
+
+
func foo() -> [String: Int] { return [:] }
+
+
let abc: Any
+
+
let abc: [Any: Int]
+
+
let abc: [String: Any]
+
+
class Foo: Bar {}
+
+
class Foo<T>: Bar {}
+
+
class Foo<T: Equatable>: Bar {}
+
+
class Foo<T, U>: Bar {}
+
+
class Foo<T: Equatable> {}
+
+
object.method(x: /* comment */ 5)
+
+
switch foo {
+case .bar:
+    _ = something()
+}
+
+
object.method(x: 5, y: "string")
+
+
object.method(x: 5, y:
+              "string")
+
+
object.method(5, y: "string")
+
+
func abc() { def(ghi: jkl) }
+
+
func abc(def: Void) { ghi(jkl: mno) }
+
+
class ABC { let def = ghi(jkl: mno) } }
+
+
func foo() { let dict = [1: 1] }
+
+
let aaa = Self.bbb ? Self.ccc : Self.ddd else {
+return nil
+Example("}
+
+
range.flatMap(file.syntaxMap.kinds(inByteRange:)) ?? []
+
+
@objc(receiveReply:)
+public class func receiveReply(_ reply: bad_instruction_exception_reply_t) -> CInt { 0 }
+
+
switch str {
+case "adlm", "adlam":             return .adlam
+case "aghb", "caucasianalbanian": return .caucasianAlbanian
+default:                          return nil
+}
+
+
precedencegroup PipelinePrecedence {
+  associativity: left
+}
+infix operator |> : PipelinePrecedence
+
+
switch scalar {
+  case 0x000A...0x000D /* LF ... CR */: return true
+  case 0x0085 /* NEXT LINE (NEL) */: return true
+  case 0x2028 /* LINE SEPARATOR */: return true
+  case 0x2029 /* PARAGRAPH SEPARATOR */: return true
+  default: return false
+}
+
+

Triggering Examples

+
let abc↓:Void
+
+
let abc↓:  Void
+
+
let abc↓ :Void
+
+
let abc↓ : Void
+
+
let abc↓ : [Void: Void]
+
+
let abc↓ : (Void, String, Int)
+
+
let abc↓ : ([Void], String, Int)
+
+
let abc↓ : [([Void], String, Int)]
+
+
let abc↓:  (Void, String, Int)
+
+
let abc↓:  ([Void], String, Int)
+
+
let abc↓:  [([Void], String, Int)]
+
+
let abc↓ :String="def"
+
+
let abc↓ :Int=0
+
+
let abc↓ :Int = 0
+
+
let abc↓:Int=0
+
+
let abc↓:Int = 0
+
+
let abc↓:Enum=Enum.Value
+
+
func abc(def↓:Void) {}
+
+
func abc(def↓:  Void) {}
+
+
func abc(def↓ :Void) {}
+
+
func abc(def↓ : Void) {}
+
+
func abc(def: Void, ghi↓ :Void) {}
+
+
let abc = [Void↓:Void]()
+
+
let abc = [Void↓ : Void]()
+
+
let abc = [Void↓:  Void]()
+
+
let abc = [Void↓ :  Void]()
+
+
let abc = [1: [3↓ : 2], 3: 4]
+
+
let abc = [1: [3↓ : 2], 3↓:  4]
+
+
let abc: [String↓ : Int]
+
+
let abc: [String↓:Int]
+
+
func foo(bar: [String↓ : Int]) {}
+
+
func foo(bar: [String↓:Int]) {}
+
+
func foo() -> [String↓ : Int] { return [:] }
+
+
func foo() -> [String↓:Int] { return [:] }
+
+
let abc↓ : Any
+
+
let abc: [Any↓ : Int]
+
+
let abc: [String↓ : Any]
+
+
class Foo↓ : Bar {}
+
+
class Foo↓:Bar {}
+
+
class Foo<T>↓ : Bar {}
+
+
class Foo<T>↓:Bar {}
+
+
class Foo<T, U>↓:Bar {}
+
+
class Foo<T: Equatable>↓:Bar {}
+
+
class Foo<T↓:Equatable> {}
+
+
class Foo<T↓ : Equatable> {}
+
+
object.method(x: 5, y↓ : "string")
+
+
object.method(x↓:5, y: "string")
+
+
object.method(x↓:  5, y: "string")
+
+
func abc() { def(ghi↓:jkl) }
+
+
func abc(def: Void) { ghi(jkl↓:mno) }
+
+
class ABC { let def = ghi(jkl↓:mno) } }
+
+
func foo() { let dict = [1↓ : 1] }
+
+
switch foo {
+case .bar↓ : return baz
+}
+
+
private var action↓:(() -> Void)?
+
+ +
+
+ + +
+
+ + + diff --git a/comma.html b/comma.html new file mode 100644 index 000000000..f2dc2d8a3 --- /dev/null +++ b/comma.html @@ -0,0 +1,422 @@ + + + + comma Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Comma Spacing

+ +

There should be no space before and one after any comma

+ +
    +
  • Identifier: comma
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func abc(a: String, b: String) { }
+
+
abc(a: "string", b: "string"
+
+
enum a { case a, b, c }
+
+
func abc(
+  a: String,  // comment
+  bcd: String // comment
+) {
+}
+
+
func abc(
+  a: String,
+  bcd: String
+) {
+}
+
+
#imageLiteral(resourceName: "foo,bar,baz")
+
+
kvcStringBuffer.advanced(by: rootKVCLength)
+  .storeBytes(of: 0x2E /* '.' */, as: CChar.self)
+
+

Triggering Examples

+
func abc(a: String↓ ,b: String) { }
+
+
func abc(a: String↓ ,b: String↓ ,c: String↓ ,d: String) { }
+
+
abc(a: "string"↓,b: "string"
+
+
enum a { case a↓ ,b }
+
+
let result = plus(
+    first: 3↓ , // #683
+    second: 4
+)
+
+
Foo(
+  parameter: a.b.c,
+  tag: a.d,
+  value: a.identifier.flatMap { Int64($0) }↓ ,
+  reason: Self.abcd()
+)
+
+
return Foo(bar: .baz, title: fuzz,
+          message: My.Custom.message↓ ,
+          another: parameter, doIt: true,
+          alignment: .center)
+
+
Logger.logError("Hat is too large"↓,  info: [])
+
+ +
+
+ + +
+
+ + + diff --git a/comma_inheritance.html b/comma_inheritance.html new file mode 100644 index 000000000..9c58d2a33 --- /dev/null +++ b/comma_inheritance.html @@ -0,0 +1,406 @@ + + + + comma_inheritance Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Comma Inheritance Rule

+ +

Use commas to separate types in inheritance lists

+ +
    +
  • Identifier: comma_inheritance
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
struct A: Codable, Equatable {}
+
+
enum B: Codable, Equatable {}
+
+
class C: Codable, Equatable {}
+
+
protocol D: Codable, Equatable {}
+
+
typealias E = Equatable & Codable
+
+
func foo<T: Equatable & Codable>(_ param: T) {}
+
+
protocol G {
+    associatedtype Model: Codable, Equatable
+}
+
+

Triggering Examples

+
struct A: Codable↓ & Equatable {}
+
+
struct A: Codable↓  & Equatable {}
+
+
struct A: Codable↓&Equatable {}
+
+
struct A: Codable↓& Equatable {}
+
+
enum B: Codable↓ & Equatable {}
+
+
class C: Codable↓ & Equatable {}
+
+
protocol D: Codable↓ & Equatable {}
+
+
protocol G {
+    associatedtype Model: Codable↓ & Equatable
+}
+
+ +
+
+ + +
+
+ + + diff --git a/comment_spacing.html b/comment_spacing.html new file mode 100644 index 000000000..de98f4462 --- /dev/null +++ b/comment_spacing.html @@ -0,0 +1,428 @@ + + + + comment_spacing Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Comment Spacing

+ +

Prefer at least one space after slashes for comments

+ +
    +
  • Identifier: comment_spacing
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
// This is a comment
+
+
/// Triple slash comment
+
+
// Multiline double-slash
+// comment
+
+
/// Multiline triple-slash
+/// comment
+
+
/// Multiline triple-slash
+///   - This is indented
+
+
// - MARK: Mark comment
+
+
//: Swift Playground prose section
+
+
///////////////////////////////////////////////
+// Comment with some lines of slashes boxing it
+///////////////////////////////////////////////
+
+
//:#localized(key: "SwiftPlaygroundLocalizedProse")
+
+
/* Asterisk comment */
+
+
/*
+    Multiline asterisk comment
+*/
+
+
/*:
+    Multiline Swift Playground prose section
+*/
+
+
/*#-editable-code Swift Playground editable area*/default/*#-end-editable-code*/
+
+

Triggering Examples

+
//↓Something
+
+
//↓MARK
+
+
//↓👨‍👨‍👦‍👦Something
+
+
func a() {
+    //↓This needs refactoring
+    print("Something")
+}
+//↓We should improve above function
+
+
///↓This is a comment
+
+
/// Multiline triple-slash
+///↓This line is incorrect, though
+
+
//↓- MARK: Mark comment
+
+
//:↓Swift Playground prose section
+
+ +
+
+ + +
+
+ + + diff --git a/compiler_protocol_init.html b/compiler_protocol_init.html new file mode 100644 index 000000000..fffedc535 --- /dev/null +++ b/compiler_protocol_init.html @@ -0,0 +1,384 @@ + + + + compiler_protocol_init Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Compiler Protocol Init

+ +

The initializers declared in compiler protocols such as ExpressibleByArrayLiteral shouldn’t be called directly.

+ +
    +
  • Identifier: compiler_protocol_init
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let set: Set<Int> = [1, 2]
+
+
let set = Set(array)
+
+

Triggering Examples

+
let set = ↓Set(arrayLiteral: 1, 2)
+
+
let set = ↓Set (arrayLiteral: 1, 2)
+
+
let set = ↓Set.init(arrayLiteral: 1, 2)
+
+
let set = ↓Set.init(arrayLiteral : 1, 2)
+
+ +
+
+ + +
+
+ + + diff --git a/computed_accessors_order.html b/computed_accessors_order.html new file mode 100644 index 000000000..53ea9643b --- /dev/null +++ b/computed_accessors_order.html @@ -0,0 +1,577 @@ + + + + computed_accessors_order Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Computed Accessors Order

+ +

Getter and setters in computed properties and subscripts should be in a consistent order.

+ +
    +
  • Identifier: computed_accessors_order
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +order + +get_set +
  • +
+

Non Triggering Examples

+
class Foo {
+    var foo: Int {
+        get { return 3 }
+        set { _abc = newValue }
+    }
+}
+
+
class Foo {
+    var foo: Int {
+        return 20
+    }
+}
+
+
class Foo {
+    static var foo: Int {
+        return 20
+    }
+}
+
+
class Foo {
+    static var foo: Int {
+        get { return 3 }
+        set { _abc = newValue }
+    }
+}
+
+
class Foo {
+    var foo: Int
+}
+
+
class Foo {
+    var foo: Int {
+        return getValueFromDisk()
+    }
+}
+
+
class Foo {
+    var foo: String {
+        return "get"
+    }
+}
+
+
protocol Foo {
+    var foo: Int { get }
+
+
protocol Foo {
+    var foo: Int { get set }
+}
+
+
protocol Foo {
+    var foo: Int { set get }
+
+
class Foo {
+    var foo: Int {
+        struct Bar {
+            var bar: Int {
+                get { return 1 }
+                set { _ = newValue }
+            }
+        }
+
+        return Bar().bar
+    }
+}
+
+
var _objCTaggedPointerBits: UInt {
+    @inline(__always) get { return 0 }
+    set { print(newValue) }
+}
+
+
var next: Int? {
+    mutating get {
+        defer { self.count += 1 }
+        return self.count
+    }
+    set {
+        self.count = newValue
+    }
+}
+
+
extension Foo {
+    var bar: Bool {
+        get { _bar }
+        set { self._bar = newValue }
+    }
+}
+
+
extension Foo {
+    var bar: Bool {
+        get { _bar }
+        set(newValue) { self._bar = newValue }
+    }
+}
+
+
extension Reactive where Base: UITapGestureRecognizer {
+    var tapped: CocoaAction<Base>? {
+        get {
+            return associatedAction.withValue { $0.flatMap { $0.action } }
+        }
+        nonmutating set {
+            setAction(newValue)
+        }
+    }
+}
+
+
extension Test {
+    var foo: Bool {
+        get {
+            bar?.boolValue ?? true // Comment mentioning word set which triggers violation
+        }
+        set {
+            bar = NSNumber(value: newValue as Bool)
+        }
+    }
+}
+
+
class Foo {
+    subscript(i: Int) -> Int {
+        return 20
+    }
+}
+
+
class Foo {
+    subscript(i: Int) -> Int {
+        get { return 3 }
+        set { _abc = newValue }
+    }
+}
+
+
protocol Foo {
+    subscript(i: Int) -> Int { get }
+}
+
+
protocol Foo {
+    subscript(i: Int) -> Int { get set }
+}
+
+
protocol Foo {
+    subscript(i: Int) -> Int { set get }
+}
+
+

Triggering Examples

+
class Foo {
+    var foo: Int {
+        ↓set {
+            print(newValue)
+        }
+        get {
+            return 20
+        }
+    }
+}
+
+
class Foo {
+    static var foo: Int {
+        ↓set {
+            print(newValue)
+        }
+        get {
+            return 20
+        }
+    }
+}
+
+
var foo: Int {
+    ↓set { print(newValue) }
+    get { return 20 }
+}
+
+
extension Foo {
+    var bar: Bool {
+        ↓set { print(bar) }
+        get { _bar }
+    }
+}
+
+
class Foo {
+    var foo: Int {
+        ↓set {
+            print(newValue)
+        }
+        mutating get {
+            return 20
+        }
+    }
+}
+
+
class Foo {
+    subscript(i: Int) -> Int {
+        ↓set {
+            print(i)
+        }
+        get {
+            return 20
+        }
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/conditional_returns_on_newline.html b/conditional_returns_on_newline.html new file mode 100644 index 000000000..987c79b36 --- /dev/null +++ b/conditional_returns_on_newline.html @@ -0,0 +1,417 @@ + + + + conditional_returns_on_newline Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Conditional Returns on Newline

+ +

Conditional statements should always return on the next line

+ +
    +
  • Identifier: conditional_returns_on_newline
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +if_only + +false +
  • +
+

Non Triggering Examples

+
guard true else {
+ return true
+}
+
+
guard true,
+ let x = true else {
+ return true
+}
+
+
if true else {
+ return true
+}
+
+
if true,
+ let x = true else {
+ return true
+}
+
+
if textField.returnKeyType == .Next {
+
+
if true { // return }
+
+
guard something
+else { return }
+
+

Triggering Examples

+
↓guard true else { return }
+
+
↓if true { return }
+
+
↓if true { break } else { return }
+
+
↓if true { break } else {       return }
+
+
↓if true { return "YES" } else { return "NO" }
+
+
↓guard condition else { XCTFail(); return }
+
+ +
+
+ + +
+
+ + + diff --git a/contains_over_filter_count.html b/contains_over_filter_count.html new file mode 100644 index 000000000..6b3bfff3a --- /dev/null +++ b/contains_over_filter_count.html @@ -0,0 +1,414 @@ + + + + contains_over_filter_count Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Contains over Filter Count

+ +

Prefer contains over comparing filter(where:).count to 0

+ +
    +
  • Identifier: contains_over_filter_count
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let result = myList.filter(where: { $0 % 2 == 0 }).count > 1
+
+
let result = myList.filter { $0 % 2 == 0 }.count > 1
+
+
let result = myList.filter(where: { $0 % 2 == 0 }).count > 01
+
+
let result = myList.filter(where: { $0 % 2 == 0 }).count == 1
+
+
let result = myList.filter { $0 % 2 == 0 }.count == 1
+
+
let result = myList.filter(where: { $0 % 2 == 0 }).count == 01
+
+
let result = myList.filter(where: { $0 % 2 == 0 }).count != 1
+
+
let result = myList.filter { $0 % 2 == 0 }.count != 1
+
+
let result = myList.filter(where: { $0 % 2 == 0 }).count != 01
+
+
let result = myList.contains(where: { $0 % 2 == 0 })
+
+
let result = !myList.contains(where: { $0 % 2 == 0 })
+
+
let result = myList.contains(10)
+
+

Triggering Examples

+
let result = ↓myList.filter(where: { $0 % 2 == 0 }).count > 0
+
+
let result = ↓myList.filter { $0 % 2 == 0 }.count > 0
+
+
let result = ↓myList.filter(where: someFunction).count > 0
+
+
let result = ↓myList.filter(where: { $0 % 2 == 0 }).count == 0
+
+
let result = ↓myList.filter { $0 % 2 == 0 }.count == 0
+
+
let result = ↓myList.filter(where: someFunction).count == 0
+
+
let result = ↓myList.filter(where: { $0 % 2 == 0 }).count != 0
+
+
let result = ↓myList.filter { $0 % 2 == 0 }.count != 0
+
+
let result = ↓myList.filter(where: someFunction).count != 0
+
+ +
+
+ + +
+
+ + + diff --git a/contains_over_filter_is_empty.html b/contains_over_filter_is_empty.html new file mode 100644 index 000000000..5d4301aa1 --- /dev/null +++ b/contains_over_filter_is_empty.html @@ -0,0 +1,398 @@ + + + + contains_over_filter_is_empty Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Contains over Filter is Empty

+ +

Prefer contains over using filter(where:).isEmpty

+ +
    +
  • Identifier: contains_over_filter_is_empty
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let result = myList.filter(where: { $0 % 2 == 0 }).count > 1
+
+
let result = myList.filter { $0 % 2 == 0 }.count > 1
+
+
let result = myList.filter(where: { $0 % 2 == 0 }).count == 1
+
+
let result = myList.filter { $0 % 2 == 0 }.count == 1
+
+
let result = myList.filter(where: { $0 % 2 == 0 }).count != 1
+
+
let result = myList.filter { $0 % 2 == 0 }.count != 1
+
+
let result = myList.contains(where: { $0 % 2 == 0 })
+
+
let result = !myList.contains(where: { $0 % 2 == 0 })
+
+
let result = myList.contains(10)
+
+

Triggering Examples

+
let result = ↓myList.filter(where: { $0 % 2 == 0 }).isEmpty
+
+
let result = !↓myList.filter(where: { $0 % 2 == 0 }).isEmpty
+
+
let result = ↓myList.filter { $0 % 2 == 0 }.isEmpty
+
+
let result = ↓myList.filter(where: someFunction).isEmpty
+
+ +
+
+ + +
+
+ + + diff --git a/contains_over_first_not_nil.html b/contains_over_first_not_nil.html new file mode 100644 index 000000000..5a40edd9f --- /dev/null +++ b/contains_over_first_not_nil.html @@ -0,0 +1,428 @@ + + + + contains_over_first_not_nil Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Contains over First not Nil

+ +

Prefer contains over first(where:) != nil and firstIndex(where:) != nil.

+ +
    +
  • Identifier: contains_over_first_not_nil
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let first = myList.first(where: { $0 % 2 == 0 })
+
+
let first = myList.first { $0 % 2 == 0 }
+
+
let firstIndex = myList.firstIndex(where: { $0 % 2 == 0 })
+
+
let firstIndex = myList.firstIndex { $0 % 2 == 0 }
+
+

Triggering Examples

+
↓myList.first { $0 % 2 == 0 } != nil
+
+
↓myList.first(where: { $0 % 2 == 0 }) != nil
+
+
↓myList.map { $0 + 1 }.first(where: { $0 % 2 == 0 }) != nil
+
+
↓myList.first(where: someFunction) != nil
+
+
↓myList.map { $0 + 1 }.first { $0 % 2 == 0 } != nil
+
+
(↓myList.first { $0 % 2 == 0 }) != nil
+
+
↓myList.first { $0 % 2 == 0 } == nil
+
+
↓myList.first(where: { $0 % 2 == 0 }) == nil
+
+
↓myList.map { $0 + 1 }.first(where: { $0 % 2 == 0 }) == nil
+
+
↓myList.first(where: someFunction) == nil
+
+
↓myList.map { $0 + 1 }.first { $0 % 2 == 0 } == nil
+
+
(↓myList.first { $0 % 2 == 0 }) == nil
+
+
↓myList.firstIndex { $0 % 2 == 0 } != nil
+
+
↓myList.firstIndex(where: { $0 % 2 == 0 }) != nil
+
+
↓myList.map { $0 + 1 }.firstIndex(where: { $0 % 2 == 0 }) != nil
+
+
↓myList.firstIndex(where: someFunction) != nil
+
+
↓myList.map { $0 + 1 }.firstIndex { $0 % 2 == 0 } != nil
+
+
(↓myList.firstIndex { $0 % 2 == 0 }) != nil
+
+
↓myList.firstIndex { $0 % 2 == 0 } == nil
+
+
↓myList.firstIndex(where: { $0 % 2 == 0 }) == nil
+
+
↓myList.map { $0 + 1 }.firstIndex(where: { $0 % 2 == 0 }) == nil
+
+
↓myList.firstIndex(where: someFunction) == nil
+
+
↓myList.map { $0 + 1 }.firstIndex { $0 % 2 == 0 } == nil
+
+
(↓myList.firstIndex { $0 % 2 == 0 }) == nil
+
+ +
+
+ + +
+
+ + + diff --git a/contains_over_range_nil_comparison.html b/contains_over_range_nil_comparison.html new file mode 100644 index 000000000..8a92a389d --- /dev/null +++ b/contains_over_range_nil_comparison.html @@ -0,0 +1,384 @@ + + + + contains_over_range_nil_comparison Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Contains over Range Comparison to Nil

+ +

Prefer contains over range(of:) != nil and range(of:) == nil

+ +
    +
  • Identifier: contains_over_range_nil_comparison
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let range = myString.range(of: "Test")
+
+
myString.contains("Test")
+
+
!myString.contains("Test")
+
+
resourceString.range(of: rule.regex, options: .regularExpression) != nil
+
+

Triggering Examples

+
↓myString.range(of: "Test") != nil
+
+
↓myString.range(of: "Test") == nil
+
+ +
+
+ + +
+
+ + + diff --git a/contrasted_opening_brace.html b/contrasted_opening_brace.html new file mode 100644 index 000000000..b26355fc4 --- /dev/null +++ b/contrasted_opening_brace.html @@ -0,0 +1,557 @@ + + + + contrasted_opening_brace Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Contrasted Opening Brace

+ +

The correct positioning of braces that introduce a block of code or member list is highly controversial. No matter which style is preferred, consistency is key. Apart from different tastes, the positioning of braces can also have a significant impact on the readability of the code, especially for visually impaired developers. This rule ensures that braces are on a separate line after the declaration to contrast the code block from the rest of the declaration. Comments between the declaration and the opening brace are respected. Check out the opening_brace rule for a different style.

+ +
    +
  • Identifier: contrasted_opening_brace
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func abc()
+{
+}
+
+
[].map()
+{
+    $0
+}
+
+
[].map(
+    {
+    }
+)
+
+
if let a = b
+{
+}
+
+
while a == b
+{
+}
+
+
guard let a = b else
+{
+}
+
+
struct Rule
+{
+}
+
+
struct Parent
+{
+    struct Child
+    {
+        let foo: Int
+    }
+}
+
+
func f(rect: CGRect)
+{
+    {
+        let centre = CGPoint(x: rect.midX, y: rect.midY)
+        print(centre)
+    }()
+}
+
+
func f(rect: CGRect) -> () -> Void
+{
+    {
+        let centre = CGPoint(x: rect.midX, y: rect.midY)
+        print(centre)
+    }
+}
+
+
func f() -> () -> Void
+{
+    {}
+}
+
+
@MyProperty class Rule:
+  NSObject
+{
+  var a: String
+  {
+    return ""
+  }
+}
+
+
self.foo(
+    (
+        "String parameter",
+        { "Do something here" }
+    )
+)
+
+
let pattern = #/(\{(?<key>\w+)\})/#
+
+
if c
+{}
+else
+{}
+
+
    if c /* comment */
+    {
+        return
+    }
+
+
if c1
+{
+  return
+} else if c2
+{
+  return
+} else if c3
+{
+  return
+}
+
+
let a = f.map
+{ a in
+    a
+}
+
+

Triggering Examples

+
func abc()↓{
+}
+
+
func abc() { }
+
+
func abc(a: A,
+         b: B) {}
+
+
[].map { $0 }
+
+
struct OldContentView: View ↓{
+  @State private var showOptions = false
+
+  var body: some View ↓{
+    Button(action: {
+      self.showOptions.toggle()
+    })↓{
+      Image(systemName: "gear")
+    } label: ↓{
+      Image(systemName: "gear")
+    }
+  }
+}
+
+
class Rule
+{
+  var a: String↓{
+    return ""
+  }
+}
+
+
@MyProperty class Rule
+{
+  var a: String
+  {
+    willSet↓{
+
+    }
+    didSet  ↓{
+
+    }
+  }
+}
+
+
precedencegroup Group ↓{
+  assignment: true
+}
+
+
if
+    "test".isEmpty ↓{
+    // code here
+}
+
+
if c  ↓{}
+else /* comment */  ↓{}
+
+
if c
+  ↓{
+    // code here
+}
+
+
if c1 ↓{
+  return
+} else if c2↓{
+  return
+} else if c3
+ ↓{
+  return
+}
+
+
func f()
+{
+    return a.map
+            ↓{ $0 }
+}
+
+
a ↓{
+    $0
+} b: ↓{
+    $1
+}
+
+ +
+
+ + +
+
+ + + diff --git a/control_statement.html b/control_statement.html new file mode 100644 index 000000000..3ff876de3 --- /dev/null +++ b/control_statement.html @@ -0,0 +1,434 @@ + + + + control_statement Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Control Statement

+ +

if, for, guard, switch, while, and catch statements shouldn’t unnecessarily wrap their conditionals or arguments in parentheses

+ +
    +
  • Identifier: control_statement
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
if condition {}
+
+
if (a, b) == (0, 1) {}
+
+
if (a || b) && (c || d) {}
+
+
if (min...max).contains(value) {}
+
+
if renderGif(data) {}
+
+
renderGif(data)
+
+
guard condition else {}
+
+
while condition {}
+
+
do {} while condition {}
+
+
do { ; } while condition {}
+
+
switch foo {}
+
+
do {} catch let error as NSError {}
+
+
foo().catch(all: true) {}
+
+
if max(a, b) < c {}
+
+
switch (lhs, rhs) {}
+
+
if (f() { g() {} }) {}
+
+
if (a + f() {} == 1) {}
+
+
if ({ true }()) {}
+
+

Triggering Examples

+
↓if (condition) {}
+
+
↓if(condition) {}
+
+
↓if (condition == endIndex) {}
+
+
↓if ((a || b) && (c || d)) {}
+
+
↓if ((min...max).contains(value)) {}
+
+
↓guard (condition) else {}
+
+
↓while (condition) {}
+
+
↓while(condition) {}
+
+
do { ; } ↓while(condition) {}
+
+
do { ; } ↓while (condition) {}
+
+
↓switch (foo) {}
+
+
do {} ↓catch(let error as NSError) {}
+
+
↓if (max(a, b) < c) {}
+
+ +
+
+ + +
+
+ + + diff --git a/convenience_type.html b/convenience_type.html new file mode 100644 index 000000000..32cf109c3 --- /dev/null +++ b/convenience_type.html @@ -0,0 +1,449 @@ + + + + convenience_type Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Convenience Type

+ +

Types used for hosting only static members should be implemented as a caseless enum to avoid instantiation

+ +
    +
  • Identifier: convenience_type
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
enum Math { // enum
+  public static let pi = 3.14
+}
+
+
// class with inheritance
+class MathViewController: UIViewController {
+  public static let pi = 3.14
+}
+
+
@objc class Math: NSObject { // class visible to Obj-C
+  public static let pi = 3.14
+}
+
+
struct Math { // type with non-static declarations
+  public static let pi = 3.14
+  public let randomNumber = 2
+}
+
+
class DummyClass {}
+
+
class Foo: NSObject { // class with Obj-C class property
+    class @objc let foo = 1
+}
+
+
class Foo: NSObject { // class with Obj-C static property
+    static @objc let foo = 1
+}
+
+
class Foo { // @objc class func can't exist on an enum
+   @objc class func foo() {}
+}
+
+
class Foo { // @objc static func can't exist on an enum
+   @objc static func foo() {}
+}
+
+
@objcMembers class Foo { // @objc static func can't exist on an enum
+   static func foo() {}
+}
+
+
final class Foo { // final class, but @objc class func can't exist on an enum
+   @objc class func foo() {}
+}
+
+
final class Foo { // final class, but @objc static func can't exist on an enum
+   @objc static func foo() {}
+}
+
+
@globalActor actor MyActor {
+  static let shared = MyActor()
+}
+
+

Triggering Examples

+
↓struct Math {
+  public static let pi = 3.14
+}
+
+
↓struct Math {
+  public static let pi = 3.14
+  @available(*, unavailable) init() {}
+}
+
+
final ↓class Foo { // final class can't be inherited
+    class let foo = 1
+}
+
+
↓class Foo {
+    class let foo = 1
+}
+
+
↓class Foo {
+    final class let foo = 1
+}
+
+
↓class SomeClass {
+    static func foo() {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/css/highlight.css b/css/highlight.css new file mode 100644 index 000000000..c170357ce --- /dev/null +++ b/css/highlight.css @@ -0,0 +1,202 @@ +/*! Jazzy - https://github.com/realm/jazzy + * Copyright Realm Inc. + * SPDX-License-Identifier: MIT + */ +/* Credit to https://gist.github.com/wataru420/2048287 */ +.highlight .c { + color: #999988; + font-style: italic; } + +.highlight .err { + color: #a61717; + background-color: #e3d2d2; } + +.highlight .k { + color: #000000; + font-weight: bold; } + +.highlight .o { + color: #000000; + font-weight: bold; } + +.highlight .cm { + color: #999988; + font-style: italic; } + +.highlight .cp { + color: #999999; + font-weight: bold; } + +.highlight .c1 { + color: #999988; + font-style: italic; } + +.highlight .cs { + color: #999999; + font-weight: bold; + font-style: italic; } + +.highlight .gd { + color: #000000; + background-color: #ffdddd; } + +.highlight .gd .x { + color: #000000; + background-color: #ffaaaa; } + +.highlight .ge { + color: #000000; + font-style: italic; } + +.highlight .gr { + color: #aa0000; } + +.highlight .gh { + color: #999999; } + +.highlight .gi { + color: #000000; + background-color: #ddffdd; } + +.highlight .gi .x { + color: #000000; + background-color: #aaffaa; } + +.highlight .go { + color: #888888; } + +.highlight .gp { + color: #555555; } + +.highlight .gs { + font-weight: bold; } + +.highlight .gu { + color: #aaaaaa; } + +.highlight .gt { + color: #aa0000; } + +.highlight .kc { + color: #000000; + font-weight: bold; } + +.highlight .kd { + color: #000000; + font-weight: bold; } + +.highlight .kp { + color: #000000; + font-weight: bold; } + +.highlight .kr { + color: #000000; + font-weight: bold; } + +.highlight .kt { + color: #445588; } + +.highlight .m { + color: #009999; } + +.highlight .s { + color: #d14; } + +.highlight .na { + color: #008080; } + +.highlight .nb { + color: #0086B3; } + +.highlight .nc { + color: #445588; + font-weight: bold; } + +.highlight .no { + color: #008080; } + +.highlight .ni { + color: #800080; } + +.highlight .ne { + color: #990000; + font-weight: bold; } + +.highlight .nf { + color: #990000; } + +.highlight .nn { + color: #555555; } + +.highlight .nt { + color: #000080; } + +.highlight .nv { + color: #008080; } + +.highlight .ow { + color: #000000; + font-weight: bold; } + +.highlight .w { + color: #bbbbbb; } + +.highlight .mf { + color: #009999; } + +.highlight .mh { + color: #009999; } + +.highlight .mi { + color: #009999; } + +.highlight .mo { + color: #009999; } + +.highlight .sb { + color: #d14; } + +.highlight .sc { + color: #d14; } + +.highlight .sd { + color: #d14; } + +.highlight .s2 { + color: #d14; } + +.highlight .se { + color: #d14; } + +.highlight .sh { + color: #d14; } + +.highlight .si { + color: #d14; } + +.highlight .sx { + color: #d14; } + +.highlight .sr { + color: #009926; } + +.highlight .s1 { + color: #d14; } + +.highlight .ss { + color: #990073; } + +.highlight .bp { + color: #999999; } + +.highlight .vc { + color: #008080; } + +.highlight .vg { + color: #008080; } + +.highlight .vi { + color: #008080; } + +.highlight .il { + color: #009999; } diff --git a/css/jazzy.css b/css/jazzy.css new file mode 100644 index 000000000..9d4b08b8c --- /dev/null +++ b/css/jazzy.css @@ -0,0 +1,405 @@ +/*! Jazzy - https://github.com/realm/jazzy + * Copyright Realm Inc. + * SPDX-License-Identifier: MIT + */ +*, *:before, *:after { + box-sizing: inherit; } + +body { + margin: 0; + background: #fff; + color: #333; + font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif; + letter-spacing: .2px; + -webkit-font-smoothing: antialiased; + box-sizing: border-box; } + +h1 { + font-size: 2rem; + font-weight: 700; + margin: 1.275em 0 0.6em; } + +h2 { + font-size: 1.75rem; + font-weight: 700; + margin: 1.275em 0 0.3em; } + +h3 { + font-size: 1.5rem; + font-weight: 700; + margin: 1em 0 0.3em; } + +h4 { + font-size: 1.25rem; + font-weight: 700; + margin: 1.275em 0 0.85em; } + +h5 { + font-size: 1rem; + font-weight: 700; + margin: 1.275em 0 0.85em; } + +h6 { + font-size: 1rem; + font-weight: 700; + margin: 1.275em 0 0.85em; + color: #777; } + +p { + margin: 0 0 1em; } + +ul, ol { + padding: 0 0 0 2em; + margin: 0 0 0.85em; } + +blockquote { + margin: 0 0 0.85em; + padding: 0 15px; + color: #858585; + border-left: 4px solid #e5e5e5; } + +img { + max-width: 100%; } + +a { + color: #4183c4; + text-decoration: none; } + a:hover, a:focus { + outline: 0; + text-decoration: underline; } + a.discouraged { + text-decoration: line-through; } + a.discouraged:hover, a.discouraged:focus { + text-decoration: underline line-through; } + +table { + background: #fff; + width: 100%; + border-collapse: collapse; + border-spacing: 0; + overflow: auto; + margin: 0 0 0.85em; } + +tr:nth-child(2n) { + background-color: #fbfbfb; } + +th, td { + padding: 6px 13px; + border: 1px solid #ddd; } + +hr { + height: 1px; + border: none; + background-color: #ddd; } + +pre { + margin: 0 0 1.275em; + padding: .85em 1em; + overflow: auto; + background: #f7f7f7; + font-size: .85em; + font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; } + +code { + font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; } + +.item-container p > code, .item-container li > code, .top-matter p > code, .top-matter li > code { + background: #f7f7f7; + padding: .2em; } + .item-container p > code:before, .item-container p > code:after, .item-container li > code:before, .item-container li > code:after, .top-matter p > code:before, .top-matter p > code:after, .top-matter li > code:before, .top-matter li > code:after { + letter-spacing: -.2em; + content: "\00a0"; } + +pre code { + padding: 0; + white-space: pre; } + +.content-wrapper { + display: flex; + flex-direction: column; } + @media (min-width: 768px) { + .content-wrapper { + flex-direction: row; } } +.header { + display: flex; + padding: 8px; + font-size: 0.875em; + background: #444; + color: #999; } + +.header-col { + margin: 0; + padding: 0 8px; } + +.header-col--primary { + flex: 1; } + +.header-link { + color: #fff; } + +.header-icon { + padding-right: 2px; + vertical-align: -3px; + height: 16px; } + +.breadcrumbs { + font-size: 0.875em; + padding: 8px 16px; + margin: 0; + background: #fbfbfb; + border-bottom: 1px solid #ddd; } + +.carat { + height: 10px; + margin: 0 5px; } + +.navigation { + order: 2; } + @media (min-width: 768px) { + .navigation { + order: 1; + width: 25%; + max-width: 300px; + padding-bottom: 64px; + overflow: hidden; + word-wrap: normal; + background: #fbfbfb; + border-right: 1px solid #ddd; } } +.nav-groups { + list-style-type: none; + padding-left: 0; } + +.nav-group-name { + border-bottom: 1px solid #ddd; + padding: 8px 0 8px 16px; } + +.nav-group-name-link { + color: #333; } + +.nav-group-tasks { + margin: 8px 0; + padding: 0 0 0 8px; } + +.nav-group-task { + font-size: 1em; + list-style-type: none; + white-space: nowrap; } + +.nav-group-task-link { + color: #808080; } + +.main-content { + order: 1; } + @media (min-width: 768px) { + .main-content { + order: 2; + flex: 1; + padding-bottom: 60px; } } +.section { + padding: 0 32px; + border-bottom: 1px solid #ddd; } + +.section-content { + max-width: 834px; + margin: 0 auto; + padding: 16px 0; } + +.section-name { + color: #666; + display: block; } + .section-name p { + margin-bottom: inherit; } + +.declaration .highlight { + overflow-x: initial; + padding: 8px 0; + margin: 0; + background-color: transparent; + border: none; } + +.task-group-section { + border-top: 1px solid #ddd; } + +.task-group { + padding-top: 0px; } + +.task-name-container a[name]:before { + content: ""; + display: block; } + +.section-name-container { + position: relative; } + .section-name-container .section-name-link { + position: absolute; + top: 0; + left: 0; + bottom: 0; + right: 0; + margin-bottom: 0; } + .section-name-container .section-name { + position: relative; + pointer-events: none; + z-index: 1; } + .section-name-container .section-name a { + pointer-events: auto; } + +.item-container { + padding: 0; } + +.item { + padding-top: 8px; + width: 100%; + list-style-type: none; } + .item a[name]:before { + content: ""; + display: block; } + .item .token, .item .direct-link { + display: inline-block; + text-indent: -20px; + padding-left: 3px; + margin-left: 20px; + font-size: 1rem; } + +.declaration-note { + font-size: .85em; + color: #808080; + font-style: italic; } + +.pointer-container { + border-bottom: 1px solid #ddd; + left: -23px; + padding-bottom: 13px; + position: relative; + width: 110%; } + +.pointer { + left: 21px; + top: 7px; + display: block; + position: absolute; + width: 12px; + height: 12px; + border-left: 1px solid #ddd; + border-top: 1px solid #ddd; + background: #fff; + transform: rotate(45deg); } + +.height-container { + display: none; + position: relative; + width: 100%; + overflow: hidden; } + .height-container .section { + background: #fff; + border: 1px solid #ddd; + border-top-width: 0; + padding-top: 10px; + padding-bottom: 5px; + padding: 8px 16px; } + +.aside, .language { + padding: 6px 12px; + margin: 12px 0; + border-left: 5px solid #dddddd; + overflow-y: hidden; } + .aside .aside-title, .language .aside-title { + font-size: 9px; + letter-spacing: 2px; + text-transform: uppercase; + padding-bottom: 0; + margin: 0; + color: #aaa; + -webkit-user-select: none; } + .aside p:last-child, .language p:last-child { + margin-bottom: 0; } + +.language { + border-left: 5px solid #cde9f4; } + .language .aside-title { + color: #4183c4; } + +.aside-warning, .aside-deprecated, .aside-unavailable { + border-left: 5px solid #ff6666; } + .aside-warning .aside-title, .aside-deprecated .aside-title, .aside-unavailable .aside-title { + color: #ff0000; } + +.graybox { + border-collapse: collapse; + width: 100%; } + .graybox p { + margin: 0; + word-break: break-word; + min-width: 50px; } + .graybox td { + border: 1px solid #ddd; + padding: 5px 25px 5px 10px; + vertical-align: middle; } + .graybox tr td:first-of-type { + text-align: right; + padding: 7px; + vertical-align: top; + word-break: normal; + width: 40px; } + +.slightly-smaller { + font-size: 0.9em; } + +.footer { + padding: 8px 16px; + background: #444; + color: #ddd; + font-size: 0.8em; } + .footer p { + margin: 8px 0; } + .footer a { + color: #fff; } + +html.dash .header, html.dash .breadcrumbs, html.dash .navigation { + display: none; } + +html.dash .height-container { + display: block; } + +form[role=search] input { + font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 14px; + line-height: 24px; + padding: 0 10px; + margin: 0; + border: none; + border-radius: 1em; } + .loading form[role=search] input { + background: white url(../img/spinner.gif) center right 4px no-repeat; } + +form[role=search] .tt-menu { + margin: 0; + min-width: 300px; + background: #fbfbfb; + color: #333; + border: 1px solid #ddd; } + +form[role=search] .tt-highlight { + font-weight: bold; } + +form[role=search] .tt-suggestion { + font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif; + padding: 0 8px; } + form[role=search] .tt-suggestion span { + display: table-cell; + white-space: nowrap; } + form[role=search] .tt-suggestion .doc-parent-name { + width: 100%; + text-align: right; + font-weight: normal; + font-size: 0.9em; + padding-left: 16px; } + +form[role=search] .tt-suggestion:hover, +form[role=search] .tt-suggestion.tt-cursor { + cursor: pointer; + background-color: #4183c4; + color: #fff; } + +form[role=search] .tt-suggestion:hover .doc-parent-name, +form[role=search] .tt-suggestion.tt-cursor .doc-parent-name { + color: #fff; } diff --git a/custom_rules.html b/custom_rules.html new file mode 100644 index 000000000..67dea3cd0 --- /dev/null +++ b/custom_rules.html @@ -0,0 +1,354 @@ + + + + custom_rules Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Custom Rules

+ +

Create custom rules by providing a regex string. Optionally specify what syntax kinds to match against, the severity level, and what message to display.

+ +
    +
  • Identifier: custom_rules
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
+ +
+
+ + +
+
+ + + diff --git a/cyclomatic_complexity.html b/cyclomatic_complexity.html new file mode 100644 index 000000000..90566caf8 --- /dev/null +++ b/cyclomatic_complexity.html @@ -0,0 +1,439 @@ + + + + cyclomatic_complexity Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Cyclomatic Complexity

+ +

Complexity of function bodies should be limited.

+ +
    +
  • Identifier: cyclomatic_complexity
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: metrics
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +warning + +10 +
    +error + +20 +
    +ignores_case_statements + +false +
  • +
+

Non Triggering Examples

+
func f1() {
+    if true {
+        for _ in 1..5 { }
+    }
+    if false { }
+}
+
+
func f(code: Int) -> Int {
+    switch code {
+    case 0: fallthrough
+    case 1: return 1
+    case 2: return 1
+    case 3: return 1
+    case 4: return 1
+    case 5: return 1
+    case 6: return 1
+    case 7: return 1
+    case 8: return 1
+    default: return 1
+    }
+}
+
+
func f1() {
+    if true {}; if true {}; if true {}; if true {}; if true {}; if true {}
+    func f2() {
+        if true {}; if true {}; if true {}; if true {}; if true {}
+    }
+}
+
+

Triggering Examples

+
↓func f1() {
+    if true {
+        if true {
+            if false {}
+        }
+    }
+    if false {}
+    let i = 0
+    switch i {
+        case 1: break
+        case 2: break
+        case 3: break
+        case 4: break
+        default: break
+    }
+    for _ in 1...5 {
+        guard true else {
+            return
+        }
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/deployment_target.html b/deployment_target.html new file mode 100644 index 000000000..e88b7c942 --- /dev/null +++ b/deployment_target.html @@ -0,0 +1,514 @@ + + + + deployment_target Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Deployment Target

+ +

Availability checks or attributes shouldn’t be using older versions that are satisfied by the deployment target.

+ +
    +
  • Identifier: deployment_target
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +iOSApplicationExtension_deployment_target + +7.0 +
    +iOS_deployment_target + +7.0 +
    +macOSApplicationExtension_deployment_target + +10.9 +
    +macOS_deployment_target + +10.9 +
    +tvOSApplicationExtension_deployment_target + +9.0 +
    +tvOS_deployment_target + +9.0 +
    +watchOSApplicationExtension_deployment_target + +1.0 +
    +watchOS_deployment_target + +1.0 +
  • +
+

Non Triggering Examples

+
@available(iOS 12.0, *)
+class A {}
+
+
@available(iOSApplicationExtension 13.0, *)
+class A {}
+
+
@available(watchOS 4.0, *)
+class A {}
+
+
@available(watchOSApplicationExtension 4.0, *)
+class A {}
+
+
@available(swift 3.0.2)
+class A {}
+
+
class A {}
+
+
if #available(iOS 10.0, *) {}
+
+
if #available(iOS 10, *) {}
+
+
guard #available(iOS 12.0, *) else { return }
+
+
#if #unavailable(iOS 15.0) {}
+
+
#guard #unavailable(iOS 15.0) {} else { return }
+
+

Triggering Examples

+
↓@available(iOS 6.0, *)
+class A {}
+
+
↓@available(iOSApplicationExtension 6.0, *)
+class A {}
+
+
↓@available(iOS 7.0, *)
+class A {}
+
+
↓@available(iOS 6, *)
+class A {}
+
+
↓@available(iOS 6.0, macOS 10.12, *)
+ class A {}
+
+
↓@available(macOS 10.12, iOS 6.0, *)
+ class A {}
+
+
↓@available(macOS 10.7, *)
+class A {}
+
+
↓@available(macOSApplicationExtension 10.7, *)
+class A {}
+
+
↓@available(OSX 10.7, *)
+class A {}
+
+
↓@available(watchOS 0.9, *)
+class A {}
+
+
↓@available(watchOSApplicationExtension 0.9, *)
+class A {}
+
+
↓@available(tvOS 8, *)
+class A {}
+
+
↓@available(tvOSApplicationExtension 8, *)
+class A {}
+
+
if ↓#available(iOS 6.0, *) {}
+
+
if ↓#available(iOS 6, *) {}
+
+
guard ↓#available(iOS 6.0, *) else { return }
+
+
if ↓#unavailable(iOS 7.0) {}
+
+
if ↓#unavailable(iOS 6.9) {}
+
+
guard ↓#unavailable(iOS 7.0) {} else { return }
+
+ +
+
+ + +
+
+ + + diff --git a/direct_return.html b/direct_return.html new file mode 100644 index 000000000..2f62af37d --- /dev/null +++ b/direct_return.html @@ -0,0 +1,434 @@ + + + + direct_return Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Direct Return

+ +

Directly return the expression instead of assigning it to a variable first

+ +
    +
  • Identifier: direct_return
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func f() -> Int {
+    let b = 2
+    let a = 1
+    return b
+}
+
+
struct S {
+    var a: Int {
+        var b = 1
+        b = 2
+        return b
+    }
+}
+
+
func f() -> Int {
+    let b = 2
+    f()
+    return b
+}
+
+
func f() -> Int {
+    { i in
+        let b = 2
+        return i
+    }(1)
+}
+
+

Triggering Examples

+
func f() -> Int {
+    let ↓b = 2
+    return b
+}
+
+
struct S {
+    var a: Int {
+        var ↓b = 1
+        // comment
+        return b
+    }
+}
+
+
func f() -> Bool {
+    let a = 1, ↓b = true
+    return b
+}
+
+
func f() -> Int {
+    { _ in
+        let ↓b = 2
+        return b
+    }(1)
+}
+
+
func f(i: Int) -> Int {
+    if i > 1 {
+        let ↓a = 2
+        return a
+    } else {
+        let ↓b = 2, a = 1
+        return b
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/discarded_notification_center_observer.html b/discarded_notification_center_observer.html new file mode 100644 index 000000000..1c73b3d7a --- /dev/null +++ b/discarded_notification_center_observer.html @@ -0,0 +1,438 @@ + + + + discarded_notification_center_observer Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Discarded Notification Center Observer

+ +

When registering for a notification using a block, the opaque observer that is returned should be stored so it can be removed later

+ +
    +
  • Identifier: discarded_notification_center_observer
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let foo = nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil) { }
+
+
let foo = nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { })
+
+
func foo() -> Any {
+    return nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { })
+}
+
+
func foo() -> Any {
+    nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { })
+}
+
+
var obs: [Any?] = []
+obs.append(nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { }))
+
+
var obs: [String: Any?] = []
+obs["foo"] = nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { })
+
+
var obs: [Any?] = []
+obs.append(nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { }))
+
+
func foo(_ notify: Any) {
+   obs.append(notify)
+}
+foo(nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { }))
+
+
var obs: [NSObjectProtocol] = [
+   nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { }),
+   nc.addObserver(forName: .CKAccountChanged, object: nil, queue: nil, using: { })
+]
+
+
names.map { self.notificationCenter.addObserver(forName: $0, object: object, queue: queue, using: block) }
+
+
f { return nc.addObserver(forName: $0, object: object, queue: queue, using: block) }
+
+

Triggering Examples

+
↓nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil) { }
+
+
_ = ↓nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil) { }
+
+
↓nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { })
+
+
@discardableResult func foo() -> Any {
+   return ↓nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { })
+}
+
+
class C {
+    var i: Int {
+        set { ↓notificationCenter.addObserver(forName: $0, object: object, queue: queue, using: block) }
+        get {
+            ↓notificationCenter.addObserver(forName: $0, object: object, queue: queue, using: block)
+            return 2
+        }
+    }
+}
+
+
f {
+    ↓nc.addObserver(forName: $0, object: object, queue: queue) {}
+    return 2
+}
+
+
func foo() -> Any {
+    if cond {
+        ↓nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { })
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/discouraged_assert.html b/discouraged_assert.html new file mode 100644 index 000000000..33c405cac --- /dev/null +++ b/discouraged_assert.html @@ -0,0 +1,390 @@ + + + + discouraged_assert Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Discouraged Assert

+ +

Prefer assertionFailure() and/or preconditionFailure() over assert(false)

+ +
    +
  • Identifier: discouraged_assert
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
assert(true)
+
+
assert(true, "foobar")
+
+
assert(true, "foobar", file: "toto", line: 42)
+
+
assert(false || true)
+
+
XCTAssert(false)
+
+

Triggering Examples

+
↓assert(false)
+
+
↓assert(false, "foobar")
+
+
↓assert(false, "foobar", file: "toto", line: 42)
+
+
↓assert(   false    , "foobar")
+
+ +
+
+ + +
+
+ + + diff --git a/discouraged_direct_init.html b/discouraged_direct_init.html new file mode 100644 index 000000000..46fcde286 --- /dev/null +++ b/discouraged_direct_init.html @@ -0,0 +1,422 @@ + + + + discouraged_direct_init Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Discouraged Direct Initialization

+ +

Discouraged direct initialization of types that can be harmful

+ +
    +
  • Identifier: discouraged_direct_init
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +types + +[“Bundle”, “Bundle.init”, “NSError”, “NSError.init”, “UIDevice”, “UIDevice.init”] +
  • +
+

Non Triggering Examples

+
let foo = UIDevice.current
+
+
let foo = Bundle.main
+
+
let foo = Bundle(path: "bar")
+
+
let foo = Bundle(identifier: "bar")
+
+
let foo = Bundle.init(path: "bar")
+
+
let foo = Bundle.init(identifier: "bar")
+
+
let foo = NSError(domain: "bar", code: 0)
+
+
let foo = NSError.init(domain: "bar", code: 0)
+
+
func testNSError()
+
+

Triggering Examples

+
↓UIDevice()
+
+
↓Bundle()
+
+
let foo = ↓UIDevice()
+
+
let foo = ↓Bundle()
+
+
let foo = ↓NSError()
+
+
let foo = bar(bundle: ↓Bundle(), device: ↓UIDevice(), error: ↓NSError())
+
+
↓UIDevice.init()
+
+
↓Bundle.init()
+
+
↓NSError.init()
+
+
let foo = ↓UIDevice.init()
+
+
let foo = ↓Bundle.init()
+
+
let foo = bar(bundle: ↓Bundle.init(), device: ↓UIDevice.init(), error: ↓NSError.init())
+
+ +
+
+ + +
+
+ + + diff --git a/discouraged_none_name.html b/discouraged_none_name.html new file mode 100644 index 000000000..6fccd8fe2 --- /dev/null +++ b/discouraged_none_name.html @@ -0,0 +1,500 @@ + + + + discouraged_none_name Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Discouraged None Name

+ +

Enum cases and static members named none are discouraged as they can conflict with Optional<T>.none.

+ +
    +
  • Identifier: discouraged_none_name
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
enum MyEnum {
+    case nOne
+}
+
+
enum MyEnum {
+    case _none
+}
+
+
enum MyEnum {
+    case none_
+}
+
+
enum MyEnum {
+    case none(Any)
+}
+
+
enum MyEnum {
+    case nonenone
+}
+
+
class MyClass {
+    class var nonenone: MyClass { MyClass() }
+}
+
+
class MyClass {
+    static var nonenone = MyClass()
+}
+
+
class MyClass {
+    static let nonenone = MyClass()
+}
+
+
struct MyStruct {
+    static var nonenone = MyStruct()
+}
+
+
struct MyStruct {
+    static let nonenone = MyStruct()
+}
+
+
struct MyStruct {
+    let none = MyStruct()
+}
+
+
struct MyStruct {
+    var none = MyStruct()
+}
+
+
class MyClass {
+    let none = MyClass()
+}
+
+
class MyClass {
+    var none = MyClass()
+}
+
+

Triggering Examples

+
enum MyEnum {
+    case ↓none
+}
+
+
enum MyEnum {
+    case a, ↓none
+}
+
+
enum MyEnum {
+    case ↓none, b
+}
+
+
enum MyEnum {
+    case a, ↓none, b
+}
+
+
enum MyEnum {
+    case a
+    case ↓none
+}
+
+
enum MyEnum {
+    case ↓none
+    case b
+}
+
+
enum MyEnum {
+    case a
+    case ↓none
+    case b
+}
+
+
class MyClass {
+    ↓static let none = MyClass()
+}
+
+
class MyClass {
+    ↓static let none: MyClass = MyClass()
+}
+
+
class MyClass {
+    ↓static var none: MyClass = MyClass()
+}
+
+
class MyClass {
+    ↓class var none: MyClass { MyClass() }
+}
+
+
struct MyStruct {
+    ↓static var none = MyStruct()
+}
+
+
struct MyStruct {
+    ↓static var none: MyStruct = MyStruct()
+}
+
+
struct MyStruct {
+    ↓static var none = MyStruct()
+}
+
+
struct MyStruct {
+    ↓static var none: MyStruct = MyStruct()
+}
+
+
struct MyStruct {
+    ↓static var a = MyStruct(), none = MyStruct()
+}
+
+
struct MyStruct {
+    ↓static var none = MyStruct(), a = MyStruct()
+}
+
+ +
+
+ + +
+
+ + + diff --git a/discouraged_object_literal.html b/discouraged_object_literal.html new file mode 100644 index 000000000..317c8b2ee --- /dev/null +++ b/discouraged_object_literal.html @@ -0,0 +1,404 @@ + + + + discouraged_object_literal Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Discouraged Object Literal

+ +

Prefer initializers over object literals

+ +
    +
  • Identifier: discouraged_object_literal
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +image_literal + +true +
    +color_literal + +true +
  • +
+

Non Triggering Examples

+
let image = UIImage(named: aVariable)
+
+
let image = UIImage(named: "interpolated \(variable)")
+
+
let color = UIColor(red: value, green: value, blue: value, alpha: 1)
+
+
let image = NSImage(named: aVariable)
+
+
let image = NSImage(named: "interpolated \(variable)")
+
+
let color = NSColor(red: value, green: value, blue: value, alpha: 1)
+
+

Triggering Examples

+
let image = ↓#imageLiteral(resourceName: "image.jpg")
+
+
let color = ↓#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)
+
+ +
+
+ + +
+
+ + + diff --git a/discouraged_optional_boolean.html b/discouraged_optional_boolean.html new file mode 100644 index 000000000..47c4ea333 --- /dev/null +++ b/discouraged_optional_boolean.html @@ -0,0 +1,756 @@ + + + + discouraged_optional_boolean Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Discouraged Optional Boolean

+ +

Prefer non-optional booleans over optional booleans

+ +
    +
  • Identifier: discouraged_optional_boolean
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
var foo: Bool
+
+
var foo: [String: Bool]
+
+
var foo: [Bool]
+
+
let foo: Bool = true
+
+
let foo: Bool = false
+
+
let foo: [String: Bool] = [:]
+
+
let foo: [Bool] = []
+
+
var foo: Bool { return true }
+
+
let foo: Bool { return false }()
+
+
func foo() -> Bool {}
+
+
func foo() -> [String: Bool] {}
+
+
func foo() -> ([Bool]) -> String {}
+
+
func foo(input: Bool = true) {}
+
+
func foo(input: [String: Bool] = [:]) {}
+
+
func foo(input: [Bool] = []) {}
+
+
class Foo {
+    func foo() -> Bool {}
+}
+
+
class Foo {
+    func foo() -> [String: Bool] {}
+}
+
+
class Foo {
+    func foo() -> ([Bool]) -> String {}
+}
+
+
struct Foo {
+    func foo() -> Bool {}
+}
+
+
struct Foo {
+    func foo() -> [String: Bool] {}
+}
+
+
struct Foo {
+    func foo() -> ([Bool]) -> String {}
+}
+
+
enum Foo {
+    func foo() -> Bool {}
+}
+
+
enum Foo {
+    func foo() -> [String: Bool] {}
+}
+
+
enum Foo {
+    func foo() -> ([Bool]) -> String {}
+}
+
+
class Foo {
+    func foo(input: Bool = true) {}
+}
+
+
class Foo {
+    func foo(input: [String: Bool] = [:]) {}
+}
+
+
class Foo {
+    func foo(input: [Bool] = []) {}
+}
+
+
struct Foo {
+    func foo(input: Bool = true) {}
+}
+
+
struct Foo {
+    func foo(input: [String: Bool] = [:]) {}
+}
+
+
struct Foo {
+    func foo(input: [Bool] = []) {}
+}
+
+
enum Foo {
+    func foo(input: Bool = true) {}
+}
+
+
enum Foo {
+    func foo(input: [String: Bool] = [:]) {}
+}
+
+
enum Foo {
+    func foo(input: [Bool] = []) {}
+}
+
+

Triggering Examples

+
var foo: ↓Bool?
+
+
var foo: [String: ↓Bool?]
+
+
var foo: [↓Bool?]
+
+
let foo: ↓Bool? = nil
+
+
let foo: [String: ↓Bool?] = [:]
+
+
let foo: [↓Bool?] = []
+
+
let foo = ↓Optional.some(false)
+
+
let foo = ↓Optional.some(true)
+
+
var foo: ↓Bool? { return nil }
+
+
let foo: ↓Bool? { return nil }()
+
+
func foo() -> ↓Bool? {}
+
+
func foo() -> [String: ↓Bool?] {}
+
+
func foo() -> [↓Bool?] {}
+
+
static func foo() -> ↓Bool? {}
+
+
static func foo() -> [String: ↓Bool?] {}
+
+
static func foo() -> [↓Bool?] {}
+
+
func foo() -> (↓Bool?) -> String {}
+
+
func foo() -> ([Int]) -> ↓Bool? {}
+
+
func foo(input: ↓Bool?) {}
+
+
func foo(input: [String: ↓Bool?]) {}
+
+
func foo(input: [↓Bool?]) {}
+
+
static func foo(input: ↓Bool?) {}
+
+
static func foo(input: [String: ↓Bool?]) {}
+
+
static func foo(input: [↓Bool?]) {}
+
+
class Foo {
+    var foo: ↓Bool?
+}
+
+
class Foo {
+    var foo: [String: ↓Bool?]
+}
+
+
class Foo {
+    let foo: ↓Bool? = nil
+}
+
+
class Foo {
+    let foo: [String: ↓Bool?] = [:]
+}
+
+
class Foo {
+    let foo: [↓Bool?] = []
+}
+
+
struct Foo {
+    var foo: ↓Bool?
+}
+
+
struct Foo {
+    var foo: [String: ↓Bool?]
+}
+
+
struct Foo {
+    let foo: ↓Bool? = nil
+}
+
+
struct Foo {
+    let foo: [String: ↓Bool?] = [:]
+}
+
+
struct Foo {
+    let foo: [↓Bool?] = []
+}
+
+
class Foo {
+    var foo: ↓Bool? { return nil }
+}
+
+
class Foo {
+    let foo: ↓Bool? { return nil }()
+}
+
+
struct Foo {
+    var foo: ↓Bool? { return nil }
+}
+
+
struct Foo {
+    let foo: ↓Bool? { return nil }()
+}
+
+
enum Foo {
+    var foo: ↓Bool? { return nil }
+}
+
+
enum Foo {
+    let foo: ↓Bool? { return nil }()
+}
+
+
class Foo {
+    func foo() -> ↓Bool? {}
+}
+
+
class Foo {
+    func foo() -> [String: ↓Bool?] {}
+}
+
+
class Foo {
+    func foo() -> [↓Bool?] {}
+}
+
+
class Foo {
+    static func foo() -> ↓Bool? {}
+}
+
+
class Foo {
+    static func foo() -> [String: ↓Bool?] {}
+}
+
+
class Foo {
+    static func foo() -> [↓Bool?] {}
+}
+
+
class Foo {
+    func foo() -> (↓Bool?) -> String {}
+}
+
+
class Foo {
+    func foo() -> ([Int]) -> ↓Bool? {}
+}
+
+
struct Foo {
+    func foo() -> ↓Bool? {}
+}
+
+
struct Foo {
+    func foo() -> [String: ↓Bool?] {}
+}
+
+
struct Foo {
+    func foo() -> [↓Bool?] {}
+}
+
+
struct Foo {
+    static func foo() -> ↓Bool? {}
+}
+
+
struct Foo {
+    static func foo() -> [String: ↓Bool?] {}
+}
+
+
struct Foo {
+    static func foo() -> [↓Bool?] {}
+}
+
+
struct Foo {
+    func foo() -> (↓Bool?) -> String {}
+}
+
+
struct Foo {
+    func foo() -> ([Int]) -> ↓Bool? {}
+}
+
+
enum Foo {
+    func foo() -> ↓Bool? {}
+}
+
+
enum Foo {
+    func foo() -> [String: ↓Bool?] {}
+}
+
+
enum Foo {
+    func foo() -> [↓Bool?] {}
+}
+
+
enum Foo {
+    static func foo() -> ↓Bool? {}
+}
+
+
enum Foo {
+    static func foo() -> [String: ↓Bool?] {}
+}
+
+
enum Foo {
+    static func foo() -> [↓Bool?] {}
+}
+
+
enum Foo {
+    func foo() -> (↓Bool?) -> String {}
+}
+
+
enum Foo {
+    func foo() -> ([Int]) -> ↓Bool? {}
+}
+
+
class Foo {
+    func foo(input: ↓Bool?) {}
+}
+
+
class Foo {
+    func foo(input: [String: ↓Bool?]) {}
+}
+
+
class Foo {
+    func foo(input: [↓Bool?]) {}
+}
+
+
class Foo {
+    static func foo(input: ↓Bool?) {}
+}
+
+
class Foo {
+    static func foo(input: [String: ↓Bool?]) {}
+}
+
+
class Foo {
+    static func foo(input: [↓Bool?]) {}
+}
+
+
struct Foo {
+    func foo(input: ↓Bool?) {}
+}
+
+
struct Foo {
+    func foo(input: [String: ↓Bool?]) {}
+}
+
+
struct Foo {
+    func foo(input: [↓Bool?]) {}
+}
+
+
struct Foo {
+    static func foo(input: ↓Bool?) {}
+}
+
+
struct Foo {
+    static func foo(input: [String: ↓Bool?]) {}
+}
+
+
struct Foo {
+    static func foo(input: [↓Bool?]) {}
+}
+
+
enum Foo {
+    func foo(input: ↓Bool?) {}
+}
+
+
enum Foo {
+    func foo(input: [String: ↓Bool?]) {}
+}
+
+
enum Foo {
+    func foo(input: [↓Bool?]) {}
+}
+
+
enum Foo {
+    static func foo(input: ↓Bool?) {}
+}
+
+
enum Foo {
+    static func foo(input: [String: ↓Bool?]) {}
+}
+
+
enum Foo {
+    static func foo(input: [↓Bool?]) {}
+}
+
+
_ = ↓Bool?.values()
+
+ +
+
+ + +
+
+ + + diff --git a/discouraged_optional_collection.html b/discouraged_optional_collection.html new file mode 100644 index 000000000..ac1cd2e3e --- /dev/null +++ b/discouraged_optional_collection.html @@ -0,0 +1,936 @@ + + + + discouraged_optional_collection Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Discouraged Optional Collection

+ +

Prefer empty collection over optional collection

+ +
    +
  • Identifier: discouraged_optional_collection
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
var foo: [Int]
+
+
var foo: [String: Int]
+
+
var foo: Set<String>
+
+
var foo: [String: [String: Int]]
+
+
let foo: [Int] = []
+
+
let foo: [String: Int] = [:]
+
+
let foo: Set<String> = []
+
+
let foo: [String: [String: Int]] = [:]
+
+
var foo: [Int] { return [] }
+
+
func foo() -> [Int] {}
+
+
func foo() -> [String: String] {}
+
+
func foo() -> Set<Int> {}
+
+
func foo() -> ([Int]) -> String {}
+
+
func foo(input: [String] = []) {}
+
+
func foo(input: [String: String] = [:]) {}
+
+
func foo(input: Set<String> = []) {}
+
+
class Foo {
+    func foo() -> [Int] {}
+}
+
+
class Foo {
+    func foo() -> [String: String] {}
+}
+
+
class Foo {
+    func foo() -> Set<Int> {}
+}
+
+
class Foo {
+    func foo() -> ([Int]) -> String {}
+}
+
+
struct Foo {
+    func foo() -> [Int] {}
+}
+
+
struct Foo {
+    func foo() -> [String: String] {}
+}
+
+
struct Foo {
+    func foo() -> Set<Int> {}
+}
+
+
struct Foo {
+    func foo() -> ([Int]) -> String {}
+}
+
+
enum Foo {
+    func foo() -> [Int] {}
+}
+
+
enum Foo {
+    func foo() -> [String: String] {}
+}
+
+
enum Foo {
+    func foo() -> Set<Int> {}
+}
+
+
enum Foo {
+    func foo() -> ([Int]) -> String {}
+}
+
+
class Foo {
+    func foo(input: [String] = []) {}
+}
+
+
class Foo {
+    func foo(input: [String: String] = [:]) {}
+}
+
+
class Foo {
+    func foo(input: Set<String> = []) {}
+}
+
+
struct Foo {
+    func foo(input: [String] = []) {}
+}
+
+
struct Foo {
+    func foo(input: [String: String] = [:]) {}
+}
+
+
struct Foo {
+    func foo(input: Set<String> = []) {}
+}
+
+
enum Foo {
+    func foo(input: [String] = []) {}
+}
+
+
enum Foo {
+    func foo(input: [String: String] = [:]) {}
+}
+
+
enum Foo {
+    func foo(input: Set<String> = []) {}
+}
+
+

Triggering Examples

+
var foo: ↓[Int]?
+
+
var foo: ↓[String: Int]?
+
+
var foo: ↓Set<String>?
+
+
let foo: ↓[Int]? = nil
+
+
let foo: ↓[String: Int]? = nil
+
+
let foo: ↓Set<String>? = nil
+
+
var foo: ↓[Int]? { return nil }
+
+
let foo: ↓[Int]? { return nil }()
+
+
func foo() -> ↓[T]? {}
+
+
func foo() -> ↓[String: String]? {}
+
+
func foo() -> ↓[String: [String: String]]? {}
+
+
func foo() -> [String: ↓[String: String]?] {}
+
+
func foo() -> ↓Set<Int>? {}
+
+
static func foo() -> ↓[T]? {}
+
+
static func foo() -> ↓[String: String]? {}
+
+
static func foo() -> ↓[String: [String: String]]? {}
+
+
static func foo() -> [String: ↓[String: String]?] {}
+
+
static func foo() -> ↓Set<Int>? {}
+
+
func foo() -> (↓[Int]?) -> String {}
+
+
func foo() -> ([Int]) -> ↓[String]? {}
+
+
func foo(input: ↓[String: String]?) {}
+
+
func foo(input: ↓[String: [String: String]]?) {}
+
+
func foo(input: [String: ↓[String: String]?]) {}
+
+
func foo(input: ↓[String: ↓[String: String]?]?) {}
+
+
func foo<K, V>(_ dict1: [K: V], _ dict2: ↓[K: V]?) -> [K: V]
+
+
func foo<K, V>(dict1: [K: V], dict2: ↓[K: V]?) -> [K: V]
+
+
static func foo(input: ↓[String: String]?) {}
+
+
static func foo(input: ↓[String: [String: String]]?) {}
+
+
static func foo(input: [String: ↓[String: String]?]) {}
+
+
static func foo(input: ↓[String: ↓[String: String]?]?) {}
+
+
static func foo<K, V>(_ dict1: [K: V], _ dict2: ↓[K: V]?) -> [K: V]
+
+
static func foo<K, V>(dict1: [K: V], dict2: ↓[K: V]?) -> [K: V]
+
+
class Foo {
+    var foo: ↓[Int]?
+}
+
+
class Foo {
+    var foo: ↓[String: Int]?
+}
+
+
class Foo {
+    var foo: ↓Set<String>?
+}
+
+
class Foo {
+    let foo: ↓[Int]? = nil
+}
+
+
class Foo {
+    let foo: ↓[String: Int]? = nil
+}
+
+
class Foo {
+    let foo: ↓Set<String>? = nil
+}
+
+
struct Foo {
+    var foo: ↓[Int]?
+}
+
+
struct Foo {
+    var foo: ↓[String: Int]?
+}
+
+
struct Foo {
+    var foo: ↓Set<String>?
+}
+
+
struct Foo {
+    let foo: ↓[Int]? = nil
+}
+
+
struct Foo {
+    let foo: ↓[String: Int]? = nil
+}
+
+
struct Foo {
+    let foo: ↓Set<String>? = nil
+}
+
+
class Foo {
+    var foo: ↓[Int]? { return nil }
+}
+
+
class Foo {
+    let foo: ↓[Int]? { return nil }()
+}
+
+
class Foo {
+    var foo: ↓Set<String>? { return nil }
+}
+
+
class Foo {
+    let foo: ↓Set<String>? { return nil }()
+}
+
+
struct Foo {
+    var foo: ↓[Int]? { return nil }
+}
+
+
struct Foo {
+    let foo: ↓[Int]? { return nil }()
+}
+
+
struct Foo {
+    var foo: ↓Set<String>? { return nil }
+}
+
+
struct Foo {
+    let foo: ↓Set<String>? { return nil }()
+}
+
+
enum Foo {
+    var foo: ↓[Int]? { return nil }
+}
+
+
enum Foo {
+    let foo: ↓[Int]? { return nil }()
+}
+
+
enum Foo {
+    var foo: ↓Set<String>? { return nil }
+}
+
+
enum Foo {
+    let foo: ↓Set<String>? { return nil }()
+}
+
+
class Foo {
+    func foo() -> [T]? {}
+}
+
+
class Foo {
+    func foo() -> ↓[String: String]? {}
+}
+
+
class Foo {
+    func foo() -> [String: [String: String]]? {}
+}
+
+
class Foo {
+    func foo() -> [String: ↓[String: String]?] {}
+}
+
+
class Foo {
+    func foo() -> Set<Int>? {}
+}
+
+
class Foo {
+    static func foo() -> [T]? {}
+}
+
+
class Foo {
+    static func foo() -> ↓[String: String]? {}
+}
+
+
class Foo {
+    static func foo() -> [String: [String: String]]? {}
+}
+
+
class Foo {
+    static func foo() -> [String: ↓[String: String]?] {}
+}
+
+
class Foo {
+    static func foo() -> Set<Int>? {}
+}
+
+
class Foo {
+    func foo() -> ([Int]?) -> String {}
+}
+
+
class Foo {
+    func foo() -> ([Int]) -> [String]? {}
+}
+
+
struct Foo {
+    func foo() -> [T]? {}
+}
+
+
struct Foo {
+    func foo() -> ↓[String: String]? {}
+}
+
+
struct Foo {
+    func foo() -> [String: [String: String]]? {}
+}
+
+
struct Foo {
+    func foo() -> [String: ↓[String: String]?] {}
+}
+
+
struct Foo {
+    func foo() -> Set<Int>? {}
+}
+
+
struct Foo {
+    static func foo() -> [T]? {}
+}
+
+
struct Foo {
+    static func foo() -> ↓[String: String]? {}
+}
+
+
struct Foo {
+    static func foo() -> [String: [String: String]]? {}
+}
+
+
struct Foo {
+    static func foo() -> [String: ↓[String: String]?] {}
+}
+
+
struct Foo {
+    static func foo() -> Set<Int>? {}
+}
+
+
struct Foo {
+    func foo() -> ([Int]?) -> String {}
+}
+
+
struct Foo {
+    func foo() -> ([Int]) -> [String]? {}
+}
+
+
enum Foo {
+    func foo() -> [T]? {}
+}
+
+
enum Foo {
+    func foo() -> ↓[String: String]? {}
+}
+
+
enum Foo {
+    func foo() -> [String: [String: String]]? {}
+}
+
+
enum Foo {
+    func foo() -> [String: ↓[String: String]?] {}
+}
+
+
enum Foo {
+    func foo() -> Set<Int>? {}
+}
+
+
enum Foo {
+    static func foo() -> [T]? {}
+}
+
+
enum Foo {
+    static func foo() -> ↓[String: String]? {}
+}
+
+
enum Foo {
+    static func foo() -> [String: [String: String]]? {}
+}
+
+
enum Foo {
+    static func foo() -> [String: ↓[String: String]?] {}
+}
+
+
enum Foo {
+    static func foo() -> Set<Int>? {}
+}
+
+
enum Foo {
+    func foo() -> ([Int]?) -> String {}
+}
+
+
enum Foo {
+    func foo() -> ([Int]) -> [String]? {}
+}
+
+
class Foo {
+    func foo(input: ↓[String: String]?) {}
+}
+
+
class Foo {
+    func foo(input: ↓[String: [String: String]]?) {}
+}
+
+
class Foo {
+    func foo(input: [String: ↓[String: String]?]) {}
+}
+
+
class Foo {
+    func foo(input: ↓[String: ↓[String: String]?]?) {}
+}
+
+
class Foo {
+    func foo<K, V>(_ dict1: [K: V], _ dict2: ↓[K: V]?) -> [K: V]
+}
+
+
class Foo {
+    func foo<K, V>(dict1: [K: V], dict2: ↓[K: V]?) -> [K: V]
+}
+
+
class Foo {
+    static func foo(input: ↓[String: String]?) {}
+}
+
+
class Foo {
+    static func foo(input: ↓[String: [String: String]]?) {}
+}
+
+
class Foo {
+    static func foo(input: [String: ↓[String: String]?]) {}
+}
+
+
class Foo {
+    static func foo(input: ↓[String: ↓[String: String]?]?) {}
+}
+
+
class Foo {
+    static func foo<K, V>(_ dict1: [K: V], _ dict2: ↓[K: V]?) -> [K: V]
+}
+
+
class Foo {
+    static func foo<K, V>(dict1: [K: V], dict2: ↓[K: V]?) -> [K: V]
+}
+
+
struct Foo {
+    func foo(input: ↓[String: String]?) {}
+}
+
+
struct Foo {
+    func foo(input: ↓[String: [String: String]]?) {}
+}
+
+
struct Foo {
+    func foo(input: [String: ↓[String: String]?]) {}
+}
+
+
struct Foo {
+    func foo(input: ↓[String: ↓[String: String]?]?) {}
+}
+
+
struct Foo {
+    func foo<K, V>(_ dict1: [K: V], _ dict2: ↓[K: V]?) -> [K: V]
+}
+
+
struct Foo {
+    func foo<K, V>(dict1: [K: V], dict2: ↓[K: V]?) -> [K: V]
+}
+
+
struct Foo {
+    static func foo(input: ↓[String: String]?) {}
+}
+
+
struct Foo {
+    static func foo(input: ↓[String: [String: String]]?) {}
+}
+
+
struct Foo {
+    static func foo(input: [String: ↓[String: String]?]) {}
+}
+
+
struct Foo {
+    static func foo(input: ↓[String: ↓[String: String]?]?) {}
+}
+
+
struct Foo {
+    static func foo<K, V>(_ dict1: [K: V], _ dict2: ↓[K: V]?) -> [K: V]
+}
+
+
struct Foo {
+    static func foo<K, V>(dict1: [K: V], dict2: ↓[K: V]?) -> [K: V]
+}
+
+
enum Foo {
+    func foo(input: ↓[String: String]?) {}
+}
+
+
enum Foo {
+    func foo(input: ↓[String: [String: String]]?) {}
+}
+
+
enum Foo {
+    func foo(input: [String: ↓[String: String]?]) {}
+}
+
+
enum Foo {
+    func foo(input: ↓[String: ↓[String: String]?]?) {}
+}
+
+
enum Foo {
+    func foo<K, V>(_ dict1: [K: V], _ dict2: ↓[K: V]?) -> [K: V]
+}
+
+
enum Foo {
+    func foo<K, V>(dict1: [K: V], dict2: ↓[K: V]?) -> [K: V]
+}
+
+
enum Foo {
+    static func foo(input: ↓[String: String]?) {}
+}
+
+
enum Foo {
+    static func foo(input: ↓[String: [String: String]]?) {}
+}
+
+
enum Foo {
+    static func foo(input: [String: ↓[String: String]?]) {}
+}
+
+
enum Foo {
+    static func foo(input: ↓[String: ↓[String: String]?]?) {}
+}
+
+
enum Foo {
+    static func foo<K, V>(_ dict1: [K: V], _ dict2: ↓[K: V]?) -> [K: V]
+}
+
+
enum Foo {
+    static func foo<K, V>(dict1: [K: V], dict2: ↓[K: V]?) -> [K: V]
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Info.plist b/docsets/SwiftLintCore.docset/Contents/Info.plist new file mode 100644 index 000000000..ba8254a4b --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleIdentifier + com.jazzy.swiftlintcore + CFBundleName + SwiftLintCore + DocSetPlatformFamily + swiftlintcore + isDashDocset + + dashIndexFilePath + index.html + isJavaScriptEnabled + + DashDocSetFamily + dashtoc + DashDocSetFallbackURL + https://realm.github.io/SwiftLint/ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes.html new file mode 100644 index 000000000..d6e8aed9f --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes.html @@ -0,0 +1,632 @@ + + + + Classes Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Classes

+

The following classes are available globally.

+ +
+
+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/BodyLengthRuleVisitor.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/BodyLengthRuleVisitor.html new file mode 100644 index 000000000..08e431d8d --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/BodyLengthRuleVisitor.html @@ -0,0 +1,670 @@ + + + + BodyLengthRuleVisitor Class Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

BodyLengthRuleVisitor

+
+
+ +
public final class BodyLengthRuleVisitor<Parent> : ViolationsSyntaxVisitor<SeverityLevelsConfiguration<Parent>> where Parent : Rule
+ +
+
+

Visitor that collection violations of code block lengths.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + Kind + +
    +
    +
    +
    +
    +
    +

    The code block types to check.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum Kind
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Initializer.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @inlinable
    +public init(kind: Kind, file: SwiftLintFile, configuration: SeverityLevelsConfiguration<Parent>)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + kind + + +
    +

    The code block type to check. See Kind.

    +
    +
    + + file + + +
    +

    The file to collect violation for.

    +
    +
    + + configuration + + +
    +

    The configuration that defines the acceptable limits.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override public func visitPost(_ node: EnumDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override public func visitPost(_ node: ClassDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override public func visitPost(_ node: StructDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override public func visitPost(_ node: ActorDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override public func visitPost(_ node: ClosureExprSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override public func visitPost(_ node: FunctionDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override public func visitPost(_ node: InitializerDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/BodyLengthRuleVisitor/Kind.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/BodyLengthRuleVisitor/Kind.html new file mode 100644 index 000000000..f6da26ebf --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/BodyLengthRuleVisitor/Kind.html @@ -0,0 +1,454 @@ + + + + Kind Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Kind

+
+
+ +
public enum Kind
+ +
+
+

The code block types to check.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + closure + +
    +
    +
    +
    +
    +
    +

    Closure code blocks.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case closure
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + function + +
    +
    +
    +
    +
    +
    +

    Function body blocks.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case function
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + type + +
    +
    +
    +
    +
    +
    +

    Type (class, enum, …) member blocks.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case type
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/CodeBlockVisitor.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/CodeBlockVisitor.html new file mode 100644 index 000000000..2f477d24e --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/CodeBlockVisitor.html @@ -0,0 +1,1050 @@ + + + + CodeBlockVisitor Class Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

CodeBlockVisitor

+
+
+ +
open class CodeBlockVisitor<Configuration> : ViolationsSyntaxVisitor<Configuration> where Configuration : RuleConfiguration
+ +
+
+

A visitor that collects style violations for all available code blocks.

+ + +
+
+ +
+
+
+
    +
  • + +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @inlinable
    +override public init(configuration: Configuration, file: SwiftLintFile)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: AccessorDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: ActorDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: CatchClauseSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: ClassDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: ClosureExprSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: DeferStmtSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: DoStmtSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: EnumDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: ExtensionDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: FunctionDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: ForStmtSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: GuardStmtSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: IfExprSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: InitializerDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: PatternBindingSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: PrecedenceGroupDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: ProtocolDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: RepeatStmtSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: StructDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: SwitchExprSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: WhileStmtSyntax)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Collects violations for the given braced item. Intended to be specialized by subclasses.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    open func collectViolations(for _: (some BracedSyntax)?)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + bracedItem + + +
    +

    The braced item to collect violations for.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/CodeIndentingRewriter.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/CodeIndentingRewriter.html new file mode 100644 index 000000000..fd09799cf --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/CodeIndentingRewriter.html @@ -0,0 +1,473 @@ + + + + CodeIndentingRewriter Class Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

CodeIndentingRewriter

+
+
+ +
public class CodeIndentingRewriter : SyntaxRewriter
+ +
+
+

Rewriter that indents or unindents a syntax piece including comments and nested +AST nodes (e.g. a code block in a code block).

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + IndentationStyle + +
    +
    +
    +
    +
    +
    +

    Style defining whether the rewriter shall indent or unindent and whether it shall use tabs or spaces and +how many of them.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum IndentationStyle
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(style:) + +
    +
    +
    +
    +
    +
    +

    Initializer accepting an indentation style.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(style: IndentationStyle = .indentSpaces(4))
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + style + + +
    +

    Indentation style. The default is indentation by 4 spaces.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override public func visit(_ token: TokenSyntax) -> TokenSyntax
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/CodeIndentingRewriter/IndentationStyle.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/CodeIndentingRewriter/IndentationStyle.html new file mode 100644 index 000000000..44abb3dc2 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/CodeIndentingRewriter/IndentationStyle.html @@ -0,0 +1,485 @@ + + + + IndentationStyle Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

IndentationStyle

+
+
+ +
public enum IndentationStyle
+ +
+
+

Style defining whether the rewriter shall indent or unindent and whether it shall use tabs or spaces and +how many of them.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + indentSpaces(_:) + +
    +
    +
    +
    +
    +
    +

    Indentation with a number of spaces.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case indentSpaces(Int)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + unindentSpaces(_:) + +
    +
    +
    +
    +
    +
    +

    Reverse indentation of a number of spaces.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case unindentSpaces(Int)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + indentTabs(_:) + +
    +
    +
    +
    +
    +
    +

    Indentation with a number of tabs

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case indentTabs(Int)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + unindentTabs(_:) + +
    +
    +
    +
    +
    +
    +

    Reverse indentation of a number of tabs.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case unindentTabs(Int)
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/DeclaredIdentifiersTrackingVisitor.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/DeclaredIdentifiersTrackingVisitor.html new file mode 100644 index 000000000..21ea61909 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/DeclaredIdentifiersTrackingVisitor.html @@ -0,0 +1,737 @@ + + + + DeclaredIdentifiersTrackingVisitor Class Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

DeclaredIdentifiersTrackingVisitor

+
+
+ +
open class DeclaredIdentifiersTrackingVisitor<Configuration: RuleConfiguration>:
+        ViolationsSyntaxVisitor<Configuration>
+ +
+
+

A specialized ViolationsSyntaxVisitor that tracks declared identifiers per scope while traversing the AST.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + Scope + +
    +
    +
    +
    +
    +
    +

    A type that remembers the declared identifiers (in order) up to the current position in the code.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public typealias Scope = Stack<[IdentifierDeclaration]>
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + scope + +
    +
    +
    +
    +
    +
    +

    The hierarchical stack of identifiers declared up to the current position in the code.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var scope: Scope
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Initializer.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @inlinable
    +public init(configuration: Configuration, file: SwiftLintFile, scope: Scope = Scope())
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + configuration + + +
    +

    Configuration of a rule.

    +
    +
    + + file + + +
    +

    File from which the syntax tree stems from.

    +
    +
    + + scope + + +
    +

    A (potentially already pre-filled) scope to collect identifiers into.

    +
    +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Indicate whether a given identifier is in scope.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func hasSeenDeclaration(for identifier: String) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + identifier + + +
    +

    An identifier.

    +
    +
    +
    +
    +

    Return Value

    +

    true if the identifier was declared previously.

    +
    + +
    +
    +
  • +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visit(_ node: CodeBlockItemListSyntax) -> SyntaxVisitorContinueKind
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_: CodeBlockItemListSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: VariableDeclSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: GuardStmtSyntax)
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Type declaration boundaries +

+
+
+
    +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visit(_ node: MemberBlockSyntax) -> SyntaxVisitorContinueKind
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitPost(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitPost(_ node: MemberBlockSyntax)
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/RuleRegistry.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/RuleRegistry.html new file mode 100644 index 000000000..5492e0035 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/RuleRegistry.html @@ -0,0 +1,531 @@ + + + + RuleRegistry Class Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

RuleRegistry

+
+
+ +
public final class RuleRegistry : @unchecked Sendable
+ +
+
+

Container to register and look up SwiftLint rules.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + shared + +
    +
    +
    +
    +
    +
    +

    Shared rule registry instance.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static let shared: RuleRegistry
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + list + +
    +
    +
    +
    +
    +
    +

    Rule list associated with this registry. Lazily created, and +immutable once looked up.

    +
    +

    Note

    + Adding registering more rules after this was first + accessed will not work. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public private(set) lazy var list: RuleList { get set }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + register(rules:) + +
    +
    +
    +
    +
    +
    +

    Register rules.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func register(rules: [any Rule.Type])
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + rules + + +
    +

    The rules to register.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + rule(forID:) + +
    +
    +
    +
    +
    +
    +

    Look up a rule for a given ID.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func rule(forID id: String) -> (any Rule.Type)?
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + id + + +
    +

    The ID for the rule to look up.

    +
    +
    +
    +
    +

    Return Value

    +

    The rule matching the specified ID, if one was found.

    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/RuleStorage.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/RuleStorage.html new file mode 100644 index 000000000..d0ea850de --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/RuleStorage.html @@ -0,0 +1,421 @@ + + + + RuleStorage Class Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

RuleStorage

+
+
+ +
public class RuleStorage : CustomStringConvertible
+ +
+
+

A storage mechanism for aggregating the results of CollectingRules.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + description + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var description: String { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init() + +
    +
    +
    +
    +
    +
    +

    Creates a RuleStorage with no initial stored data.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init()
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/SwiftLintFile.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/SwiftLintFile.html new file mode 100644 index 000000000..666599bef --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/SwiftLintFile.html @@ -0,0 +1,920 @@ + + + + SwiftLintFile Class Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

SwiftLintFile

+
+
+ +
public final class SwiftLintFile : Sendable
+
extension SwiftLintFile: Equatable, Hashable
+ +
+
+

A unit of Swift source code, either on disk or in memory.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + file + +
    +
    +
    +
    +
    +
    +

    The underlying SourceKitten file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let file: File
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + id + +
    +
    +
    +
    +
    +
    +

    The associated unique identifier for this file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let id: UUID
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + isTestFile + +
    +
    +
    +
    +
    +
    +

    Whether or not this is a file generated for testing purposes.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let isTestFile: Bool
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + isVirtual + +
    +
    +
    +
    +
    +
    +

    A file is virtual if it is not backed by a filesystem path.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let isVirtual: Bool
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a SwiftLintFile with a SourceKitten File.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(file: File, isTestFile: Bool = false, isVirtual: Bool = false)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + file + + +
    +

    A file from SourceKitten.

    +
    +
    + + isTestFile + + +
    +

    Mark the file as being generated for testing purposes only.

    +
    +
    + + isVirtual + + +
    +

    Mark the file as virtual (in-memory).

    +
    +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a SwiftLintFile by specifying its path on disk. +Fails if the file does not exist.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public convenience init?(path: String, isTestFile: Bool = false)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + path + + +
    +

    The path to a file on disk. Relative and absolute paths supported.

    +
    +
    + + isTestFile + + +
    +

    Mark the file as being generated for testing purposes only.

    +
    +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a SwiftLintFile by specifying its path on disk. Unlike the SwiftLintFile(path:) initializer, this +one does not read its contents immediately, but rather traps at runtime when attempting to access its contents.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public convenience init(pathDeferringReading path: String)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + path + + +
    +

    The path to a file on disk. Relative and absolute paths supported.

    +
    +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a SwiftLintFile that is not backed by a file on disk by specifying its contents.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public convenience init(contents: String, isTestFile: Bool = false)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + contents + + +
    +

    The contents of the file.

    +
    +
    + + isTestFile + + +
    +

    Mark the file as being generated for testing purposes only.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + path + +
    +
    +
    +
    +
    +
    +

    The path on disk for this file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var path: String? { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + contents + +
    +
    +
    +
    +
    +
    +

    The file’s contents.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var contents: String { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + stringView + +
    +
    +
    +
    +
    +
    +

    A string view into the contents of this file optimized for string manipulation operations.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var stringView: StringView { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + lines + +
    +
    +
    +
    +
    +
    +

    The parsed lines for this file’s contents.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var lines: [Line] { get }
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Hashable Conformance +

+
+
+
    +
  • +
    + + + + ==(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func == (lhs: SwiftLintFile, rhs: SwiftLintFile) -> Bool
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + hash(into:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func hash(into hasher: inout Hasher)
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/ViolationsSyntaxRewriter.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/ViolationsSyntaxRewriter.html new file mode 100644 index 000000000..940680688 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/ViolationsSyntaxRewriter.html @@ -0,0 +1,603 @@ + + + + ViolationsSyntaxRewriter Class Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

ViolationsSyntaxRewriter

+
+
+ +
open class ViolationsSyntaxRewriter<Configuration> : SyntaxRewriter where Configuration : RuleConfiguration
+ +
+
+

A SwiftSyntax SyntaxRewriter that produces absolute positions where corrections were applied.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + configuration + +
    +
    +
    +
    +
    +
    +

    A rule’s configuration.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let configuration: Configuration
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + file + +
    +
    +
    +
    +
    +
    +

    The file from which the traversed syntax tree stems from.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let file: SwiftLintFile
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + locationConverter + +
    +
    +
    +
    +
    +
    +

    A converter of positions in the traversed source file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public lazy var locationConverter: SourceLocationConverter { get set }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + disabledRegions + +
    +
    +
    +
    +
    +
    +

    The regions in the traversed file that are disabled by a command.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public lazy var disabledRegions: [SourceRange] { get set }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + correctionPositions + +
    +
    +
    +
    +
    +
    +

    Positions in a source file where corrections were applied.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var correctionPositions: [AbsolutePosition]
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Initializer for a ViolationsSyntaxRewriter.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @inlinable
    +public init(configuration: Configuration, file: SwiftLintFile)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + configuration + + +
    +

    Configuration of a rule.

    +
    +
    + + file + + +
    +

    File from which the syntax tree stems from.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + visitAny(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visitAny(_ node: Syntax) -> Syntax?
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/ViolationsSyntaxVisitor.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/ViolationsSyntaxVisitor.html new file mode 100644 index 000000000..24a175fc4 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Classes/ViolationsSyntaxVisitor.html @@ -0,0 +1,864 @@ + + + + ViolationsSyntaxVisitor Class Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

ViolationsSyntaxVisitor

+
+
+ +
open class ViolationsSyntaxVisitor<Configuration> : SyntaxVisitor where Configuration : RuleConfiguration
+ +
+
+

A SwiftSyntax SyntaxVisitor that produces absolute positions where violations should be reported.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + configuration + +
    +
    +
    +
    +
    +
    +

    A rule’s configuration.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let configuration: Configuration
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + file + +
    +
    +
    +
    +
    +
    +

    The file from which the traversed syntax tree stems from.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let file: SwiftLintFile
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + locationConverter + +
    +
    +
    +
    +
    +
    +

    A source location converter associated with the syntax tree being traversed.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public lazy var locationConverter: SourceLocationConverter { get set }
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Initializer for a ViolationsSyntaxVisitor.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @inlinable
    +public init(configuration: Configuration, file: SwiftLintFile)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + configuration + + +
    +

    Configuration of a rule.

    +
    +
    + + file + + +
    +

    File from which the syntax tree stems from.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + violations + +
    +
    +
    +
    +
    +
    +

    Positions in a source file where violations should be reported.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var violations: [ReasonedRuleViolation]
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + skippableDeclarations + +
    +
    +
    +
    +
    +
    +

    List of declaration types that shall be skipped while traversing the AST.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    open var skippableDeclarations: [any DeclSyntaxProtocol.Type] { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visit(_ node: ActorDeclSyntax) -> SyntaxVisitorContinueKind
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visit(_ node: ClassDeclSyntax) -> SyntaxVisitorContinueKind
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visit(_ node: EnumDeclSyntax) -> SyntaxVisitorContinueKind
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visit(_ node: ExtensionDeclSyntax) -> SyntaxVisitorContinueKind
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visit(_ node: FunctionDeclSyntax) -> SyntaxVisitorContinueKind
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visit(_ node: InitializerDeclSyntax) -> SyntaxVisitorContinueKind
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visit(_ node: ProtocolDeclSyntax) -> SyntaxVisitorContinueKind
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visit(_ node: StructDeclSyntax) -> SyntaxVisitorContinueKind
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visit(_ node: SubscriptDeclSyntax) -> SyntaxVisitorContinueKind
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + visit(_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    override open func visit(_ node: VariableDeclSyntax) -> SyntaxVisitorContinueKind
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums.html new file mode 100644 index 000000000..cb62715ab --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums.html @@ -0,0 +1,636 @@ + + + + Enumerations Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Enumerations

+

The following enumerations are available globally.

+ +
+
+ +
+
+
+
    +
  • +
    + + + + AccessControlLevel + +
    +
    +
    +
    +
    +
    +

    The accessibility of a Swift source declaration.

    + + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum AccessControlLevel : String, CustomStringConvertible
    +
    extension AccessControlLevel: Comparable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + Issue + +
    +
    +
    +
    +
    +
    +

    All possible SwiftLint issues which are printed as warnings by default.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum Issue : LocalizedError, Equatable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + OptionType + +
    +
    +
    +
    +
    +
    +

    Type of an option.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum OptionType : Equatable, Sendable
    +
    extension OptionType: Documentable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + RuleIdentifier + +
    +
    +
    +
    +
    +
    +

    An identifier representing a SwiftLint rule, or all rules.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum RuleIdentifier : Hashable, ExpressibleByStringLiteral, Comparable, Sendable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + RuleKind + +
    +
    +
    +
    +
    +
    +

    All the possible rule kinds (categories).

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum RuleKind : String, Codable, Sendable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + RuleListError + +
    +
    +
    +
    +
    +
    +

    All possible rule list configuration errors.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum RuleListError : Error
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + SwiftExpressionKind + +
    +
    +
    +
    +
    +
    +

    The kind of expression for a contiguous set of Swift source tokens.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum SwiftExpressionKind : String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + ViolationSeverity + +
    +
    +
    +
    +
    +
    +

    The magnitude of a StyleViolation.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum ViolationSeverity : String, Comparable, Codable, Sendable, InlinableOptionType
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + IdentifierDeclaration + +
    +
    +
    +
    +
    +
    +

    An identifier declaration.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum IdentifierDeclaration : Hashable
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/AccessControlLevel.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/AccessControlLevel.html new file mode 100644 index 000000000..e262c6f3d --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/AccessControlLevel.html @@ -0,0 +1,685 @@ + + + + AccessControlLevel Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

AccessControlLevel

+
+
+ +
public enum AccessControlLevel : String, CustomStringConvertible
+
extension AccessControlLevel: Comparable
+ +
+
+

The accessibility of a Swift source declaration.

+ + + +
+
+ +
+
+
+
    +
  • +
    + + + + private + +
    +
    +
    +
    +
    +
    +

    Accessible by the declaration’s immediate lexical scope.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case `private` = "source.lang.swift.accessibility.private"
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + fileprivate + +
    +
    +
    +
    +
    +
    +

    Accessible by the declaration’s same file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case `fileprivate` = "source.lang.swift.accessibility.fileprivate"
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + internal + +
    +
    +
    +
    +
    +
    +

    Accessible by the declaration’s same module, or modules importing it with the @testable attribute.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case `internal` = "source.lang.swift.accessibility.internal"
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + package + +
    +
    +
    +
    +
    +
    +

    Accessible by all the modules defined in the same Swift package.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case package = "source.lang.swift.accessibility.package"
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + public + +
    +
    +
    +
    +
    +
    +

    Accessible by the declaration’s same program.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case `public` = "source.lang.swift.accessibility.public"
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + open + +
    +
    +
    +
    +
    +
    +

    Accessible and customizable (via subclassing or overrides) by the declaration’s same program.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case open = "source.lang.swift.accessibility.open"
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(description:) + +
    +
    +
    +
    +
    +
    +

    Initializes an access control level by its Swift source keyword value.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init?(description value: String)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + value + + +
    +

    The value used to describe this level in Swift source code.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + description + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var description: String { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + isPrivate + +
    +
    +
    +
    +
    +
    +

    Returns true if is private or fileprivate

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var isPrivate: Bool { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + <(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func < (lhs: AccessControlLevel, rhs: AccessControlLevel) -> Bool
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/IdentifierDeclaration.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/IdentifierDeclaration.html new file mode 100644 index 000000000..282d7c2cb --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/IdentifierDeclaration.html @@ -0,0 +1,574 @@ + + + + IdentifierDeclaration Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

IdentifierDeclaration

+
+
+ +
public enum IdentifierDeclaration : Hashable
+ +
+
+

An identifier declaration.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + parameter(name:) + +
    +
    +
    +
    +
    +
    +

    Parameter declaration with a name token.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case parameter(name: TokenSyntax)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + localVariable(name:) + +
    +
    +
    +
    +
    +
    +

    Local variable declaration with a name token.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case localVariable(name: TokenSyntax)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    A variable that is implicitly added by the compiler (e.g. error in catch clauses).

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case implicitVariable(name: String)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + wildcard + +
    +
    +
    +
    +
    +
    +

    A variable hidden from scope because its name is a wildcard _.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case wildcard
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + lookupBoundary + +
    +
    +
    +
    +
    +
    +

    Special case that marks a type boundary at which name lookup stops.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case lookupBoundary
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Check whether self declares a variable given by name.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func declares(id: String, disregardBackticks: Bool = true) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + id + + +
    +

    Name of the variable.

    +
    +
    + + disregardBackticks + + +
    +

    If true, normalize all names before comparison by removing all backticks. This is the + default since backticks only disambiguate, but don’t contribute to name resolution.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/Issue.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/Issue.html new file mode 100644 index 000000000..be5e88f9d --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/Issue.html @@ -0,0 +1,1173 @@ + + + + Issue Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Issue

+
+
+ +
public enum Issue : LocalizedError, Equatable
+ +
+
+

All possible SwiftLint issues which are printed as warnings by default.

+ + +
+
+ +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    The configuration didn’t match internal expectations.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case invalidConfiguration(ruleID: String, message: String? = nil)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Issued when a regular expression pattern is invalid.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case invalidRegexPattern(ruleID: String, pattern: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Issued when an option is deprecated. Suggests an alternative optionally.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case deprecatedConfigurationOption(ruleID: String, key: String, alternative: String? = nil)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Used in configuration parsing when no changes have been applied. Use only internally!

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case nothingApplied(ruleID: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Rule is listed multiple times in the configuration.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case listedMultipleTime(ruleID: String, times: Int)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    An identifier old has been renamed to new.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case renamedIdentifier(old: String, new: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Some configuration keys are invalid.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case invalidConfigurationKeys(ruleID: String, keys: Set<String>)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    The configuration is inconsistent, that is options are mutually exclusive or one drives other values +irrelevant.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case inconsistentConfiguration(ruleID: String, message: String)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + invalidRuleIDs(_:) + +
    +
    +
    +
    +
    +
    +

    Used rule IDs are invalid.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case invalidRuleIDs(Set<String>)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Found a rule configuration for a rule that is not present in only_rules.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case ruleNotPresentInOnlyRules(ruleID: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Found a rule configuration for a rule that is disabled.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case ruleDisabledInDisabledRules(ruleID: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Found a rule configuration for a rule that is disabled in the parent configuration.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case ruleDisabledInParentConfiguration(ruleID: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Found a rule configuration for a rule that is not enabled in opt_in_rules.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case ruleNotEnabledInOptInRules(ruleID: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Found a rule configuration for a rule that is not enabled in parent only_rules.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case ruleNotEnabledInParentOnlyRules(ruleID: String)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + genericWarning(_:) + +
    +
    +
    +
    +
    +
    +

    A generic warning specified by a string.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case genericWarning(String)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + genericError(_:) + +
    +
    +
    +
    +
    +
    +

    A generic error specified by a string.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case genericError(String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    A deprecation warning for a rule.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case ruleDeprecated(ruleID: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    The initial configuration file was not found.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case initialFileNotFound(path: String)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + fileNotFound(path:) + +
    +
    +
    +
    +
    +
    +

    A file at specified path was not found.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case fileNotFound(path: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    The file at path is not readable or cannot be opened.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case fileNotReadable(path: String?, ruleID: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    The file at path is not writable.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case fileNotWritable(path: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    The file at path cannot be indexed by a specific rule.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case indexingError(path: String?, ruleID: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    No arguments were provided to compile a file at path within a specific rule.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case missingCompilerArguments(path: String?, ruleID: String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Cursor information cannot be extracted from a specific location.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case missingCursorInfo(path: String?, ruleID: String)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + yamlParsing(_:) + +
    +
    +
    +
    +
    +
    +

    An error that occurred when parsing YAML.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case yamlParsing(String)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    The baseline file at path is not readable or cannot be opened.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case baselineNotReadable(path: String)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + print() + +
    +
    +
    +
    +
    +
    +

    Print the issue to the console.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func print()
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/OptionType.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/OptionType.html new file mode 100644 index 000000000..237ed785f --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/OptionType.html @@ -0,0 +1,880 @@ + + + + OptionType Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

OptionType

+
+
+ +
public enum OptionType : Equatable, Sendable
+
extension OptionType: Documentable
+ +
+
+

Type of an option.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + empty + +
    +
    +
    +
    +
    +
    +

    An irrelevant option. It will be ignored in documentation serialization.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case empty
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + flag(_:) + +
    +
    +
    +
    +
    +
    +

    A boolean flag.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case flag(Bool)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + string(_:) + +
    +
    +
    +
    +
    +
    +

    A string option.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case string(String)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + symbol(_:) + +
    +
    +
    +
    +
    +
    +

    Like a string option but without quotes in the serialized output.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case symbol(String)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + integer(_:) + +
    +
    +
    +
    +
    +
    +

    An integer option.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case integer(Int)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + float(_:) + +
    +
    +
    +
    +
    +
    +

    A floating point number option.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case float(Double)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + severity(_:) + +
    +
    +
    +
    +
    +
    +

    Special option for a ViolationSeverity.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case severity(ViolationSeverity)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + list(_:) + +
    +
    +
    +
    +
    +
    +

    A list of options.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case list([`Self`])
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + nested(_:) + +
    +
    +
    +
    +
    +
    +

    An option which is another set of configuration options to be nested in the serialized output.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case nested(RuleConfigurationDescription)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + hasContent + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var hasContent: Bool { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + markdown() + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func markdown() -> String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + oneLiner() + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func oneLiner() -> String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + yaml() + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func yaml() -> String
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Result builder +

+
+
+
    +
  • +
    + + + + =>(_:_:) + +
    +
    +
    +
    +
    +
    +

    Operator enabling an easy way to create a configuration option.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static func => (key: String, value: OptionType) -> RuleConfigurationOption
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + key + + +
    +

    Name of the option.

    +
    +
    + + value + + +
    +

    Value of the option.

    +
    +
    +
    +
    +

    Return Value

    +

    A configuration option built up by the given data.

    +
    + +
    +
    +
  • +
  • +
    + + + + nest(_:) + +
    +
    +
    +
    +
    +
    +

    Create an option defined by nested configuration description.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static func nest(@RuleConfigurationDescriptionBuilder _ description: () -> RuleConfigurationDescription) -> OptionType
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + description + + +
    +

    A configuration description buildable by applying the result builder syntax.

    +
    +
    +
    +
    +

    Return Value

    +

    A configuration option with a value being another configuration description.

    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/RuleIdentifier.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/RuleIdentifier.html new file mode 100644 index 000000000..b019177d0 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/RuleIdentifier.html @@ -0,0 +1,622 @@ + + + + RuleIdentifier Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

RuleIdentifier

+
+
+ +
public enum RuleIdentifier : Hashable, ExpressibleByStringLiteral, Comparable, Sendable
+ +
+
+

An identifier representing a SwiftLint rule, or all rules.

+ + +
+
+ +
+
+
+
+ + +
+ +

Values +

+
+
+
    +
  • +
    + + + + all + +
    +
    +
    +
    +
    +
    +

    Special identifier that should be treated as referring to ‘all’ SwiftLint rules. One helpful usecase is in +disabling all SwiftLint rules in a given file by adding a // swiftlint:disable all comment at the top of the +file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case all
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + single(identifier:) + +
    +
    +
    +
    +
    +
    +

    Represents a single SwiftLint rule with the specified identifier.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case single(identifier: String)
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Properties +

+
+
+
    +
  • +
    + + + + stringRepresentation + +
    +
    +
    +
    +
    +
    +

    The spelling of the string for this identifier.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var stringRepresentation: String { get }
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Initializers +

+
+
+
    +
  • +
    + + + + init(_:) + +
    +
    +
    +
    +
    +
    +

    Creates a RuleIdentifier by its string representation.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(_ value: String)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + value + + +
    +

    The string representation.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

ExpressibleByStringLiteral Conformance +

+
+
+ +
+
+
+ + +
+ +

Comparable Conformance +

+
+
+
    +
  • +
    + + + + <(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func < (lhs: `Self`, rhs: `Self`) -> Bool
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/RuleKind.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/RuleKind.html new file mode 100644 index 000000000..01a1c6442 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/RuleKind.html @@ -0,0 +1,512 @@ + + + + RuleKind Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

RuleKind

+
+
+ +
public enum RuleKind : String, Codable, Sendable
+ +
+
+

All the possible rule kinds (categories).

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + lint + +
    +
    +
    +
    +
    +
    +

    Describes rules that validate Swift source conventions.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case lint
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + idiomatic + +
    +
    +
    +
    +
    +
    +

    Describes rules that validate common practices in the Swift community.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case idiomatic
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + style + +
    +
    +
    +
    +
    +
    +

    Describes rules that validate stylistic choices.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case style
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + metrics + +
    +
    +
    +
    +
    +
    +

    Describes rules that validate magnitudes or measurements of Swift source.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case metrics
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + performance + +
    +
    +
    +
    +
    +
    +

    Describes rules that validate that code patterns with poor performance are avoided.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case performance
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/RuleListError.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/RuleListError.html new file mode 100644 index 000000000..b0d10a0ef --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/RuleListError.html @@ -0,0 +1,392 @@ + + + + RuleListError Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

RuleListError

+
+
+ +
public enum RuleListError : Error
+ +
+
+

All possible rule list configuration errors.

+ + +
+
+ +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    The rule list contains more than one configuration for the specified rule.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case duplicatedConfigurations(rule: any Rule.Type)
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/SwiftExpressionKind.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/SwiftExpressionKind.html new file mode 100644 index 000000000..2324e5c9d --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/SwiftExpressionKind.html @@ -0,0 +1,572 @@ + + + + SwiftExpressionKind Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

SwiftExpressionKind

+
+
+ +
public enum SwiftExpressionKind : String
+ +
+
+

The kind of expression for a contiguous set of Swift source tokens.

+ + +
+
+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/ViolationSeverity.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/ViolationSeverity.html new file mode 100644 index 000000000..9edce8ecb --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Enums/ViolationSeverity.html @@ -0,0 +1,464 @@ + + + + ViolationSeverity Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

ViolationSeverity

+
+
+ +
public enum ViolationSeverity : String, Comparable, Codable, Sendable, InlinableOptionType
+ +
+
+

The magnitude of a StyleViolation.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + warning + +
    +
    +
    +
    +
    +
    +

    Non-fatal. If using SwiftLint as an Xcode build phase, Xcode will mark the build as having succeeded.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case warning
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + error + +
    +
    +
    +
    +
    +
    +

    Fatal. If using SwiftLint as an Xcode build phase, Xcode will mark the build as having failed.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case error
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Comparable +

+
+
+
    +
  • +
    + + + + <(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func < (lhs: `Self`, rhs: `Self`) -> Bool
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Extensions.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Extensions.html new file mode 100644 index 000000000..236b770eb --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Extensions.html @@ -0,0 +1,556 @@ + + + + Extensions Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Extensions

+

The following extensions are available globally.

+ +
+
+ +
+
+
+ +
+
+
+ + +
+ +

AcceptableByConfigurationElement conformances +

+
+
+ +
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Extensions/Array.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Extensions/Array.html new file mode 100644 index 000000000..09748232b --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Extensions/Array.html @@ -0,0 +1,903 @@ + + + + Array Extension Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Array

+
+
+ +
public extension Array where Element == Example
+
extension Array: AcceptableByConfigurationElement where Element: AcceptableByConfigurationElement
+
public extension Array where Element == SwiftLintSyntaxToken
+
public extension Array where Element == ReasonedRuleViolation
+
public extension Array where Element == any DeclSyntaxProtocol.Type
+ +
+
+ +
+
+ +
+
+
+
+ + +
+ +

Available where Element == Example +

+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    Make these examples skip wrapping in comment tests.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func skipWrappingInCommentTests() -> Array<Element>
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Make these examples skip wrapping in string tests.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func skipWrappingInStringTests() -> Array<Element>
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Make these examples skip multi-byte offset tests.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func skipMultiByteOffsetTests() -> Array<Element>
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Make these examples skip disable command tests.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func skipDisableCommandTests() -> Array<Element>
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Remove all violation markers from the examples.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func removingViolationMarker() -> Array<Element>
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Available where Element: AcceptableByConfigurationElement +

+
+
+ +
+
+
+ + +
+ +

Available where Element == SwiftLintSyntaxToken +

+
+
+
    +
  • +
    + + + + kinds + +
    +
    +
    +
    +
    +
    +

    The kinds for these tokens.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    var kinds: [SyntaxKind] { get }
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Available where Element == ReasonedRuleViolation +

+
+
+
    +
  • +
    + + + + append(_:) + +
    +
    +
    +
    +
    +
    +

    Add a violation at the specified position using the default description and severity.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    mutating func append(_ position: AbsolutePosition)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + position + + +
    +

    The position for the violation to append.

    +
    +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Add a violation and the correction at the specified position using the default description and severity.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    mutating func append(at position: AbsolutePosition, correction: ReasonedRuleViolation.ViolationCorrection? = nil)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + position + + +
    +

    The position for the violation to append.

    +
    +
    + + correction + + +
    +

    An optional correction to be applied when running with --fix.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + append(contentsOf:) + +
    +
    +
    +
    +
    +
    +

    Add violations for the specified positions using the default description and severity.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    mutating func append(contentsOf positions: [AbsolutePosition])
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + positions + + +
    +

    The positions for the violations to append.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Available where Element == anyDeclSyntaxProtocol.Type +

+
+
+
    +
  • +
    + + + + all + +
    +
    +
    +
    +
    +
    +

    All visitable declaration syntax types.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let all: `Self`
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + allExcept(_:) + +
    +
    +
    +
    +
    +
    +

    All declarations except for the specified ones.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static func allExcept(_ declarations: Element...) -> Array<Element>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + declarations + + +
    +

    The declarations to exclude from all declarations.

    +
    +
    +
    +
    +

    Return Value

    +

    All declarations except for the specified ones.

    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Extensions/Bool.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Extensions/Bool.html new file mode 100644 index 000000000..e7d2e4e75 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Extensions/Bool.html @@ -0,0 +1,416 @@ + + + + Bool Extension Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Bool

+
+
+ +
extension Bool: AcceptableByConfigurationElement
+ +
+
+ +
+
+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Extensions/Double.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Extensions/Double.html new file mode 100644 index 000000000..310ccab7a --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Extensions/Double.html @@ -0,0 +1,416 @@ + + + + Double Extension Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Double

+
+
+ +
extension Double: AcceptableByConfigurationElement
+ +
+
+ +
+
+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Extensions/Int.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Extensions/Int.html new file mode 100644 index 000000000..cb0c1ad37 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Extensions/Int.html @@ -0,0 +1,416 @@ + + + + Int Extension Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Int

+
+
+ +
extension Int: AcceptableByConfigurationElement
+ +
+
+ +
+
+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Extensions/Optional.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Extensions/Optional.html new file mode 100644 index 000000000..7ea53f2c1 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Extensions/Optional.html @@ -0,0 +1,425 @@ + + + + Optional Extension Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Optional

+
+
+ +
extension Optional: AcceptableByConfigurationElement where Wrapped: AcceptableByConfigurationElement
+ +
+
+ +
+
+ +
+
+
+
+ + +
+ +

Available where Wrapped: AcceptableByConfigurationElement +

+
+
+ +
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Extensions/Set.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Extensions/Set.html new file mode 100644 index 000000000..f225fd070 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Extensions/Set.html @@ -0,0 +1,425 @@ + + + + Set Extension Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Set

+
+
+ +
extension Set: AcceptableByConfigurationElement where Element: AcceptableByConfigurationElement & Comparable
+ +
+
+ +
+
+ +
+
+
+
+ + +
+ +

Available where Element: AcceptableByConfigurationElement & Comparable +

+
+
+ +
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Extensions/String.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Extensions/String.html new file mode 100644 index 000000000..58690ad9a --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Extensions/String.html @@ -0,0 +1,416 @@ + + + + String Extension Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

String

+
+
+ +
extension String: AcceptableByConfigurationElement
+ +
+
+ +
+
+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Guides.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Guides.html new file mode 100644 index 000000000..445442698 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Guides.html @@ -0,0 +1,2555 @@ + + + + Guides Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Guides

+

The following guides are available globally.

+ +
+
+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Macros.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Macros.html new file mode 100644 index 000000000..378e48add --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Macros.html @@ -0,0 +1,513 @@ + + + + Macros Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Macros

+

The following macros are available globally.

+ +
+
+ +
+
+
+
    +
  • +
    + + + + AutoConfigParser() + +
    +
    +
    +
    +
    +
    +

    Macro to be attached to rule configurations. It generates the configuration parsing logic +automatically based on the defined @ConfigurationElements.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @attached(member, names: named(apply)
    +) public macro AutoConfigParser() = #externalMacro(
    +    module: "SwiftLintCoreMacros",
    +    type: "AutoConfigParser"
    +)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Macro that lets an enum with a String raw type automatically conform to AcceptableByConfigurationElement.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @attached(extension, conformances: AcceptableByConfigurationElement, names: named(init(fromAny:context:)
    +), named(asOption)) public macro AcceptableByConfigurationElement() = #externalMacro(
    +    module: "SwiftLintCoreMacros",
    +    type: "AcceptableByConfigurationElement"
    +)
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Macro that adds a conformance to the SwiftSyntaxRule protocol and a default makeVisitor(file:) implementation +that creates a visitor defined in the rule struct.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @attached(extension, conformances: SwiftSyntaxRule, SwiftSyntaxCorrectableRule, OptInRule, Rule, names: named(makeVisitor(file:)
    +), named(preprocess(file:)), named(makeRewriter(file:))) public macro SwiftSyntaxRule(foldExpressions: Bool = false, explicitRewriter: Bool = false, correctable: Bool = false, optIn: Bool = false) = #externalMacro(
    +    module: "SwiftLintCoreMacros",
    +    type: "SwiftSyntaxRule"
    +)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + +
    + + foldExpressions + + +
    +

    Setting it to true adds an implementation of preprocess(file:) which folds expressions + before they are passed to the visitor.

    +
    +
    + + explicitRewriter + + +
    +

    Set it to true to add a makeRewriter(file:) implementation which creates a rewriter + defined in the rule struct. In this case, the rule automatically conforms to + SwiftSyntaxCorrectableRule.

    +
    +
    + + correctable + + +
    +

    Set it to true to make the rule conform to SwiftSyntaxCorrectableRule without an explicit + rewriter.

    +
    +
    + + optIn + + +
    +

    Set it to true to make the rule conform to OptInRule.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols.html new file mode 100644 index 000000000..c626bd9b3 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols.html @@ -0,0 +1,932 @@ + + + + Protocols Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Protocols

+

The following protocols are available globally.

+ +
+
+ +
+
+
+
    +
  • +
    + + + + Documentable + +
    +
    +
    +
    +
    +
    +

    A type that can be converted into a human-readable representation.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol Documentable
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Property wrapper +

+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    Type of an object that can be used as a configuration element.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol AcceptableByConfigurationElement
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + InlinableOptionType + +
    +
    +
    +
    +
    +
    +

    An option type that can appear inlined into its using configuration.

    + +

    The ConfigurationElement must opt into this behavior. In this case, the option does not have a key. This is +almost exclusively useful for common RuleConfigurations that are used in many other rules as child +configurations.

    +
    +

    Warning

    +

    A type conforming to this protocol is assumed to throw an issue in its apply method only when it’s +absolutely clear that there is an error in the YAML configuration passed in. Since it may be used in a nested +context and doesn’t know about the outer configuration, it’s not always clear if a certain key-value is really +unacceptable.

    + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol InlinableOptionType : AcceptableByConfigurationElement
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + VersionComparable + +
    +
    +
    +
    +
    +
    +

    A comparable major.minor.patch version number.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol VersionComparable : Comparable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + ASTRule + +
    +
    +
    +
    +
    +
    +

    A rule that leverages the Swift source’s pre-typechecked Abstract Syntax Tree to recurse into the source’s +structure, validating the rule recursively in nested source bodies.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol ASTRule : Rule
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Interface providing access to a cache description.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol CacheDescriptionProvider
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + AnyCollectingRule + +
    +
    +
    +
    +
    +
    +

    Type-erased protocol used to check whether a rule is collectable.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol AnyCollectingRule : Rule
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + CollectingRule + +
    +
    +
    +
    +
    +
    +

    A rule that requires knowledge of all other files being linted.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol CollectingRule : AnyCollectingRule
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + Rule + +
    +
    +
    +
    +
    +
    +

    An executable value that can identify issues (violations) in Swift source code.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol Rule
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + OptInRule + +
    +
    +
    +
    +
    +
    +

    A rule that is not enabled by default. Rules conforming to this need to be explicitly enabled by users.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol OptInRule : Rule
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + CorrectableRule + +
    +
    +
    +
    +
    +
    +

    A rule that can correct violations.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol CorrectableRule : Rule
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    A correctable rule that can apply its corrections by replacing the content of ranges in the offending file with +updated content.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol SubstitutionCorrectableRule : CorrectableRule
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + SourceKitFreeRule + +
    +
    +
    +
    +
    +
    +

    A rule that does not need SourceKit to operate and can still operate even after SourceKit has crashed.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol SourceKitFreeRule : Rule
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + AnalyzerRule + +
    +
    +
    +
    +
    +
    +

    A rule that can operate on the post-typechecked AST using compiler arguments. Performs rules that are more like +static analysis than syntactic checks.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol AnalyzerRule : OptInRule
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + RuleConfiguration + +
    +
    +
    +
    +
    +
    +

    A configuration value for a rule to allow users to modify its behavior.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol RuleConfiguration : Equatable
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    A configuration for a rule that allows to configure at least the severity.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol SeverityBasedRuleConfiguration : RuleConfiguration
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    A SwiftLint CorrectableRule that performs its corrections using a SwiftSyntax SyntaxRewriter.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol SwiftSyntaxCorrectableRule : CorrectableRule, SwiftSyntaxRule
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + SwiftSyntaxRule + +
    +
    +
    +
    +
    +
    +

    A SwiftLint Rule backed by SwiftSyntax that does not use SourceKit requests.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public protocol SwiftSyntaxRule : SourceKitFreeRule
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/ASTRule.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/ASTRule.html new file mode 100644 index 000000000..197129254 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/ASTRule.html @@ -0,0 +1,626 @@ + + + + ASTRule Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

ASTRule

+
+
+ +
public protocol ASTRule : Rule
+ +
+
+

A rule that leverages the Swift source’s pre-typechecked Abstract Syntax Tree to recurse into the source’s +structure, validating the rule recursively in nested source bodies.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + KindType + +
    +
    +
    +
    +
    +
    +

    The kind of token being recursed over.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    associatedtype KindType : RawRepresentable
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Executes the rule on a file and a subset of its AST structure, returning any violations to the rule’s +expectations.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func validate(file: SwiftLintFile, kind: KindType, dictionary: SourceKittenDictionary) -> [StyleViolation]
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + file + + +
    +

    The file for which to execute the rule.

    +
    +
    + + kind + + +
    +

    The kind of token being recursed over.

    +
    +
    + + dictionary + + +
    +

    The dictionary for an AST subset to validate.

    +
    +
    +
    +
    +

    Return Value

    +

    All style violations to the rule’s expectations.

    +
    + +
    +
    +
  • +
  • +
    + + + + kind(from:) + +
    +
    +
    +
    +
    +
    +

    Get the kind from the specified dictionary.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func kind(from dictionary: SourceKittenDictionary) -> KindType?
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + dictionary + + +
    +

    The SourceKittenDictionary representing the source structure from which to extract the + kind.

    +
    +
    +
    +
    +

    Return Value

    +

    The kind from the specified dictionary, if one was found.

    +
    + +
    +
    +
  • +
  • +
    + + + + validate(file:) + + + Extension method + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func validate(file: SwiftLintFile) -> [StyleViolation]
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + validate(file:dictionary:) + + + Extension method + +
    +
    +
    +
    +
    +
    +

    Executes the rule on a file and a subset of its AST structure, returning any violations to the rule’s +expectations.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func validate(file: SwiftLintFile, dictionary: SourceKittenDictionary) -> [StyleViolation]
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + file + + +
    +

    The file for which to execute the rule.

    +
    +
    + + dictionary + + +
    +

    The dictionary for an AST subset to validate.

    +
    +
    +
    +
    +

    Return Value

    +

    All style violations to the rule’s expectations.

    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/AcceptableByConfigurationElement.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/AcceptableByConfigurationElement.html new file mode 100644 index 000000000..1142df697 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/AcceptableByConfigurationElement.html @@ -0,0 +1,585 @@ + + + + AcceptableByConfigurationElement Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

AcceptableByConfigurationElement

+
+
+ +
public protocol AcceptableByConfigurationElement
+ +
+
+

Type of an object that can be used as a configuration element.

+ + +
+
+ +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    Initializer taking a value from a configuration to create an element of Self.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    init(fromAny value: Any, context ruleID: String) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + value + + +
    +

    Value from a configuration.

    +
    +
    + + ruleID + + +
    +

    The rule’s identifier in which context the configuration parsing runs.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + asOption() + +
    +
    +
    +
    +
    +
    +

    Make the object an option.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func asOption() -> OptionType
    + +
    +
    +
    +

    Return Value

    +

    Option representing the object.

    +
    + +
    +
    +
  • +
  • +
    + + + + asDescription(with:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Make the object a description.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func asDescription(with key: String) -> RuleConfigurationDescription
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + key + + +
    +

    Name of the option to be put into the description.

    +
    +
    +
    +
    +

    Return Value

    +

    Configuration description of this object.

    +
    + +
    +
    +
  • +
  • +
    + + + + apply(_:ruleID:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Update the object.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    mutating func apply(_ value: Any, ruleID: String) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + value + + +
    +

    New underlying data for the object.

    +
    +
    + + ruleID + + +
    +

    The rule’s identifier in which context the configuration parsing runs.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/AnalyzerRule.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/AnalyzerRule.html new file mode 100644 index 000000000..059a6dba2 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/AnalyzerRule.html @@ -0,0 +1,395 @@ + + + + AnalyzerRule Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

AnalyzerRule

+
+
+ +
public protocol AnalyzerRule : OptInRule
+ +
+
+

A rule that can operate on the post-typechecked AST using compiler arguments. Performs rules that are more like +static analysis than syntactic checks.

+ + +
+
+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/CacheDescriptionProvider.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/CacheDescriptionProvider.html new file mode 100644 index 000000000..fe9e313bb --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/CacheDescriptionProvider.html @@ -0,0 +1,393 @@ + + + + CacheDescriptionProvider Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

CacheDescriptionProvider

+
+
+ +
public protocol CacheDescriptionProvider
+ +
+
+

Interface providing access to a cache description.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + cacheDescription + +
    +
    +
    +
    +
    +
    +

    The cache description which will be used to determine if a previous +cached value is still valid given the new cache value.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    var cacheDescription: String { get }
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/CollectingRule.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/CollectingRule.html new file mode 100644 index 000000000..47786092d --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/CollectingRule.html @@ -0,0 +1,798 @@ + + + + CollectingRule Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

CollectingRule

+
+
+ +
public protocol CollectingRule : AnyCollectingRule
+ +
+
+

A rule that requires knowledge of all other files being linted.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + FileInfo + +
    +
    +
    +
    +
    +
    +

    The kind of information to collect for each file being linted for this rule.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    associatedtype FileInfo
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + collectInfo(for:compilerArguments:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Collects information for the specified file, to be analyzed by a CollectedLinter.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func collectInfo(for file: SwiftLintFile, compilerArguments: [String]) -> FileInfo
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + file + + +
    +

    The file for which to collect info.

    +
    +
    + + compilerArguments + + +
    +

    The compiler arguments needed to compile this file.

    +
    +
    +
    +
    +

    Return Value

    +

    The collected file information.

    +
    + +
    +
    +
  • +
  • +
    + + + + collectInfo(for:) + +
    +
    +
    +
    +
    +
    +

    Collects information for the specified file, to be analyzed by a CollectedLinter.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func collectInfo(for file: SwiftLintFile) -> FileInfo
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + file + + +
    +

    The file for which to collect info.

    +
    +
    +
    +
    +

    Return Value

    +

    The collected file information.

    +
    + +
    +
    +
  • +
  • +
    + + + + validate(file:collectedInfo:compilerArguments:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Executes the rule on a file after collecting file info for all files and returns any violations to the rule’s +expectations.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func validate(file: SwiftLintFile,
    +              collectedInfo: [SwiftLintFile: FileInfo],
    +              compilerArguments: [String]) -> [StyleViolation]
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + file + + +
    +

    The file for which to execute the rule.

    +
    +
    + + collectedInfo + + +
    +

    All collected info for all files.

    +
    +
    + + compilerArguments + + +
    +

    The compiler arguments needed to compile this file.

    +
    +
    +
    +
    +

    Return Value

    +

    All style violations to the rule’s expectations.

    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Executes the rule on a file after collecting file info for all files and returns any violations to the rule’s +expectations.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func validate(file: SwiftLintFile, collectedInfo: [SwiftLintFile : FileInfo]) -> [StyleViolation]
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + file + + +
    +

    The file for which to execute the rule.

    +
    +
    + + collectedInfo + + +
    +

    All collected info for all files.

    +
    +
    +
    +
    +

    Return Value

    +

    All style violations to the rule’s expectations.

    +
    + +
    +
    +
  • +
  • +
    + + + + collectInfo(for:into:compilerArguments:) + + + Extension method + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func collectInfo(for file: SwiftLintFile, into storage: RuleStorage, compilerArguments: [String])
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + validate(file:using:compilerArguments:) + + + Extension method + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func validate(file: SwiftLintFile, using storage: RuleStorage, compilerArguments: [String]) -> [StyleViolation]
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + validate(file:) + + + Extension method + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func validate(file _: SwiftLintFile) -> [StyleViolation]
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + validate(file:compilerArguments:) + + + Extension method + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func validate(file _: SwiftLintFile, compilerArguments _: [String]) -> [StyleViolation]
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/CorrectableRule.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/CorrectableRule.html new file mode 100644 index 000000000..fa671d7f3 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/CorrectableRule.html @@ -0,0 +1,577 @@ + + + + CorrectableRule Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

CorrectableRule

+
+
+ +
public protocol CorrectableRule : Rule
+ +
+
+

A rule that can correct violations.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + correct(file:compilerArguments:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Attempts to correct the violations to this rule in the specified file.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func correct(file: SwiftLintFile, compilerArguments: [String]) -> [Correction]
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + file + + +
    +

    The file for which to correct violations.

    +
    +
    + + compilerArguments + + +
    +

    The compiler arguments needed to compile this file.

    +
    +
    +
    +
    +

    Return Value

    +

    All corrections that were applied.

    +
    + +
    +
    +
  • +
  • +
    + + + + correct(file:) + +
    +
    +
    +
    +
    +
    +

    Attempts to correct the violations to this rule in the specified file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func correct(file: SwiftLintFile) -> [Correction]
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + file + + +
    +

    The file for which to correct violations.

    +
    +
    +
    +
    +

    Return Value

    +

    All corrections that were applied.

    +
    + +
    +
    +
  • +
  • +
    + + + + correct(file:using:compilerArguments:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Attempts to correct the violations to this rule in the specified file after collecting file info for all files +and returns all corrections that were applied.

    +
    +

    Note

    +

    This function is called by the linter and is always implemented in extensions.

    + +
    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func correct(file: SwiftLintFile, using storage: RuleStorage, compilerArguments: [String]) -> [Correction]
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + file + + +
    +

    The file for which to execute the rule.

    +
    +
    + + storage + + +
    +

    The storage object containing all collected info.

    +
    +
    + + compilerArguments + + +
    +

    The compiler arguments needed to compile this file.

    +
    +
    +
    +
    +

    Return Value

    +

    All corrections that were applied.

    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/Documentable.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/Documentable.html new file mode 100644 index 000000000..d50dd96bf --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/Documentable.html @@ -0,0 +1,494 @@ + + + + Documentable Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Documentable

+
+
+ +
public protocol Documentable
+ +
+
+

A type that can be converted into a human-readable representation.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + markdown() + +
    +
    +
    +
    +
    +
    +

    Convert an object to Markdown.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func markdown() -> String
    + +
    +
    +
    +

    Return Value

    +

    A Markdown string describing the object.

    +
    + +
    +
    +
  • +
  • +
    + + + + oneLiner() + +
    +
    +
    +
    +
    +
    +

    Convert an object to a single line string.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func oneLiner() -> String
    + +
    +
    +
    +

    Return Value

    +

    A “one liner” describing the object.

    +
    + +
    +
    +
  • +
  • +
    + + + + hasContent + +
    +
    +
    +
    +
    +
    +

    Indicate if the item has some content that is useful to document.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    var hasContent: Bool { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + yaml() + +
    +
    +
    +
    +
    +
    +

    Convert an object to YAML as used in .swiftlint.yml.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func yaml() -> String
    + +
    +
    +
    +

    Return Value

    +

    A YAML snippet that can be used in configuration files.

    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/Rule.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/Rule.html new file mode 100644 index 000000000..210f1024f --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/Rule.html @@ -0,0 +1,1190 @@ + + + + Rule Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Rule

+
+
+ +
public protocol Rule
+ +
+
+

An executable value that can identify issues (violations) in Swift source code.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + ConfigurationType + +
    +
    +
    +
    +
    +
    +

    The type of the configuration used to configure this rule.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    associatedtype ConfigurationType : RuleConfiguration
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + description + +
    +
    +
    +
    +
    +
    +

    A verbose description of many of this rule’s properties.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static var description: RuleDescription { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + configuration + +
    +
    +
    +
    +
    +
    +

    This rule’s configuration.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    var configuration: ConfigurationType { get set }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + shouldLintEmptyFiles + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Whether this rule should be used on empty files. Defaults to false.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    var shouldLintEmptyFiles: Bool { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init() + +
    +
    +
    +
    +
    +
    +

    A default initializer for rules. All rules need to be trivially initializable.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    init()
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(configuration:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Creates a rule by applying its configuration.

    +
    +

    Throws

    +

    Throws if the configuration didn’t match the expected format.

    + +
    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    init(configuration: Any) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + configuration + + +
    +

    The untyped configuration value to apply.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + createConfigurationDescription(exclusiveOptions:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Create a description of how this rule has been configured to run.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func createConfigurationDescription(exclusiveOptions: Set<String>) -> RuleConfigurationDescription
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + validate(file:compilerArguments:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Executes the rule on a file and returns any violations to the rule’s expectations.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func validate(file: SwiftLintFile, compilerArguments: [String]) -> [StyleViolation]
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + file + + +
    +

    The file for which to execute the rule.

    +
    +
    + + compilerArguments + + +
    +

    The compiler arguments needed to compile this file.

    +
    +
    +
    +
    +

    Return Value

    +

    All style violations to the rule’s expectations.

    +
    + +
    +
    +
  • +
  • +
    + + + + validate(file:) + +
    +
    +
    +
    +
    +
    +

    Executes the rule on a file and returns any violations to the rule’s expectations.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func validate(file: SwiftLintFile) -> [StyleViolation]
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + file + + +
    +

    The file for which to execute the rule.

    +
    +
    +
    +
    +

    Return Value

    +

    All style violations to the rule’s expectations.

    +
    + +
    +
    +
  • +
  • +
    + + + + isEqualTo(_:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Whether or not the specified rule is equivalent to the current rule.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func isEqualTo(_ rule: any Rule) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + rule + + +
    +

    The rule value to compare against.

    +
    +
    +
    +
    +

    Return Value

    +

    Whether or not the specified rule is equivalent to the current rule.

    +
    + +
    +
    +
  • +
  • +
    + + + + collectInfo(for:into:compilerArguments:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Collects information for the specified file in a storage object, to be analyzed by a CollectedLinter.

    +
    +

    Note

    +

    This function is called by the linter and is always implemented in extensions.

    + +
    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func collectInfo(for file: SwiftLintFile, into storage: RuleStorage, compilerArguments: [String])
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + file + + +
    +

    The file for which to collect info.

    +
    +
    + + storage + + +
    +

    The storage object where collected info should be saved.

    +
    +
    + + compilerArguments + + +
    +

    The compiler arguments needed to compile this file.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + validate(file:using:compilerArguments:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Executes the rule on a file after collecting file info for all files and returns any violations to the rule’s +expectations.

    +
    +

    Note

    +

    This function is called by the linter and is always implemented in extensions.

    + +
    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func validate(file: SwiftLintFile, using storage: RuleStorage, compilerArguments: [String]) -> [StyleViolation]
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + file + + +
    +

    The file for which to execute the rule.

    +
    +
    + + storage + + +
    +

    The storage object containing all collected info.

    +
    +
    + + compilerArguments + + +
    +

    The compiler arguments needed to compile this file.

    +
    +
    +
    +
    +

    Return Value

    +

    All style violations to the rule’s expectations.

    +
    + +
    +
    +
  • +
  • +
    + + + + canBeDisabled(violation:by:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Checks if a style violation can be disabled by a command specifying a rule ID. Only the rule can claim that for +sure since it knows all the possible identifiers.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func canBeDisabled(violation: StyleViolation, by ruleID: RuleIdentifier) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + violation + + +
    +

    A style violation.

    +
    +
    + + ruleID + + +
    +

    The name of a rule as used in a disable command.

    +
    +
    +
    +
    +

    Return Value

    +

    A boolean value indicating whether the violation can be disabled by the given ID.

    +
    + +
    +
    +
  • +
  • +
    + + + + isEnabled(in:for:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Checks if a the rule is enabled in a given region. A specific rule ID can be provided in case a rule supports +more than one identifier.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func isEnabled(in region: Region, for ruleID: String) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + region + + +
    +

    The region to check.

    +
    +
    + + ruleID + + +
    +

    Rule identifier deviating from the default rule’s name.

    +
    +
    +
    +
    +

    Return Value

    +

    A boolean value indicating whether the rule is enabled in the given region.

    +
    + +
    +
    +
  • +
  • +
    + + + + cacheDescription + + + Extension method + +
    +
    +
    +
    +
    +
    +

    The cache description which will be used to determine if a previous +cached value is still valid given the new cache value.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    var cacheDescription: String { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + identifier + + + Extension method + +
    +
    +
    +
    +
    +
    +

    The rule’s unique identifier which is the same as Rule.description.identifier.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static var identifier: String { get }
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/RuleConfiguration.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/RuleConfiguration.html new file mode 100644 index 000000000..5ebacbece --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/RuleConfiguration.html @@ -0,0 +1,555 @@ + + + + RuleConfiguration Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

RuleConfiguration

+
+
+ +
public protocol RuleConfiguration : Equatable
+ +
+
+

A configuration value for a rule to allow users to modify its behavior.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + Parent + +
    +
    +
    +
    +
    +
    +

    The type of the rule that’s using this configuration.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    associatedtype Parent : Rule
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + parameterDescription + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    A description for this configuration’s parameters. It can be built using the annotated result builder.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @RuleConfigurationDescriptionBuilder
    +var parameterDescription: RuleConfigurationDescription? { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + apply(configuration:) + +
    +
    +
    +
    +
    +
    +

    Apply an untyped configuration to the current value.

    +
    +

    Throws

    +

    Throws if the configuration is not in the expected format.

    + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    mutating func apply(configuration: Any) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + configuration + + +
    +

    The untyped configuration value to apply.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + validate() + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Run a sanity check on the configuration, perform optional postprocessing steps and/or warn about potential +issues.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    mutating func validate() throws
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + supportedKeys + + + Extension method + +
    +
    +
    +
    +
    +
    +

    All keys supported by this configuration.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    var supportedKeys: Set<String> { get }
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/SeverityBasedRuleConfiguration.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/SeverityBasedRuleConfiguration.html new file mode 100644 index 000000000..cced7a5c2 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/SeverityBasedRuleConfiguration.html @@ -0,0 +1,425 @@ + + + + SeverityBasedRuleConfiguration Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

SeverityBasedRuleConfiguration

+
+
+ +
public protocol SeverityBasedRuleConfiguration : RuleConfiguration
+ +
+
+

A configuration for a rule that allows to configure at least the severity.

+ + +
+
+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/SubstitutionCorrectableRule.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/SubstitutionCorrectableRule.html new file mode 100644 index 000000000..6da1e08f3 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/SubstitutionCorrectableRule.html @@ -0,0 +1,513 @@ + + + + SubstitutionCorrectableRule Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

SubstitutionCorrectableRule

+
+
+ +
public protocol SubstitutionCorrectableRule : CorrectableRule
+ +
+
+

A correctable rule that can apply its corrections by replacing the content of ranges in the offending file with +updated content.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + violationRanges(in:) + +
    +
    +
    +
    +
    +
    +

    Returns the NSString-based NSRanges to be replaced in the specified file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func violationRanges(in file: SwiftLintFile) -> [NSRange]
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + file + + +
    +

    The file in which to find ranges of violations for this rule.

    +
    +
    +
    +
    +

    Return Value

    +

    The NSString-based NSRanges to be replaced in the specified file.

    +
    + +
    +
    +
  • +
  • +
    + + + + substitution(for:in:) + +
    +
    +
    +
    +
    +
    +

    Returns the substitution to apply for the given range.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func substitution(for violationRange: NSRange, in file: SwiftLintFile) -> (NSRange, String)?
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + violationRange + + +
    +

    The NSString-based NSRange of the violation that should be replaced.

    +
    +
    + + file + + +
    +

    The file in which the violation should be replaced.

    +
    +
    +
    +
    +

    Return Value

    +

    The range of the correction and its contents, if one could be computed.

    +
    + +
    +
    +
  • +
  • +
    + + + + correct(file:) + + + Extension method + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func correct(file: SwiftLintFile) -> [Correction]
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/SwiftSyntaxCorrectableRule.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/SwiftSyntaxCorrectableRule.html new file mode 100644 index 000000000..55cc7f575 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/SwiftSyntaxCorrectableRule.html @@ -0,0 +1,455 @@ + + + + SwiftSyntaxCorrectableRule Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

SwiftSyntaxCorrectableRule

+
+
+ +
public protocol SwiftSyntaxCorrectableRule : CorrectableRule, SwiftSyntaxRule
+ +
+
+

A SwiftLint CorrectableRule that performs its corrections using a SwiftSyntax SyntaxRewriter.

+ + +
+
+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/SwiftSyntaxRule.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/SwiftSyntaxRule.html new file mode 100644 index 000000000..45798e3f4 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/SwiftSyntaxRule.html @@ -0,0 +1,583 @@ + + + + SwiftSyntaxRule Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

SwiftSyntaxRule

+
+
+ +
public protocol SwiftSyntaxRule : SourceKitFreeRule
+ +
+
+

A SwiftLint Rule backed by SwiftSyntax that does not use SourceKit requests.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + makeVisitor(file:) + +
    +
    +
    +
    +
    +
    +

    Produce a ViolationsSyntaxVisitor for the given file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func makeVisitor(file: SwiftLintFile) -> ViolationsSyntaxVisitor<ConfigurationType>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + file + + +
    +

    The file for which to produce the visitor.

    +
    +
    +
    +
    +

    Return Value

    +

    A ViolationsSyntaxVisitor for the given file.

    +
    + +
    +
    +
  • +
  • +
    + + + + makeViolation(file:violation:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Produce a violation for the given file and absolute position.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func makeViolation(file: SwiftLintFile, violation: ReasonedRuleViolation) -> StyleViolation
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + file + + +
    +

    The file for which to produce the violation.

    +
    +
    + + violation + + +
    +

    A violation in the file.

    +
    +
    +
    +
    +

    Return Value

    +

    A violation for the given file and absolute position.

    +
    + +
    +
    +
  • +
  • +
    + + + + preprocess(file:) + + + Default implementation + +
    +
    +
    +
    +
    +
    +

    Gives a chance for the rule to do some pre-processing on the syntax tree. +One typical example is using SwiftOperators to “fold” the tree, resolving operators precedence. +This can also be used to skip validation in a given file. +By default, it just returns the file’s syntaxTree.

    + +
    +

    Default Implementation

    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func preprocess(file: SwiftLintFile) -> SourceFileSyntax?
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + file + + +
    +

    The file to run pre-processing on.

    +
    +
    +
    +
    +

    Return Value

    +

    The tree that will be used to check for violations. If nil, this rule will return no violations.

    +
    + +
    +
    +
  • +
  • +
    + + + + validate(file:) + + + Extension method + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @inlinable
    +func validate(file: SwiftLintFile) -> [StyleViolation]
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/VersionComparable.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/VersionComparable.html new file mode 100644 index 000000000..115f94542 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Protocols/VersionComparable.html @@ -0,0 +1,456 @@ + + + + VersionComparable Protocol Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

VersionComparable

+
+
+ +
public protocol VersionComparable : Comparable
+ +
+
+

A comparable major.minor.patch version number.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + rawValue + +
    +
    +
    +
    +
    +
    +

    The version string.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    var rawValue: String { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + ==(_:_:) + + + Extension method + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func == (lhs: Self, rhs: Self) -> Bool
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + <(_:_:) + + + Extension method + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func < (lhs: Self, rhs: Self) -> Bool
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Rules.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Rules.html new file mode 100644 index 000000000..5aa949c35 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Rules.html @@ -0,0 +1,358 @@ + + + + Rules Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Rules

+ +
+
+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs.html new file mode 100644 index 000000000..b91e5fb74 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs.html @@ -0,0 +1,1152 @@ + + + + Structures Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Structures

+

The following structures are available globally.

+ +
+
+ +
+
+
+
    +
  • +
    + + + + Stack + +
    +
    +
    +
    +
    +
    +

    A basic stack type implementing the LIFO principle - only the last inserted element can be accessed and removed.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct Stack<Element>
    +
    extension Stack: Sequence
    +
    extension Stack: CustomDebugStringConvertible where Element: CustomDebugStringConvertible
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + Baseline + +
    +
    +
    +
    +
    +
    +

    A set of violations that can be used to filter newly detected violations.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct Baseline : Equatable
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    A rule configuration that allows to disable (off) an option of a rule or specify its severity level in which +case it’s active.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct ChildOptionSeverityConfiguration<Parent: Rule>: RuleConfiguration,
    +                                                              AcceptableByConfigurationElement,
    +                                                              Sendable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + Command + +
    +
    +
    +
    +
    +
    +

    A SwiftLint-interpretable command to modify SwiftLint’s behavior embedded as comments in source code.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct Command : Equatable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + Correction + +
    +
    +
    +
    +
    +
    +

    A value describing a SwiftLint violation that was corrected.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct Correction : Equatable, Sendable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + Example + +
    +
    +
    +
    +
    +
    +

    Captures code and context information for an example of a triggering or +non-triggering style

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct Example : Sendable
    +
    extension Example: Hashable
    +
    extension Example: Comparable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + Location + +
    +
    +
    +
    +
    +
    +

    The placement of a segment of Swift in a collection of source files.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct Location : CustomStringConvertible, Comparable, Codable, Sendable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + Region + +
    +
    +
    +
    +
    +
    +

    A contiguous region of Swift source code.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct Region : Equatable, Sendable
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Description of a rule configuration.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct RuleConfigurationDescription : Equatable, Sendable
    +
    extension RuleConfigurationDescription: Documentable
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    A single option of a RuleConfigurationDescription.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct RuleConfigurationOption : Equatable, Sendable
    +
    extension RuleConfigurationOption: Documentable
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Result builder +

+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    A result builder creating configuration descriptions.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @resultBuilder
    +public struct RuleConfigurationDescriptionBuilder
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Property wrapper +

+
+
+
    +
  • +
    + + + + ConfigurationElement + +
    +
    +
    +
    +
    +
    +

    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. +
    3. 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 +
    4. +
    5. 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 +
    6. +
    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @propertyWrapper
    +public struct ConfigurationElement<T> : Equatable, Sendable where T : Equatable, T : Sendable, T : AcceptableByConfigurationElement
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + SeverityConfiguration + +
    +
    +
    +
    +
    +
    +

    A rule configuration that allows specifying the desired severity level for violations.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct SeverityConfiguration<Parent> : SeverityBasedRuleConfiguration, InlinableOptionType, Sendable where Parent : Rule
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + RuleDescription + +
    +
    +
    +
    +
    +
    +

    A detailed description for a SwiftLint rule. Used for both documentation and testing purposes.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct RuleDescription : Equatable, Sendable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + RuleList + +
    +
    +
    +
    +
    +
    +

    A list of available SwiftLint rules.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct RuleList
    +
    extension RuleList: Equatable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + RuleParameter + +
    +
    +
    +
    +
    +
    +

    A configuration parameter for rules.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct RuleParameter<T> : Equatable where T : Equatable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + StyleViolation + +
    +
    +
    +
    +
    +
    +

    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
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + SwiftLintSyntaxMap + +
    +
    +
    +
    +
    +
    +

    Represents a Swift file’s syntax information.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct SwiftLintSyntaxMap
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + SwiftLintSyntaxToken + +
    +
    +
    +
    +
    +
    +

    A SwiftLint-aware Swift syntax token.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct SwiftLintSyntaxToken
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + SwiftVersion + +
    +
    +
    +
    +
    +
    +

    A value describing the version of the Swift compiler.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct SwiftVersion : RawRepresentable, Codable, VersionComparable, Sendable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + ReasonedRuleViolation + +
    +
    +
    +
    +
    +
    +

    A violation produced by ViolationsSyntaxVisitors.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct ReasonedRuleViolation : Comparable, Hashable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + RegexConfiguration + +
    +
    +
    +
    +
    +
    +

    A rule configuration used for defining custom rules in yaml.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct RegexConfiguration<Parent: Rule>: SeverityBasedRuleConfiguration, Hashable,
    +                                                CacheDescriptionProvider, InlinableOptionType
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    A rule configuration that allows specifying thresholds for warning and error severities.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct SeverityLevelsConfiguration<Parent> : RuleConfiguration, InlinableOptionType, Sendable where Parent : Rule
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Baseline.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Baseline.html new file mode 100644 index 000000000..5a8f4e46b --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Baseline.html @@ -0,0 +1,645 @@ + + + + Baseline Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Baseline

+
+
+ +
public struct Baseline : Equatable
+ +
+
+

A set of violations that can be used to filter newly detected violations.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + violations + +
    +
    +
    +
    +
    +
    +

    The stored violations.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var violations: [StyleViolation] { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(fromPath:) + +
    +
    +
    +
    +
    +
    +

    Creates a Baseline from a saved file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(fromPath path: String) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + fromPath + + +
    +

    The path to read from.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(violations:) + +
    +
    +
    +
    +
    +
    +

    Creates a Baseline from a list of violations.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(violations: [StyleViolation])
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + violations + + +
    +

    The violations for the baseline.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + write(toPath:) + +
    +
    +
    +
    +
    +
    +

    Writes a Baseline to disk in JSON format.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func write(toPath path: String) throws
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + toPath + + +
    +

    The path to write to.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + filter(_:) + +
    +
    +
    +
    +
    +
    +

    Filters out violations that are present in the Baseline.

    + +

    Assumes that all violations are from the same file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func filter(_ violations: [StyleViolation]) -> [StyleViolation]
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + violations + + +
    +

    The violations to filter.

    +
    +
    +
    +
    +

    Return Value

    +

    The new violations.

    +
    + +
    +
    +
  • +
  • +
    + + + + compare(_:) + +
    +
    +
    +
    +
    +
    +

    Returns the violations that are present in another Baseline, but not in this one.

    + +

    The violations are filtered using the same algorithm as the filter method above.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func compare(_ otherBaseline: `Self`) -> [StyleViolation]
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + otherBaseline + + +
    +

    The other Baseline.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/ChildOptionSeverityConfiguration.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/ChildOptionSeverityConfiguration.html new file mode 100644 index 000000000..36dfe07a6 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/ChildOptionSeverityConfiguration.html @@ -0,0 +1,544 @@ + + + + ChildOptionSeverityConfiguration Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

ChildOptionSeverityConfiguration

+
+
+ +
public struct ChildOptionSeverityConfiguration<Parent: Rule>: RuleConfiguration,
+                                                              AcceptableByConfigurationElement,
+                                                              Sendable
+ +
+
+

A rule configuration that allows to disable (off) an option of a rule or specify its severity level in which +case it’s active.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + error + +
    +
    +
    +
    +
    +
    +

    Configuration with a warning severity.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static var error: `Self` { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + warning + +
    +
    +
    +
    +
    +
    +

    Configuration with an error severity.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static var warning: `Self` { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + off + +
    +
    +
    +
    +
    +
    +

    Configuration disabling an option.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static var off: `Self` { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + severity + +
    +
    +
    +
    +
    +
    +

    The ChildOptionSeverityConfiguration mapped to a usually used ViolationSeverity. It’s nil if the option +is set to off.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var severity: ViolationSeverity? { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + apply(configuration:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public mutating func apply(configuration: Any) throws
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + asOption() + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func asOption() -> OptionType
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Command.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Command.html new file mode 100644 index 000000000..befd2f746 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Command.html @@ -0,0 +1,763 @@ + + + + Command Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Command

+
+
+ +
public struct Command : Equatable
+ +
+
+

A SwiftLint-interpretable command to modify SwiftLint’s behavior embedded as comments in source code.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + Action + +
    +
    +
    +
    +
    +
    +

    The action (verb) that SwiftLint should perform when interpreting this command.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum Action : String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + Modifier + +
    +
    +
    +
    +
    +
    +

    The modifier for a command, used to modify its scope.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum Modifier : String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + action + +
    +
    +
    +
    +
    +
    +

    The action (verb) that SwiftLint should perform when interpreting this command.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let action: Action
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + ruleIdentifiers + +
    +
    +
    +
    +
    +
    +

    The identifiers for the rules associated with this command.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let ruleIdentifiers: Set<RuleIdentifier>
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + line + +
    +
    +
    +
    +
    +
    +

    The line in the source file where this command is defined.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let line: Int
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + character + +
    +
    +
    +
    +
    +
    +

    The character offset within the line in the source file where this command is defined.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let character: Int?
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + modifier + +
    +
    +
    +
    +
    +
    +

    This command’s modifier, if any.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let modifier: Modifier?
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a command based on the specified parameters.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(action: Action,
    +            ruleIdentifiers: Set<RuleIdentifier> = [],
    +            line: Int = 0,
    +            character: Int? = nil,
    +            modifier: Modifier? = nil,
    +            trailingComment: String? = nil)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + action + + +
    +

    This command’s action.

    +
    +
    + + ruleIdentifiers + + +
    +

    The identifiers for the rules associated with this command.

    +
    +
    + + line + + +
    +

    The line in the source file where this command is defined.

    +
    +
    + + character + + +
    +

    The character offset within the line in the source file where this command is + defined.

    +
    +
    + + modifier + + +
    +

    This command’s modifier, if any.

    +
    +
    + + trailingComment + + +
    +

    The comment following this command’s - delimiter, if any.

    +
    +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a command based on the specified parameters.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(actionString: String, line: Int, character: Int)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + actionString + + +
    +

    The string in the command’s definition describing its action.

    +
    +
    + + line + + +
    +

    The line in the source file where this command is defined.

    +
    +
    + + character + + +
    +

    The character offset within the line in the source file where this command is + defined.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Command/Action.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Command/Action.html new file mode 100644 index 000000000..a8feb5c9f --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Command/Action.html @@ -0,0 +1,454 @@ + + + + Action Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Action

+
+
+ +
public enum Action : String
+ +
+
+

The action (verb) that SwiftLint should perform when interpreting this command.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + enable + +
    +
    +
    +
    +
    +
    +

    The rule(s) associated with this command should be enabled by the SwiftLint engine.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case enable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + disable + +
    +
    +
    +
    +
    +
    +

    The rule(s) associated with this command should be disabled by the SwiftLint engine.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case disable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + invalid + +
    +
    +
    +
    +
    +
    +

    The action string was invalid.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case invalid
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Command/Modifier.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Command/Modifier.html new file mode 100644 index 000000000..a0ada1d49 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Command/Modifier.html @@ -0,0 +1,484 @@ + + + + Modifier Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Modifier

+
+
+ +
public enum Modifier : String
+ +
+
+

The modifier for a command, used to modify its scope.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + previous + +
    +
    +
    +
    +
    +
    +

    The command should only apply to the line preceding its definition.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case previous
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + this + +
    +
    +
    +
    +
    +
    +

    The command should only apply to the same line as its definition.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case this
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + next + +
    +
    +
    +
    +
    +
    +

    The command should only apply to the line following its definition.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case next
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + invalid + +
    +
    +
    +
    +
    +
    +

    The modifier string was invalid.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    case invalid
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/ConfigurationElement.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/ConfigurationElement.html new file mode 100644 index 000000000..b60118411 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/ConfigurationElement.html @@ -0,0 +1,858 @@ + + + + ConfigurationElement Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

ConfigurationElement

+
+
+ +
@propertyWrapper
+public struct ConfigurationElement<T> : Equatable, Sendable where T : Equatable, T : Sendable, T : AcceptableByConfigurationElement
+ +
+
+

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. +
  3. 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 +
  4. +
  5. 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 +
  6. +
+ + +
+
+ +
+
+
+
    +
  • +
    + + + + DeprecationNotice + +
    +
    +
    +
    +
    +
    +

    A deprecation notice.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public enum DeprecationNotice : Sendable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + wrappedValue + +
    +
    +
    +
    +
    +
    +

    Wrapped option value.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var wrappedValue: T { get set }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + projectedValue + +
    +
    +
    +
    +
    +
    +

    The wrapper itself providing access to all its data. This field can only be accessed by the +element’s name prefixed with a $.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var projectedValue: `Self` { get set }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + key + +
    +
    +
    +
    +
    +
    +

    Name of this configuration entry.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var key: String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + inline + +
    +
    +
    +
    +
    +
    +

    Whether this configuration element will be inlined into its description.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let inline: Bool
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Default constructor.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(wrappedValue value: T,
    +            key: String,
    +            deprecationNotice: DeprecationNotice? = nil,
    +            postprocessor: @escaping @Sendable (inout T) -> Void = { _ in })
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + +
    + + value + + +
    +

    Value to be wrapped.

    +
    +
    + + key + + +
    +

    Optional name of the option. If not specified, it will be inferred from the attributed property.

    +
    +
    + + deprecationNotice + + +
    +

    An optional deprecation notice in case an option is outdated and/or has been replaced by + an alternative.

    +
    +
    + + postprocessor + + +
    +

    Function to be applied to the wrapped value after parsing to validate and modify it.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(key:) + +
    +
    +
    +
    +
    +
    +

    Constructor for optional values.

    + +

    It allows to skip explicit initialization of the property with nil.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init<Wrapped>(key: String) where T == Wrapped?, Wrapped : Equatable, Wrapped : Sendable, Wrapped : AcceptableByConfigurationElement
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + key + + +
    +

    Optional name of the option. If not specified, it will be inferred from the attributed property.

    +
    +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Constructor for an InlinableOptionType without a key.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(wrappedValue value: T, inline: Bool) where T : InlinableOptionType
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + value + + +
    +

    Value to be wrapped.

    +
    +
    + + inline + + +
    +

    If true, the option will be handled as it would be part of its parent. All of its options + will be inlined. Otherwise, it will be treated as a normal nested configuration with its name + inferred from the name of the attributed property.

    +
    +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Constructor for an InlinableOptionType with a name. The configuration will explicitly not be inlined.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(wrappedValue value: T, key: String) where T : InlinableOptionType
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + value + + +
    +

    Value to be wrapped.

    +
    +
    + + key + + +
    +

    Name of the option.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + ==(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func == (lhs: `Self`, rhs: `Self`) -> Bool
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/ConfigurationElement/DeprecationNotice.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/ConfigurationElement/DeprecationNotice.html new file mode 100644 index 000000000..00a20f4a7 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/ConfigurationElement/DeprecationNotice.html @@ -0,0 +1,394 @@ + + + + DeprecationNotice Enumeration Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

DeprecationNotice

+
+
+ +
public enum DeprecationNotice : Sendable
+ +
+
+

A deprecation notice.

+ + +
+
+ +
+
+
+ +
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Correction.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Correction.html new file mode 100644 index 000000000..729959541 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Correction.html @@ -0,0 +1,513 @@ + + + + Correction Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Correction

+
+
+ +
public struct Correction : Equatable, Sendable
+ +
+
+

A value describing a SwiftLint violation that was corrected.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + ruleDescription + +
    +
    +
    +
    +
    +
    +

    The description of the rule for which this correction was applied.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let ruleDescription: RuleDescription
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + location + +
    +
    +
    +
    +
    +
    +

    The location of the original violation that was corrected.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let location: Location
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + consoleDescription + +
    +
    +
    +
    +
    +
    +

    The console-printable description for this correction.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var consoleDescription: String { get }
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Memberwise initializer.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(ruleDescription: RuleDescription, location: Location)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + ruleDescription + + +
    +

    The description of the rule for which this correction was applied.

    +
    +
    + + location + + +
    +

    The location of the original violation that was corrected.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Example.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Example.html new file mode 100644 index 000000000..9ca029b21 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Example.html @@ -0,0 +1,911 @@ + + + + Example Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Example

+
+
+ +
public struct Example : Sendable
+
extension Example: Hashable
+
extension Example: Comparable
+ +
+
+

Captures code and context information for an example of a triggering or +non-triggering style

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + code + +
    +
    +
    +
    +
    +
    +

    The contents of the example

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public private(set) var code: String { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + configuration + +
    +
    +
    +
    +
    +
    +

    The untyped configuration to apply to the rule, if deviating from the default configuration. +The structure should match what is expected as a configuration value for the rule being tested.

    + +

    For example, if the following YAML would be used to configure the rule:

    +
    severity: warning
    +
    + +

    Then the equivalent configuration value would be ["severity": "warning"].

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public private(set) var configuration: [String : any Sendable]? { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + testMultiByteOffsets + +
    +
    +
    +
    +
    +
    +

    Whether the example should be tested by prepending multibyte grapheme clusters

    +
    +

    See also

    + addEmoji(_:) + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public private(set) var testMultiByteOffsets: Bool { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + testOnLinux + +
    +
    +
    +
    +
    +
    +

    Whether the example should be tested on Linux

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public private(set) var testOnLinux: Bool { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + file + +
    +
    +
    +
    +
    +
    +

    The path to the file where the example was created

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public private(set) var file: StaticString { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + line + +
    +
    +
    +
    +
    +
    +

    The line in the file where the example was created

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var line: UInt
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Create a new Example with the specified code, file, and line.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    init(_ code: String,
    +     configuration: [String: any Sendable]? = nil,
    +     testMultiByteOffsets: Bool = true,
    +     testWrappingInComment: Bool = true,
    +     testWrappingInString: Bool = true,
    +     testDisableCommand: Bool = true,
    +     testOnLinux: Bool = true,
    +     file: StaticString = #filePath,
    +     line: UInt = #line,
    +     excludeFromDocumentation: Bool = false)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + code + + +
    +

    The contents of the example.

    +
    +
    + + configuration + + +
    +

    The untyped configuration to apply to the rule, if deviating from the default + configuration.

    +
    +
    + + testMultibyteOffsets + + +
    +

    Whether the example should be tested by prepending multibyte grapheme clusters.

    +
    +
    + + testWrappingInComment + + +
    +

    Whether test shall verify that the example wrapped in a comment doesn’t trigger.

    +
    +
    + + testWrappingInString + + +
    +

    Whether tests shall verify that the example wrapped into a string doesn’t trigger.

    +
    +
    + + testDisableCommand + + +
    +

    Whether tests shall verify that the disabled rule (comment in the example) doesn’t + trigger.

    +
    +
    + + testOnLinux + + +
    +

    Whether the example should be tested on Linux.

    +
    +
    + + file + + +
    +

    The path to the file where the example is located. + Defaults to the file where this initializer is called.

    +
    +
    + + line + + +
    +

    The line in the file where the example is located. + Defaults to the line where this initializer is called.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + with(code:) + +
    +
    +
    +
    +
    +
    +

    Returns the same example, but with the code that is passed in

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func with(code: String) -> Example
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + code + + +
    +

    the new code to use in the modified example

    +
    +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Returns a copy of the Example with all instances of the “↓” character removed.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func removingViolationMarkers() -> Example
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + focused() + +
    +
    +
    +
    +
    +
    +

    Makes the current example focused. This is for debugging purposes only.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func focused() -> Example
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + ==(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func == (lhs: Example, rhs: Example) -> Bool
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + hash(into:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func hash(into hasher: inout Hasher)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + <(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func < (lhs: Example, rhs: Example) -> Bool
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Location.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Location.html new file mode 100644 index 000000000..0ed9edba6 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Location.html @@ -0,0 +1,813 @@ + + + + Location Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Location

+
+
+ +
public struct Location : CustomStringConvertible, Comparable, Codable, Sendable
+ +
+
+

The placement of a segment of Swift in a collection of source files.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + file + +
    +
    +
    +
    +
    +
    +

    The file path on disk for this location.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let file: String?
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + line + +
    +
    +
    +
    +
    +
    +

    The line offset in the file for this location. 1-indexed.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let line: Int?
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + character + +
    +
    +
    +
    +
    +
    +

    The character offset in the file for this location. 1-indexed.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let character: Int?
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + description + +
    +
    +
    +
    +
    +
    +

    A lossless printable description of this location.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var description: String { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + relativeFile + +
    +
    +
    +
    +
    +
    +

    The file path for this location relative to the current working directory.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var relativeFile: String? { get }
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a Location by specifying its properties directly.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(file: String?, line: Int? = nil, character: Int? = nil)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + file + + +
    +

    The file path on disk for this location.

    +
    +
    + + line + + +
    +

    The line offset in the file for this location. 1-indexed.

    +
    +
    + + character + + +
    +

    The character offset in the file for this location. 1-indexed.

    +
    +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a Location based on a SwiftLintFile and a byte-offset into the file. +Fails if the specified offset was not a valid location in the file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(file: SwiftLintFile, byteOffset offset: ByteCount)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + file + + +
    +

    The file for this location.

    +
    +
    + + offset + + +
    +

    The offset in bytes into the file for this location.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(file:position:) + +
    +
    +
    +
    +
    +
    +

    Creates a Location based on a SwiftLintFile and a SwiftSyntax AbsolutePosition into the file. +Fails if the specified offset was not a valid location in the file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(file: SwiftLintFile, position: AbsolutePosition)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + file + + +
    +

    The file for this location.

    +
    +
    + + position + + +
    +

    The absolute position returned from SwiftSyntax.

    +
    +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a Location based on a SwiftLintFile and a UTF8 character-offset into the file. +Fails if the specified offset was not a valid location in the file.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(file: SwiftLintFile, characterOffset offset: Int)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + file + + +
    +

    The file for this location.

    +
    +
    + + offset + + +
    +

    The offset in UTF8 fragments into the file for this location.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Comparable +

+
+
+
    +
  • +
    + + + + <(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func < (lhs: `Self`, rhs: `Self`) -> Bool
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/ReasonedRuleViolation.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/ReasonedRuleViolation.html new file mode 100644 index 000000000..e01953c93 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/ReasonedRuleViolation.html @@ -0,0 +1,632 @@ + + + + ReasonedRuleViolation Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

ReasonedRuleViolation

+
+
+ +
public struct ReasonedRuleViolation : Comparable, Hashable
+ +
+
+

A violation produced by ViolationsSyntaxVisitors.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + ViolationCorrection + +
    +
    +
    +
    +
    +
    +

    The correction of a violation that is basically the violation’s range in the source code and a +replacement for this range that would fix the violation.

    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public struct ViolationCorrection : Hashable
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + position + +
    +
    +
    +
    +
    +
    +

    The violation’s position.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let position: AbsolutePosition
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + reason + +
    +
    +
    +
    +
    +
    +

    A specific reason for the violation.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let reason: String?
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + severity + +
    +
    +
    +
    +
    +
    +

    The violation’s severity.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let severity: ViolationSeverity?
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + correction + +
    +
    +
    +
    +
    +
    +

    An optional correction of the violation to be used in rewriting (see SwiftSyntaxCorrectableRule). Can be +left unset when creating a violation, especially if the rule is not correctable or provides a custom rewriter.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let correction: ViolationCorrection?
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a ReasonedRuleViolation.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(position: AbsolutePosition,
    +            reason: String? = nil,
    +            severity: ViolationSeverity? = nil,
    +            correction: ViolationCorrection? = nil)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + +
    + + position + + +
    +

    The violations position in the analyzed source file.

    +
    +
    + + reason + + +
    +

    The reason for the violation if different from the rule’s description.

    +
    +
    + + severity + + +
    +

    The severity of the violation if different from the rule’s default configured severity.

    +
    +
    + + correction + + +
    +

    An optional correction of the violation to be used in rewriting.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + <(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func < (lhs: `Self`, rhs: `Self`) -> Bool
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/ReasonedRuleViolation/ViolationCorrection.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/ReasonedRuleViolation/ViolationCorrection.html new file mode 100644 index 000000000..b82b9b592 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/ReasonedRuleViolation/ViolationCorrection.html @@ -0,0 +1,438 @@ + + + + ViolationCorrection Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

ViolationCorrection

+
+
+ +
public struct ViolationCorrection : Hashable
+ +
+
+

The correction of a violation that is basically the violation’s range in the source code and a +replacement for this range that would fix the violation.

+ + +
+
+ +
+
+
+
    +
  • + +
    +
    +
    +
    +
    +

    Create a ViolationCorrection.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(start: AbsolutePosition, end: AbsolutePosition, replacement: String)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + start + + +
    +

    Start position of the violation range.

    +
    +
    + + end + + +
    +

    End position of the violation range.

    +
    +
    + + replacement + + +
    +

    Replacement for the violating range.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/RegexConfiguration.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/RegexConfiguration.html new file mode 100644 index 000000000..10d44e97b --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/RegexConfiguration.html @@ -0,0 +1,770 @@ + + + + RegexConfiguration Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

RegexConfiguration

+
+
+ +
public struct RegexConfiguration<Parent: Rule>: SeverityBasedRuleConfiguration, Hashable,
+                                                CacheDescriptionProvider, InlinableOptionType
+ +
+
+

A rule configuration used for defining custom rules in yaml.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + identifier + +
    +
    +
    +
    +
    +
    +

    The identifier for this custom rule.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let identifier: String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + name + +
    +
    +
    +
    +
    +
    +

    The name for this custom rule.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var name: String?
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + message + +
    +
    +
    +
    +
    +
    +

    The message to be presented when producing violations.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var message: String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + included + +
    +
    +
    +
    +
    +
    +

    Regular expressions to include when matching the file path.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var included: [RegularExpression]
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + excluded + +
    +
    +
    +
    +
    +
    +

    Regular expressions to exclude when matching the file path.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var excluded: [RegularExpression]
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + excludedMatchKinds + +
    +
    +
    +
    +
    +
    +

    The syntax kinds to exclude from matches. If the regex matched syntax kinds from this list, it would +be ignored and not count as a rule violation.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var excludedMatchKinds: Set<SyntaxKind>
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + severityConfiguration + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @ConfigurationElement
    +public var severityConfiguration: SeverityConfiguration<Parent> { get set }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + captureGroup + +
    +
    +
    +
    +
    +
    +

    The index of the regex capture group to match.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var captureGroup: Int
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + cacheDescription + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var cacheDescription: String { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + description + +
    +
    +
    +
    +
    +
    +

    The RuleDescription for the custom rule defined here.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var description: RuleDescription { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(identifier:) + +
    +
    +
    +
    +
    +
    +

    Create a RegexConfiguration with the specified identifier, with other properties to be set later.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(identifier: String)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + identifier + + +
    +

    The rule identifier to use.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + apply(configuration:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public mutating func apply(configuration: Any) throws
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + hash(into:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func hash(into hasher: inout Hasher)
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Region.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Region.html new file mode 100644 index 000000000..1439663ae --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Region.html @@ -0,0 +1,800 @@ + + + + Region Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Region

+
+
+ +
public struct Region : Equatable, Sendable
+ +
+
+

A contiguous region of Swift source code.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + start + +
    +
    +
    +
    +
    +
    +

    The location describing the start of the region. All locations that are less than this value +(earlier in the source file) are not contained in this region.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let start: Location
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + end + +
    +
    +
    +
    +
    +
    +

    The location describing the end of the region. All locations that are greater than this value +(later in the source file) are not contained in this region.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let end: Location
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    All SwiftLint rule identifiers that are disabled in this region.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let disabledRuleIdentifiers: Set<RuleIdentifier>
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a Region by setting explicit values for all its properties.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(start: Location, end: Location, disabledRuleIdentifiers: Set<RuleIdentifier>)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + +
    + + start + + +
    +

    The region’s starting location.

    +
    +
    + + end + + +
    +

    The region’s ending location.

    +
    +
    + + disabledRuleIdentifiers + + +
    +

    All SwiftLint rule identifiers that are disabled in this region.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + contains(_:) + +
    +
    +
    +
    +
    +
    +

    Whether the specific location is contained in this region.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func contains(_ location: Location) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + location + + +
    +

    The location to check for containment.

    +
    +
    +
    +
    +

    Return Value

    +

    True if the specific location is contained in this region.

    +
    + +
    +
    +
  • +
  • +
    + + + + isRuleEnabled(_:) + +
    +
    +
    +
    +
    +
    +

    Whether the specified rule is enabled in this region.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func isRuleEnabled(_ rule: some Rule) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + rule + + +
    +

    The rule whose status should be determined.

    +
    +
    +
    +
    +

    Return Value

    +

    True if the specified rule is enabled in this region.

    +
    + +
    +
    +
  • +
  • +
    + + + + isRuleDisabled(_:) + +
    +
    +
    +
    +
    +
    +

    Whether the specified rule is disabled in this region.

    +
    +

    Note

    +

    For CustomRules, this will only return true if the custom_rules identifier + is used with the swiftlint disable command, but this method is never + called for CustomRules.

    + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func isRuleDisabled(_ rule: some Rule) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + rule + + +
    +

    The rule whose status should be determined.

    +
    +
    +
    +
    +

    Return Value

    +

    True if the specified rule is disabled in this region.

    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Whether the given rules are disabled in this region.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func areRulesDisabled(ruleIDs: [String]) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + ruleIDs + + +
    +

    A list of rule IDs. Typically all identifiers of a single rule.

    +
    +
    +
    +
    +

    Return Value

    +

    True if the specified rules are disabled in this region.

    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Returns the deprecated rule aliases that are disabling the specified rule in this region. +Returns the empty set if the rule isn’t disabled in this region.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func deprecatedAliasesDisabling(rule: some Rule) -> Set<String>
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + rule + + +
    +

    The rule to check.

    +
    +
    +
    +
    +

    Return Value

    +

    Deprecated rule aliases.

    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/RuleConfigurationDescription.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/RuleConfigurationDescription.html new file mode 100644 index 000000000..2b580efa6 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/RuleConfigurationDescription.html @@ -0,0 +1,479 @@ + + + + RuleConfigurationDescription Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

RuleConfigurationDescription

+
+
+ +
public struct RuleConfigurationDescription : Equatable, Sendable
+
extension RuleConfigurationDescription: Documentable
+ +
+
+

Description of a rule configuration.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + hasContent + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var hasContent: Bool { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + oneLiner() + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func oneLiner() -> String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + markdown() + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func markdown() -> String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + yaml() + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func yaml() -> String
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/RuleConfigurationOption.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/RuleConfigurationOption.html new file mode 100644 index 000000000..23619612d --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/RuleConfigurationOption.html @@ -0,0 +1,509 @@ + + + + RuleConfigurationOption Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

RuleConfigurationOption

+
+
+ +
public struct RuleConfigurationOption : Equatable, Sendable
+
extension RuleConfigurationOption: Documentable
+ +
+
+

A single option of a RuleConfigurationDescription.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + noOptions + +
    +
    +
    +
    +
    +
    +

    An option serving as a marker for an empty configuration description.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static let noOptions: RuleConfigurationOption
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + hasContent + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var hasContent: Bool { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + markdown() + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func markdown() -> String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + oneLiner() + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func oneLiner() -> String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + yaml() + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func yaml() -> String
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/RuleDescription.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/RuleDescription.html new file mode 100644 index 000000000..888509782 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/RuleDescription.html @@ -0,0 +1,951 @@ + + + + RuleDescription Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

RuleDescription

+
+
+ +
public struct RuleDescription : Equatable, Sendable
+ +
+
+

A detailed description for a SwiftLint rule. Used for both documentation and testing purposes.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + identifier + +
    +
    +
    +
    +
    +
    +

    The rule’s unique identifier, to be used in configuration files and SwiftLint commands. +Should be short and only comprised of lowercase latin alphabet letters and underscores formatted in snake case.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let identifier: String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + name + +
    +
    +
    +
    +
    +
    +

    The rule’s human-readable name. Should be short, descriptive and formatted in Title Case. May contain spaces.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let name: String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + description + +
    +
    +
    +
    +
    +
    +

    The rule’s verbose description. Should read as a sentence or short paragraph. Good things to include are an +explanation of the rule’s purpose and rationale.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let description: String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + kind + +
    +
    +
    +
    +
    +
    +

    The RuleKind that best categorizes this rule.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let kind: RuleKind
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + nonTriggeringExamples + +
    +
    +
    +
    +
    +
    +

    Swift source examples that do not trigger a violation for this rule. Used for documentation purposes to inform +users of various samples of code that are considered valid by this rule. Should be valid Swift syntax but is not +required to compile.

    + +

    These examples are also used for automatic testing purposes. Tests will validate that the rule does not trigger +any violations for these examples.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let nonTriggeringExamples: [Example]
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + triggeringExamples + +
    +
    +
    +
    +
    +
    +

    Swift source examples that do trigger one or more violations for this rule. Used for documentation purposes to +inform users of various samples of code that are considered invalid by this rule. Should be valid Swift syntax +but is not required to compile.

    + +

    Violations should occur where ↓ markers are located.

    + +

    These examples are also used for automatic testing purposes. Tests will validate that the rule triggers +violations for these examples wherever ↓ markers are located.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let triggeringExamples: [Example]
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + corrections + +
    +
    +
    +
    +
    +
    +

    Pairs of Swift source examples, where keys are examples that trigger violations for this rule, and the values +are the expected value after applying corrections with the rule.

    + +

    Rules that aren’t correctable (conforming to the CorrectableRule protocol) should leave property empty.

    + +

    These examples are used for testing purposes if the rule conforms to AutomaticTestableRule. Tests will +validate that the rule corrects all keys to their corresponding values.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let corrections: [Example : Example]
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + deprecatedAliases + +
    +
    +
    +
    +
    +
    +

    Any previous iteration of the rule’s identifier that was previously shipped with SwiftLint.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let deprecatedAliases: Set<String>
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + minSwiftVersion + +
    +
    +
    +
    +
    +
    +

    The oldest version of the Swift compiler supported by this rule.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let minSwiftVersion: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + requiresFileOnDisk + +
    +
    +
    +
    +
    +
    +

    Whether or not this rule can only be executed on a file physically on-disk. Typically necessary for rules +conforming to AnalyzerRule.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let requiresFileOnDisk: Bool
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + consoleDescription + +
    +
    +
    +
    +
    +
    +

    The console-printable string for this description.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var consoleDescription: String { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + allIdentifiers + +
    +
    +
    +
    +
    +
    +

    All identifiers that have been used to uniquely identify this rule in past and current SwiftLint versions.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var allIdentifiers: [String] { get }
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a RuleDescription by specifying all its properties directly.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(identifier: String,
    +            name: String,
    +            description: String,
    +            kind: RuleKind,
    +            minSwiftVersion: SwiftVersion = .five,
    +            nonTriggeringExamples: [Example] = [],
    +            triggeringExamples: [Example] = [],
    +            corrections: [Example: Example] = [:],
    +            deprecatedAliases: Set<String> = [],
    +            requiresFileOnDisk: Bool = false)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + identifier + + +
    +

    Sets the description’s identifier property.

    +
    +
    + + name + + +
    +

    Sets the description’s name property.

    +
    +
    + + description + + +
    +

    Sets the description’s description property.

    +
    +
    + + kind + + +
    +

    Sets the description’s kind property.

    +
    +
    + + minSwiftVersion + + +
    +

    Sets the description’s minSwiftVersion property.

    +
    +
    + + nonTriggeringExamples + + +
    +

    Sets the description’s nonTriggeringExamples property.

    +
    +
    + + triggeringExamples + + +
    +

    Sets the description’s triggeringExamples property.

    +
    +
    + + corrections + + +
    +

    Sets the description’s corrections property.

    +
    +
    + + deprecatedAliases + + +
    +

    Sets the description’s deprecatedAliases property.

    +
    +
    + + requiresFileOnDisk + + +
    +

    Sets the description’s requiresFileOnDisk property.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Equatable +

+
+
+
    +
  • +
    + + + + ==(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func == (lhs: `Self`, rhs: `Self`) -> Bool
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/RuleList.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/RuleList.html new file mode 100644 index 000000000..37b94698a --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/RuleList.html @@ -0,0 +1,533 @@ + + + + RuleList Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

RuleList

+
+
+ +
public struct RuleList
+
extension RuleList: Equatable
+ +
+
+

A list of available SwiftLint rules.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + list + +
    +
    +
    +
    +
    +
    +

    The rules contained in this list.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let list: [String : any Rule.Type]
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Initializers +

+
+
+
    +
  • +
    + + + + init(rules:) + +
    +
    +
    +
    +
    +
    +

    Creates a RuleList by specifying all its rules.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(rules: any Rule.Type...)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + rules + + +
    +

    The rules to be contained in this list.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(rules:) + +
    +
    +
    +
    +
    +
    +

    Creates a RuleList by specifying all its rules.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(rules: [any Rule.Type])
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + rules + + +
    +

    The rules to be contained in this list.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + ==(_:_:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static func == (lhs: RuleList, rhs: RuleList) -> Bool
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/RuleParameter.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/RuleParameter.html new file mode 100644 index 000000000..b8f74441e --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/RuleParameter.html @@ -0,0 +1,483 @@ + + + + RuleParameter Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

RuleParameter

+
+
+ +
public struct RuleParameter<T> : Equatable where T : Equatable
+ +
+
+

A configuration parameter for rules.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + severity + +
    +
    +
    +
    +
    +
    +

    The severity that should be assigned to the violation of this parameter’s value is met.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let severity: ViolationSeverity
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + value + +
    +
    +
    +
    +
    +
    +

    The value to configure the rule.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let value: T
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(severity:value:) + +
    +
    +
    +
    +
    +
    +

    Creates a RuleParameter by specifying its properties directly.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(severity: ViolationSeverity, value: T)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + severity + + +
    +

    The severity that should be assigned to the violation of this parameter’s value is met.

    +
    +
    + + value + + +
    +

    The value to configure the rule.

    +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/SeverityConfiguration.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/SeverityConfiguration.html new file mode 100644 index 000000000..940fc2c3f --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/SeverityConfiguration.html @@ -0,0 +1,573 @@ + + + + SeverityConfiguration Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

SeverityConfiguration

+
+
+ +
public struct SeverityConfiguration<Parent> : SeverityBasedRuleConfiguration, InlinableOptionType, Sendable where Parent : Rule
+ +
+
+

A rule configuration that allows specifying the desired severity level for violations.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + error + +
    +
    +
    +
    +
    +
    +

    Configuration with a warning severity.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static var error: `Self` { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + warning + +
    +
    +
    +
    +
    +
    +

    Configuration with an error severity.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public static var warning: `Self` { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + severityConfiguration + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var severityConfiguration: `Self` { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(_:) + +
    +
    +
    +
    +
    +
    +

    Create a SeverityConfiguration with the specified severity.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(_ severity: ViolationSeverity)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + severity + + +
    +

    The severity that should be used when emitting violations.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + apply(configuration:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public mutating func apply(configuration: Any) throws
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

RuleConfiguration conformances +

+
+
+
    +
  • +
    + + + + asDescription(with:) + +
    +
    +
    +
    +
    +
    +

    Severity configurations are special in that they shall not be nested when an option name is provided. +Instead, their only option value must be used together with the option name.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    func asDescription(with key: String) -> RuleConfigurationDescription
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/SeverityLevelsConfiguration.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/SeverityLevelsConfiguration.html new file mode 100644 index 000000000..fcf59318d --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/SeverityLevelsConfiguration.html @@ -0,0 +1,544 @@ + + + + SeverityLevelsConfiguration Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

SeverityLevelsConfiguration

+
+
+ +
public struct SeverityLevelsConfiguration<Parent> : RuleConfiguration, InlinableOptionType, Sendable where Parent : Rule
+ +
+
+

A rule configuration that allows specifying thresholds for warning and error severities.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + warning + +
    +
    +
    +
    +
    +
    +

    The threshold for a violation to be a warning.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @ConfigurationElement
    +public var warning: Int { get set }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + error + +
    +
    +
    +
    +
    +
    +

    The threshold for a violation to be an error.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @ConfigurationElement
    +public var error: Int? { get set }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(warning:error:) + +
    +
    +
    +
    +
    +
    +

    Create a SeverityLevelsConfiguration based on the specified warning and error thresholds.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(warning: Int, error: Int? = nil)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + +
    + + warning + + +
    +

    The threshold for a violation to be a warning.

    +
    +
    + + error + + +
    +

    The threshold for a violation to be an error.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + params + +
    +
    +
    +
    +
    +
    +

    The rule parameters that define the thresholds that should map to each severity.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var params: [RuleParameter<Int>] { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + apply(configuration:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public mutating func apply(configuration: Any) throws
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Stack.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Stack.html new file mode 100644 index 000000000..5d23682e1 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/Stack.html @@ -0,0 +1,712 @@ + + + + Stack Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

Stack

+
+
+ +
public struct Stack<Element>
+
extension Stack: Sequence
+
extension Stack: CustomDebugStringConvertible where Element: CustomDebugStringConvertible
+ +
+
+

A basic stack type implementing the LIFO principle - only the last inserted element can be accessed and removed.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + init() + +
    +
    +
    +
    +
    +
    +

    Creates an empty Stack.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init()
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + count + +
    +
    +
    +
    +
    +
    +

    The number of elements in this stack.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var count: Int { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + push(_:) + +
    +
    +
    +
    +
    +
    +

    Pushes (appends) an element onto the stack.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public mutating func push(_ element: Element)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + element + + +
    +

    The element to push onto the stack.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + pop() + +
    +
    +
    +
    +
    +
    +

    Removes and returns the last element of the stack.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    @discardableResult
    +public mutating func pop() -> Element?
    + +
    +
    +
    +

    Return Value

    +

    The last element of the stack if the stack is not empty; otherwise, nil.

    +
    + +
    +
    +
  • +
  • +
    + + + + peek() + +
    +
    +
    +
    +
    +
    +

    Returns the last element of the stack if the stack is not empty; otherwise, nil.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func peek() -> Element?
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + contains(where:) + +
    +
    +
    +
    +
    +
    +

    Check whether the sequence contains an element that satisfies the given predicate.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func contains(where predicate: (Element) -> Bool) -> Bool
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + predicate + + +
    +

    A closure that takes an element of the sequence +and returns whether it represents a match.

    +
    +
    +
    +
    +

    Return Value

    +

    true if the sequence contains an element that satisfies predicate.

    +
    + +
    +
    +
  • +
  • +
    + + + + modifyLast(by:) + +
    +
    +
    +
    +
    +
    +

    Modify the last element.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public mutating func modifyLast(by modifier: (inout Element) -> Void)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + modifier + + +
    +

    A function to be applied to the last element to modify the same in place.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + makeIterator() + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func makeIterator() -> [Element].Iterator
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ + +
+ +

Available where Element: CustomDebugStringConvertible +

+
+
+
    +
  • +
    + + + + debugDescription + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var debugDescription: String { get }
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/StyleViolation.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/StyleViolation.html new file mode 100644 index 000000000..9f4c6d0d8 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/StyleViolation.html @@ -0,0 +1,788 @@ + + + + StyleViolation Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

StyleViolation

+
+
+ +
public struct StyleViolation : CustomStringConvertible, Codable, Hashable
+ +
+
+

A value describing an instance of Swift source code that is considered invalid by a SwiftLint rule.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + ruleIdentifier + +
    +
    +
    +
    +
    +
    +

    The identifier of the rule that generated this violation.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let ruleIdentifier: String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + ruleDescription + +
    +
    +
    +
    +
    +
    +

    The description of the rule that generated this violation.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let ruleDescription: String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + ruleName + +
    +
    +
    +
    +
    +
    +

    The name of the rule that generated this violation.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let ruleName: String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + severity + +
    +
    +
    +
    +
    +
    +

    The severity of this violation.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public private(set) var severity: ViolationSeverity { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + location + +
    +
    +
    +
    +
    +
    +

    The location of this violation.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public private(set) var location: Location { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + reason + +
    +
    +
    +
    +
    +
    +

    The justification for this violation.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let reason: String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + description + +
    +
    +
    +
    +
    +
    +

    A printable description for this violation.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var description: String { get }
    + +
    +
    + +
    +
    +
  • +
  • + +
    +
    +
    +
    +
    +

    Creates a StyleViolation by specifying its properties directly.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(ruleDescription: RuleDescription,
    +            severity: ViolationSeverity = .warning,
    +            location: Location,
    +            reason: String? = nil)
    + +
    +
    +
    +

    Parameters

    + + + + + + + + + + + + + + + + + + + +
    + + ruleDescription + + +
    +

    The description of the rule that generated this violation.

    +
    +
    + + severity + + +
    +

    The severity of this violation.

    +
    +
    + + location + + +
    +

    The location of this violation.

    +
    +
    + + reason + + +
    +

    The justification for this violation. If not specified the rule’s description will + be used.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + with(severity:) + +
    +
    +
    +
    +
    +
    +

    Returns the same violation, but with the severity that is passed in

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func with(severity: ViolationSeverity) -> StyleViolation
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + severity + + +
    +

    the new severity to use in the modified violation

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + with(location:) + +
    +
    +
    +
    +
    +
    +

    Returns the same violation, but with the location that is passed in

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func with(location: Location) -> StyleViolation
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + location + + +
    +

    the new location to use in the modified violation

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + hash(into:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func hash(into hasher: inout Hasher)
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/SwiftLintSyntaxMap.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/SwiftLintSyntaxMap.html new file mode 100644 index 000000000..dc76ba187 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/SwiftLintSyntaxMap.html @@ -0,0 +1,577 @@ + + + + SwiftLintSyntaxMap Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

SwiftLintSyntaxMap

+
+
+ +
public struct SwiftLintSyntaxMap
+ +
+
+

Represents a Swift file’s syntax information.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + value + +
    +
    +
    +
    +
    +
    +

    The raw SyntaxMap obtained by SourceKitten.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let value: SyntaxMap
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + tokens + +
    +
    +
    +
    +
    +
    +

    The SwiftLint-specific syntax tokens for this syntax map.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let tokens: [SwiftLintSyntaxToken]
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(value:) + +
    +
    +
    +
    +
    +
    +

    Creates a SwiftLintSyntaxMap from the raw SyntaxMap obtained by SourceKitten.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(value: SyntaxMap)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + value + + +
    +

    The raw SyntaxMap obtained by SourceKitten.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + tokens(inByteRange:) + +
    +
    +
    +
    +
    +
    +

    Returns array of syntax tokens intersecting with byte range.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func tokens(inByteRange byteRange: ByteRange) -> [SwiftLintSyntaxToken]
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + byteRange + + +
    +

    Byte-based NSRange.

    +
    +
    +
    +
    +

    Return Value

    +

    The array of syntax tokens intersecting with byte range.

    +
    + +
    +
    +
  • +
  • +
    + + + + kinds(inByteRange:) + +
    +
    +
    +
    +
    +
    +

    Returns the syntax kinds in the specified byte range.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public func kinds(inByteRange byteRange: ByteRange) -> [SyntaxKind]
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + byteRange + + +
    +

    Byte range.

    +
    +
    +
    +
    +

    Return Value

    +

    The syntax kinds in the specified byte range.

    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/SwiftLintSyntaxToken.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/SwiftLintSyntaxToken.html new file mode 100644 index 000000000..683499cab --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/SwiftLintSyntaxToken.html @@ -0,0 +1,561 @@ + + + + SwiftLintSyntaxToken Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

SwiftLintSyntaxToken

+
+
+ +
public struct SwiftLintSyntaxToken
+ +
+
+

A SwiftLint-aware Swift syntax token.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + value + +
    +
    +
    +
    +
    +
    +

    The raw SyntaxToken obtained by SourceKitten.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let value: SyntaxToken
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + kind + +
    +
    +
    +
    +
    +
    +

    The syntax kind associated with is token.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let kind: SyntaxKind?
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(value:) + +
    +
    +
    +
    +
    +
    +

    Creates a SwiftLintSyntaxToken from the raw SyntaxToken obtained by SourceKitten.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(value: SyntaxToken)
    + +
    +
    +
    +

    Parameters

    + + + + + + + +
    + + value + + +
    +

    The raw SyntaxToken obtained by SourceKitten.

    +
    +
    +
    + +
    +
    +
  • +
  • +
    + + + + range + +
    +
    +
    +
    +
    +
    +

    The byte range in a source file for this token.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var range: ByteRange { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + offset + +
    +
    +
    +
    +
    +
    +

    The starting byte offset in a source file for this token.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var offset: ByteCount { get }
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + length + +
    +
    +
    +
    +
    +
    +

    The length in bytes for this token.

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public var length: ByteCount { get }
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/SwiftVersion.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/SwiftVersion.html new file mode 100644 index 000000000..05dce299e --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/Structs/SwiftVersion.html @@ -0,0 +1,814 @@ + + + + SwiftVersion Structure Reference + + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+

SwiftVersion

+
+
+ +
public struct SwiftVersion : RawRepresentable, Codable, VersionComparable, Sendable
+ +
+
+

A value describing the version of the Swift compiler.

+ + +
+
+ +
+
+
+
    +
  • +
    + + + + RawValue + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public typealias RawValue = String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + rawValue + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public let rawValue: String
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + init(rawValue:) + +
    +
    +
    +
    +
    +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public init(rawValue: String)
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + five + +
    +
    +
    +
    +
    +
    +

    Swift 5

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let five: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + fiveDotOne + +
    +
    +
    +
    +
    +
    +

    Swift 5.1

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let fiveDotOne: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + fiveDotTwo + +
    +
    +
    +
    +
    +
    +

    Swift 5.2

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let fiveDotTwo: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + fiveDotThree + +
    +
    +
    +
    +
    +
    +

    Swift 5.3

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let fiveDotThree: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + fiveDotFour + +
    +
    +
    +
    +
    +
    +

    Swift 5.4

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let fiveDotFour: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + fiveDotFive + +
    +
    +
    +
    +
    +
    +

    Swift 5.5

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let fiveDotFive: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + fiveDotSix + +
    +
    +
    +
    +
    +
    +

    Swift 5.6

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let fiveDotSix: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + fiveDotSeven + +
    +
    +
    +
    +
    +
    +

    Swift 5.7

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let fiveDotSeven: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + fiveDotEight + +
    +
    +
    +
    +
    +
    +

    Swift 5.8

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let fiveDotEight: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + fiveDotNine + +
    +
    +
    +
    +
    +
    +

    Swift 5.9

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let fiveDotNine: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + six + +
    +
    +
    +
    +
    +
    +

    Swift 6

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let six: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
  • +
    + + + + current + +
    +
    +
    +
    +
    +
    +

    The current detected Swift compiler version, based on the currently accessible SourceKit version.

    +
    +

    Note

    + Override by setting the SWIFTLINT_SWIFT_VERSION environment variable. + +
    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    static let current: SwiftVersion
    + +
    +
    + +
    +
    +
  • +
+
+
+
+ +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/accessibility_label_for_image.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/accessibility_label_for_image.html new file mode 100644 index 000000000..bbcffb8f8 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/accessibility_label_for_image.html @@ -0,0 +1,608 @@ + + + + accessibility_label_for_image Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Accessibility Label for Image

+ +

Images that provide context should have an accessibility label or should be explicitly hidden from accessibility

+ +
    +
  • Identifier: accessibility_label_for_image
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.1.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
struct MyView: View {
+    var body: some View {
+        Image(decorative: "my-image")
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Image("my-image", label: Text("Alt text for my image"))
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Image("my-image")
+            .accessibility(hidden: true)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Image("my-image")
+            .accessibilityHidden(true)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Image("my-image")
+            .accessibility(label: Text("Alt text for my image"))
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Image("my-image")
+            .accessibilityLabel(Text("Alt text for my image"))
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Image(uiImage: myUiImage)
+            .renderingMode(.template)
+            .foregroundColor(.blue)
+            .accessibilityHidden(true)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Image(uiImage: myUiImage)
+            .accessibilityLabel(Text("Alt text for my image"))
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        SwiftUI.Image(uiImage: "my-image").resizable().accessibilityHidden(true)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        VStack {
+            Image(decorative: "my-image")
+                .renderingMode(.template)
+                .foregroundColor(.blue)
+            Image("my-image")
+                .accessibility(label: Text("Alt text for my image"))
+        }
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        VStack {
+            Image("my-image")
+                .renderingMode(.template)
+                .foregroundColor(.blue)
+            Image("my-image")
+                .accessibility(label: Text("Alt text for my image"))
+        }.accessibilityElement()
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        VStack {
+            Image("my-image")
+                .renderingMode(.template)
+                .foregroundColor(.blue)
+            Image("my-image")
+                .accessibility(label: Text("Alt text for my image"))
+        }.accessibilityHidden(true)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        HStack(spacing: 8) {
+            Image(decorative: "my-image")
+                .renderingMode(.template)
+                .foregroundColor(.blue)
+            Text("Text to accompany my image")
+        }.accessibilityElement(children: .combine)
+        .padding(16)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        HStack(spacing: 8) {
+            Image("my-image")
+                .renderingMode(.template)
+                .foregroundColor(.blue)
+            Text("Text to accompany my image")
+        }.accessibilityElement(children: .ignore)
+        .padding(16)
+        .accessibilityLabel(Text("Label for my image and text"))
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Button(action: { doAction() }) {
+            Image("my-image")
+                .renderingMode(.template)
+                .foregroundColor(.blue)
+        }
+        .accessibilityLabel(Text("Label for my image"))
+    }
+}
+
+

Triggering Examples

+
struct MyView: View {
+    var body: some View {
+        ↓Image("my-image")
+            .resizable(true)
+            .frame(width: 48, height: 48)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        ↓Image(uiImage: myUiImage)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        ↓SwiftUI.Image(uiImage: "my-image").resizable().accessibilityHidden(false)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Image(uiImage: myUiImage)
+            .resizable()
+            .frame(width: 48, height: 48)
+            .accessibilityLabel(Text("Alt text for my image"))
+        ↓Image("other image")
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Image(decorative: "image1")
+        ↓Image("image2")
+        Image(uiImage: "image3")
+            .accessibility(label: Text("a pretty picture"))
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        VStack {
+            Image(decorative: "my-image")
+                .renderingMode(.template)
+                .foregroundColor(.blue)
+            ↓Image("my-image")
+        }
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        VStack {
+            ↓Image("my-image")
+                .renderingMode(.template)
+                .foregroundColor(.blue)
+            Image("my-image")
+                .accessibility(label: Text("Alt text for my image"))
+        }.accessibilityElement(children: .contain)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        VStack {
+            ↓Image("my-image")
+                .renderingMode(.template)
+                .foregroundColor(.blue)
+            Image("my-image")
+                .accessibility(label: Text("Alt text for my image"))
+        }.accessibilityHidden(false)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        HStack(spacing: 8) {
+            ↓Image("my-image")
+                .renderingMode(.template)
+                .foregroundColor(.blue)
+            Text("Text to accompany my image")
+        }.accessibilityElement(children: .combine)
+        .padding(16)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Button(action: { doAction() }) {
+            ↓Image("my-image")
+                .renderingMode(.template)
+                .foregroundColor(.blue)
+        }
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        ↓Image(systemName: "circle.plus")
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/accessibility_trait_for_button.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/accessibility_trait_for_button.html new file mode 100644 index 000000000..72861dd35 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/accessibility_trait_for_button.html @@ -0,0 +1,611 @@ + + + + accessibility_trait_for_button Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Accessibility Trait for Button

+ +

All views with tap gestures added should include the .isButton or the .isLink accessibility traits

+ +
    +
  • Identifier: accessibility_trait_for_button
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.1.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
struct MyView: View {
+    var body: some View {
+        Button {
+            print("tapped")
+        } label: {
+            Text("Learn more")
+        }
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Link("Open link", destination: myUrl)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Text("Learn more")
+            .onTapGesture {
+                print("tapped - open URL")
+            }
+            .accessibility(addTraits: .isLink)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Text("Learn more")
+            .accessibilityAddTraits(.isButton)
+            .onTapGesture {
+                print("tapped")
+            }
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Text("Learn more")
+            .accessibility(addTraits: [.isButton, .isHeader])
+            .onTapGesture {
+                print("tapped")
+            }
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Text("Learn more")
+            .onTapGesture {
+                print("tapped - open URL")
+            }
+            .accessibilityAddTraits([.isHeader, .isLink])
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Text("Learn more")
+            .onTapGesture(count: 1) {
+                print("tapped")
+            }
+            .accessibility(addTraits: .isButton)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Text("Learn more")
+            .onTapGesture(count: 1, perform: {
+                print("tapped")
+            })
+            .accessibility(addTraits: .isButton)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Text("Learn more")
+            // This rule does not include tap gestures with multiple taps for now.
+            // Custom gestures like this are also not very accessible, but require
+            // alternative ways to accomplish the same task with assistive tech.
+            .onTapGesture(count: 2) {
+                print("double-tapped")
+            }
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Label("Learn more", systemImage: "info.circle")
+            .onTapGesture(count: 1) {
+                print("tapped")
+            }
+            .accessibility(addTraits: .isButton)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        HStack {
+            Image(systemName: "info.circle")
+            Text("Learn more")
+        }
+        .onTapGesture {
+            print("tapped")
+        }
+        // This modifier is not strictly required — each subview will inherit the button trait.
+        // That said, grouping a tappable stack into a single element is a good way to reduce
+        // the number of swipes required for a VoiceOver user to navigate the page.
+        .accessibilityElement(children: .combine)
+        .accessibility(addTraits: .isButton)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Text("Learn more")
+            .gesture(TapGesture().onEnded {
+                print("tapped")
+            })
+            .accessibilityAddTraits(.isButton)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Text("Learn more")
+            .simultaneousGesture(TapGesture(count: 1).onEnded {
+                print("tapped - open URL")
+            })
+            .accessibilityAddTraits(.isLink)
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Text("Learn more")
+            .highPriorityGesture(TapGesture().onEnded {
+                print("tapped")
+            })
+            .accessibility(addTraits: [.isButton])
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        Text("Learn more")
+            .gesture(TapGesture(count: 2).onEnded {
+                print("tapped")
+            })
+    }
+}
+
+

Triggering Examples

+
struct MyView: View {
+    var body: some View {
+        ↓Text("Learn more")
+            .onTapGesture {
+                print("tapped")
+            }
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        ↓Text("Learn more")
+            .accessibility(addTraits: .isHeader)
+            .onTapGesture {
+                print("tapped")
+            }
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        ↓Text("Learn more")
+            .onTapGesture(count: 1) {
+                print("tapped")
+            }
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        ↓Text("Learn more")
+            .onTapGesture(count: 1, perform: {
+                print("tapped")
+            })
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        ↓Label("Learn more", systemImage: "info.circle")
+            .onTapGesture(count: 1) {
+                print("tapped")
+            }
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        ↓HStack {
+            Image(systemName: "info.circle")
+            Text("Learn more")
+        }
+        .onTapGesture {
+            print("tapped")
+        }
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        ↓Text("Learn more")
+            .gesture(TapGesture().onEnded {
+                print("tapped")
+            })
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        ↓Text("Learn more")
+            .simultaneousGesture(TapGesture(count: 1).onEnded {
+                print("tapped")
+            })
+    }
+}
+
+
struct MyView: View {
+    var body: some View {
+        ↓Text("Learn more")
+            .highPriorityGesture(TapGesture().onEnded {
+                print("tapped")
+            })
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/anonymous_argument_in_multiline_closure.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/anonymous_argument_in_multiline_closure.html new file mode 100644 index 000000000..314e3addb --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/anonymous_argument_in_multiline_closure.html @@ -0,0 +1,388 @@ + + + + anonymous_argument_in_multiline_closure Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Anonymous Argument in Multiline Closure

+ +

Use named arguments in multiline closures

+ +
    +
  • Identifier: anonymous_argument_in_multiline_closure
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
closure { $0 }
+
+
closure { print($0) }
+
+
closure { arg in
+    print(arg)
+}
+
+
closure { arg in
+    nestedClosure { $0 + arg }
+}
+
+

Triggering Examples

+
closure {
+    print(↓$0)
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/array_init.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/array_init.html new file mode 100644 index 000000000..a5f04c710 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/array_init.html @@ -0,0 +1,418 @@ + + + + array_init Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Array Init

+ +

Prefer using Array(seq) over seq.map { $0 } to convert a sequence into an Array

+ +
    +
  • Identifier: array_init
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
Array(foo)
+
+
foo.map { $0.0 }
+
+
foo.map { $1 }
+
+
foo.map { $0() }
+
+
foo.map { ((), $0) }
+
+
foo.map { $0! }
+
+
foo.map { $0! /* force unwrap */ }
+
+
foo.something { RouteMapper.map($0) }
+
+
foo.map { !$0 }
+
+
foo.map { /* a comment */ !$0 }
+
+

Triggering Examples

+
foo.↓map({ $0 })
+
+
foo.↓map { $0 }
+
+
foo.↓map { return $0 }
+
+
foo.↓map { elem in
+    elem
+}
+
+
foo.↓map { elem in
+    return elem
+}
+
+
foo.↓map { (elem: String) in
+    elem
+}
+
+
foo.↓map { elem -> String in
+    elem
+}
+
+
foo.↓map { $0 /* a comment */ }
+
+
foo.↓map { /* a comment */ $0 }
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/async_without_await.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/async_without_await.html new file mode 100644 index 000000000..e38abc133 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/async_without_await.html @@ -0,0 +1,574 @@ + + + + async_without_await Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Async Without Await

+ +

Declaration should not be async if it doesn’t use await

+ +
    +
  • Identifier: async_without_await
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func test() {
+    func test() async {
+        await test()
+    }
+},
+
+
func test() {
+    func test() async {
+        await test().value
+    }
+},
+
+
func test() async {
+    await scheduler.task { foo { bar() } }
+}
+
+
func test() async {
+    perform(await try foo().value)
+}
+
+
func test() async {
+    perform(try await foo())
+}
+
+
func test() async {
+    await perform()
+    func baz() {
+        qux()
+    }
+}
+
+
let x: () async -> Void = {
+    await test()
+}
+
+
let x: () async -> Void = {
+    await { await test() }()
+}
+
+
func test() async {
+    await foo()
+}
+let x = { bar() }
+
+
let x: (() async -> Void)? = {
+    await { await test() }()
+}
+
+
let x: (() async -> Void)? = nil
+let x: () -> Void = { test() }
+
+
var test: Int {
+    get async throws {
+        try await foo()
+    }
+}
+var foo: Int {
+    get throws {
+        try bar()
+    }
+}
+
+
init() async {
+    await foo()
+}
+
+
init() async {
+    func test() async {
+        await foo()
+    }
+    await { await foo() }()
+}
+
+
subscript(row: Int) -> Double {
+    get async {
+        await foo()
+    }
+}
+
+
func foo() async -> Int
+func bar() async -> Int
+
+
var foo: Int { get async }
+var bar: Int { get async }
+
+
init(foo: bar) async
+init(baz: qux) async
+let baz = { qux() }
+
+
typealias Foo = () async -> Void
+typealias Bar = () async -> Void
+let baz = { qux() }
+
+
func test() async {
+    for await foo in bar {}
+}
+
+
func test() async {
+    while let foo = await bar() {}
+}
+
+
func test() async {
+    async let foo = bar()
+    let baz = await foo
+}
+
+
func test() async {
+    async let foo = bar()
+    await foo
+}
+
+
func test() async {
+    async let foo = bar()
+}
+
+
func foo(bar: () async -> Void) { { } }
+
+
func foo(bar: () async -> Void = { await baz() }) { {} }
+
+
func foo() -> (() async -> Void)? { {} }
+
+
func foo(
+    bar: () async -> Void,
+    baz: () -> Void = {}
+) { { } }
+
+
func foo(bar: () async -> Void = {}) { }
+
+

Triggering Examples

+
func test() ↓async {
+    perform()
+}
+
+
func test() {
+    func baz() ↓async {
+        qux()
+    }
+    perform()
+    func baz() {
+        qux()
+    }
+}
+
+
func test() ↓async {
+    func baz() async {
+        await qux()
+    }
+}
+
+
func test() ↓async {
+  func foo() ↓async {}
+  let bar = { await foo() }
+}
+
+
func test() ↓async {
+    let bar = {
+        func foo() ↓async {}
+    }
+}
+
+
let x: (() ↓async -> Void)? = { test() }
+
+
var test: Int {
+    get ↓async throws {
+        foo()
+    }
+}
+
+
var test: Int {
+    get ↓async throws {
+        func foo() ↓async {}
+        let bar = { await foo() }
+    }
+}
+
+
var test: Int {
+    get throws {
+        func foo() {}
+        let bar: () ↓async -> Void = { foo() }
+    }
+}
+
+
init() ↓async {}
+
+
init() ↓async {
+    func foo() ↓async {}
+    let bar: () ↓async -> Void = { foo() }
+}
+
+
subscript(row: Int) -> Double {
+    get ↓async {
+        1.0
+    }
+}
+
+
func test() ↓async {
+    for foo in bar {}
+}
+
+
func test() ↓async {
+    while let foo = bar() {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/attribute_name_spacing.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/attribute_name_spacing.html new file mode 100644 index 000000000..10c17d109 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/attribute_name_spacing.html @@ -0,0 +1,426 @@ + + + + attribute_name_spacing Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Attribute Name Spacing

+ +

This rule prevents trailing spaces after attribute names, ensuring compatibility with Swift 6 where a space between an attribute name and the opening parenthesis results in a compilation error (e.g. @MyPropertyWrapper (), private (set)).

+ +
    +
  • Identifier: attribute_name_spacing
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +error +
  • +
+

Non Triggering Examples

+
private(set) var foo: Bool = false
+
+
fileprivate(set) var foo: Bool = false
+
+
@MainActor class Foo {}
+
+
func funcWithEscapingClosure(_ x: @escaping () -> Int) {}
+
+
@available(*, deprecated)
+
+
@MyPropertyWrapper(param: 2) 
+
+
nonisolated(unsafe) var _value: X?
+
+
@testable import SwiftLintCore
+
+
func func_type_attribute_with_space(x: @convention(c) () -> Int) {}
+
+
@propertyWrapper
+struct MyPropertyWrapper {
+    var wrappedValue: Int = 1
+
+    init(param: Int) {}
+}
+
+
let closure2 = { @MainActor
+  (a: Int, b: Int) in
+}
+
+

Triggering Examples

+
private ↓(set) var foo: Bool = false
+
+
fileprivate ↓(set) var foo: Bool = false
+
+
public ↓(set) var foo: Bool = false
+
+
  public  ↓(set) var foo: Bool = false
+
+
@ ↓MainActor class Foo {}
+
+
func funcWithEscapingClosure(_ x: @ ↓escaping () -> Int) {}
+
+
func funcWithEscapingClosure(_ x: @escaping↓() -> Int) {}
+
+
@available ↓(*, deprecated)
+
+
@MyPropertyWrapper ↓(param: 2) 
+
+
nonisolated ↓(unsafe) var _value: X?
+
+
@MyProperty ↓() class Foo {}
+
+
let closure1 = { @MainActor ↓(a, b) in
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/attributes.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/attributes.html new file mode 100644 index 000000000..0ae65bd2f --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/attributes.html @@ -0,0 +1,627 @@ + + + + attributes Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Attributes

+ +

Attributes should be on their own lines in functions and types, but on the same line as variables and imports

+ +
    +
  • Identifier: attributes
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +attributes_with_arguments_always_on_line_above + +true +
    +always_on_same_line + +[“@IBAction”, “@NSManaged”] +
    +always_on_line_above + +[] +
  • +
+

Non Triggering Examples

+
@objc var x: String
+
+
@objc private var x: String
+
+
@nonobjc var x: String
+
+
@IBOutlet private var label: UILabel
+
+
@IBOutlet @objc private var label: UILabel
+
+
@NSCopying var name: NSString
+
+
@NSManaged var name: String?
+
+
@IBInspectable var cornerRadius: CGFloat
+
+
@available(iOS 9.0, *)
+ let stackView: UIStackView
+
+
@NSManaged func addSomeObject(book: SomeObject)
+
+
@IBAction func buttonPressed(button: UIButton)
+
+
@objc
+ @IBAction func buttonPressed(button: UIButton)
+
+
@available(iOS 9.0, *)
+ func animate(view: UIStackView)
+
+
@available(*, deprecated, message: "A message")
+ func animate(view: UIStackView)
+
+
@nonobjc
+ final class X {}
+
+
@available(iOS 9.0, *)
+ class UIStackView {}
+
+
@NSApplicationMain
+ class AppDelegate: NSObject, NSApplicationDelegate {}
+
+
@UIApplicationMain
+ class AppDelegate: NSObject, UIApplicationDelegate {}
+
+
@IBDesignable
+ class MyCustomView: UIView {}
+
+
@testable import SourceKittenFramework
+
+
@objc(foo_x)
+ var x: String
+
+
@available(iOS 9.0, *)
+@objc(abc_stackView)
+ let stackView: UIStackView
+
+
@objc(abc_addSomeObject:)
+ @NSManaged func addSomeObject(book: SomeObject)
+
+
@objc(ABCThing)
+ @available(iOS 9.0, *)
+ class Thing {}
+
+
class Foo: NSObject {
+ override var description: String { return "" }
+}
+
+
class Foo: NSObject {
+
+ override func setUp() {}
+}
+
+
@objc
+class ⽺ {}
+
+
extension Property {
+
+    @available(*, unavailable, renamed: "isOptional")
+    public var optional: Bool { fatalError() }
+}
+
+
@GKInspectable var maxSpeed: Float
+
+
@discardableResult
+ func a() -> Int
+
+
@objc
+ @discardableResult
+ func a() -> Int
+
+
func increase(f: @autoclosure () -> Int) -> Int
+
+
func foo(completionHandler: @escaping () -> Void)
+
+
private struct DefaultError: Error {}
+
+
@testable import foo
+
+private let bar = 1
+
+
import XCTest
+@testable import DeleteMe
+
+@available (iOS 11.0, *)
+class DeleteMeTests: XCTestCase {
+}
+
+
@objc
+internal func foo(identifier: String, completion: @escaping (() -> Void)) {}
+
+
@objc
+internal func foo(identifier: String, completion: @autoclosure (() -> Bool)) {}
+
+
func printBoolOrTrue(_ expression: @autoclosure () throws -> Bool?) rethrows {
+  try print(expression() ?? true)
+}
+
+
import Foundation
+
+class MyClass: NSObject {
+  @objc(
+    first:
+  )
+  static func foo(first: String) {}
+}
+
+
func refreshable(action: @escaping @Sendable () async -> Void) -> some View {
+    modifier(RefreshableModifier(action: action))
+}
+
+
import AppKit
+
+@NSApplicationMain
+@MainActor
+final class AppDelegate: NSAppDelegate {}
+
+

Triggering Examples

+
@objc
+ ↓var x: String
+
+
@objc
+
+ ↓var x: String
+
+
@objc
+ private ↓var x: String
+
+
@nonobjc
+ ↓var x: String
+
+
@IBOutlet
+ private ↓var label: UILabel
+
+
@IBOutlet
+
+ private ↓var label: UILabel
+
+
@NSCopying
+ ↓var name: NSString
+
+
@NSManaged
+ ↓var name: String?
+
+
@IBInspectable
+ ↓var cornerRadius: CGFloat
+
+
@available(iOS 9.0, *) ↓let stackView: UIStackView
+
+
@NSManaged
+ ↓func addSomeObject(book: SomeObject)
+
+
@IBAction
+ ↓func buttonPressed(button: UIButton)
+
+
@IBAction
+ @objc
+ ↓func buttonPressed(button: UIButton)
+
+
@available(iOS 9.0, *) ↓func animate(view: UIStackView)
+
+
@nonobjc final ↓class X {}
+
+
@available(iOS 9.0, *) ↓class UIStackView {}
+
+
@available(iOS 9.0, *)
+ @objc ↓class UIStackView {}
+
+
@available(iOS 9.0, *) @objc
+ ↓class UIStackView {}
+
+
@available(iOS 9.0, *)
+
+ ↓class UIStackView {}
+
+
@UIApplicationMain ↓class AppDelegate: NSObject, UIApplicationDelegate {}
+
+
@IBDesignable ↓class MyCustomView: UIView {}
+
+
@testable
+↓import SourceKittenFramework
+
+
@testable
+
+
+↓import SourceKittenFramework
+
+
@available(iOS 9.0, *) @objc(abc_stackView)
+ ↓let stackView: UIStackView
+
+
@objc(abc_addSomeObject:) @NSManaged
+ ↓func addSomeObject(book: SomeObject)
+
+
@objc(abc_addSomeObject:)
+ @NSManaged
+ ↓func addSomeObject(book: SomeObject)
+
+
@available(iOS 9.0, *)
+ @objc(ABCThing) ↓class Thing {}
+
+
@GKInspectable
+ ↓var maxSpeed: Float
+
+
@discardableResult ↓func a() -> Int
+
+
@objc
+ @discardableResult ↓func a() -> Int
+
+
@objc
+
+ @discardableResult
+ ↓func a() -> Int
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/balanced_xctest_lifecycle.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/balanced_xctest_lifecycle.html new file mode 100644 index 000000000..9c53ce3e2 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/balanced_xctest_lifecycle.html @@ -0,0 +1,456 @@ + + + + balanced_xctest_lifecycle Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Balanced XCTest Life Cycle

+ +

Test classes must implement balanced setUp and tearDown methods

+ +
    +
  • Identifier: balanced_xctest_lifecycle
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +test_parent_classes + +[“QuickSpec”, “XCTestCase”] +
  • +
+

Non Triggering Examples

+
final class FooTests: XCTestCase {
+    override func setUp() {}
+    override func tearDown() {}
+}
+
+
final class FooTests: XCTestCase {
+    override func setUpWithError() throws {}
+    override func tearDown() {}
+}
+
+
final class FooTests: XCTestCase {
+    override func setUp() {}
+    override func tearDownWithError() throws {}
+}
+
+
final class FooTests: XCTestCase {
+    override func setUpWithError() throws {}
+    override func tearDownWithError() throws {}
+}
+final class BarTests: XCTestCase {
+    override func setUpWithError() throws {}
+    override func tearDownWithError() throws {}
+}
+
+
struct FooTests {
+    override func setUp() {}
+}
+class BarTests {
+    override func setUpWithError() throws {}
+}
+
+
final class FooTests: XCTestCase {
+    override func setUpAlLExamples() {}
+}
+
+
final class FooTests: XCTestCase {
+    class func setUp() {}
+    class func tearDown() {}
+}
+
+

Triggering Examples

+
final class ↓FooTests: XCTestCase {
+    override func setUp() {}
+}
+
+
final class ↓FooTests: XCTestCase {
+    override func setUpWithError() throws {}
+}
+
+
final class FooTests: XCTestCase {
+    override func setUp() {}
+    override func tearDownWithError() throws {}
+}
+final class ↓BarTests: XCTestCase {
+    override func setUpWithError() throws {}
+}
+
+
final class ↓FooTests: XCTestCase {
+    class func tearDown() {}
+}
+
+
final class ↓FooTests: XCTestCase {
+    override func tearDown() {}
+}
+
+
final class ↓FooTests: XCTestCase {
+    override func tearDownWithError() throws {}
+}
+
+
final class FooTests: XCTestCase {
+    override func setUp() {}
+    override func tearDownWithError() throws {}
+}
+final class ↓BarTests: XCTestCase {
+    override func tearDownWithError() throws {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/blanket_disable_command.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/blanket_disable_command.html new file mode 100644 index 000000000..a1b5fc4bb --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/blanket_disable_command.html @@ -0,0 +1,412 @@ + + + + blanket_disable_command Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Blanket Disable Command

+ +

swiftlint:disable commands should use next, this or previous to disable rules for a single line, or swiftlint:enable to re-enable the rules immediately after the violations to be ignored, instead of disabling the rule for the rest of the file.

+ +
    +
  • Identifier: blanket_disable_command
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +allowed_rules + +[“file_header”, “file_length”, “file_name”, “file_name_no_space”, “single_test_class”] +
    +always_blanket_disable + +[] +
  • +
+

Non Triggering Examples

+
// swiftlint:disable unused_import
+// swiftlint:enable unused_import
+
+
// swiftlint:disable unused_import unused_declaration
+// swiftlint:enable unused_import
+// swiftlint:enable unused_declaration
+
+
// swiftlint:disable:this unused_import
+
+
// swiftlint:disable:next unused_import
+
+
// swiftlint:disable:previous unused_import
+
+

Triggering Examples

+
// swiftlint:disable ↓unused_import
+
+
// swiftlint:disable unused_import ↓unused_declaration
+// swiftlint:enable unused_import
+
+
// swiftlint:disable unused_import
+// swiftlint:disable ↓unused_import
+// swiftlint:enable unused_import
+
+
// swiftlint:enable ↓unused_import
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/block_based_kvo.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/block_based_kvo.html new file mode 100644 index 000000000..ad09c15c3 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/block_based_kvo.html @@ -0,0 +1,388 @@ + + + + block_based_kvo Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Block Based KVO

+ +

Prefer the new block based KVO API with keypaths when using Swift 3.2 or later

+ +
    +
  • Identifier: block_based_kvo
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let observer = foo.observe(\.value, options: [.new]) { (foo, change) in
+   print(change.newValue)
+}
+
+

Triggering Examples

+
class Foo: NSObject {
+  override ↓func observeValue(forKeyPath keyPath: String?, of object: Any?,
+                              change: [NSKeyValueChangeKey : Any]?,
+                              context: UnsafeMutableRawPointer?) {}
+}
+
+
class Foo: NSObject {
+  override ↓func observeValue(forKeyPath keyPath: String?, of object: Any?,
+                              change: Dictionary<NSKeyValueChangeKey, Any>?,
+                              context: UnsafeMutableRawPointer?) {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/capture_variable.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/capture_variable.html new file mode 100644 index 000000000..4a1d01973 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/capture_variable.html @@ -0,0 +1,493 @@ + + + + capture_variable Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Capture Variable

+ +

Non-constant variables should not be listed in a closure’s capture list to avoid confusion about closures capturing variables at creation time

+ +
    +
  • Identifier: capture_variable
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: Yes
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class C {
+    let i: Int
+    init(_ i: Int) { self.i = i }
+}
+
+let j: Int = 0
+let c = C(1)
+
+let closure: () -> Void = { [j, c] in
+    print(c.i, j)
+}
+
+closure()
+
+
let iGlobal: Int = 0
+
+class C {
+    class var iClass: Int { 0 }
+    static let iStatic: Int = 0
+    let iInstance: Int = 0
+
+    func callTest() {
+        var iLocal: Int = 0
+        test { [unowned self, iGlobal, iInstance, iLocal, iClass=C.iClass, iStatic=C.iStatic] j in
+            print(iGlobal, iClass, iStatic, iInstance, iLocal, j)
+        }
+    }
+
+    func test(_ completionHandler: @escaping (Int) -> Void) {
+    }
+}
+
+
var j: Int!
+j = 0
+
+let closure: () -> Void = { [j] in
+    print(j)
+}
+
+closure()
+j = 1
+closure()
+
+
lazy var j: Int = { 0 }()
+
+let closure: () -> Void = { [j] in
+    print(j)
+}
+
+closure()
+j = 1
+closure()
+
+

Triggering Examples

+
var j: Int = 0
+
+let closure: () -> Void = { [j] in
+    print(j)
+}
+
+closure()
+j = 1
+closure()
+
+
class C {
+    let i: Int
+    init(_ i: Int) { self.i = i }
+}
+
+var c = C(0)
+let closure: () -> Void = { [c] in
+    print(c.i)
+}
+
+closure()
+c = C(1)
+closure()
+
+
var iGlobal: Int = 0
+
+class C {
+    func callTest() {
+        test { [iGlobal] j in
+            print(iGlobal, j)
+        }
+    }
+
+    func test(_ completionHandler: @escaping (Int) -> Void) {
+    }
+}
+
+
class C {
+    static var iStatic: Int = 0
+
+    static func callTest() {
+        test { [↓iStatic] j in
+            print(iStatic, j)
+        }
+    }
+
+    static func test(_ completionHandler: @escaping (Int) -> Void) {
+        completionHandler(2)
+        C.iStatic = 1
+        completionHandler(3)
+    }
+}
+
+C.callTest()
+
+
class C {
+    var iInstance: Int = 0
+
+    func callTest() {
+        test { [iInstance] j in
+            print(iInstance, j)
+        }
+    }
+
+    func test(_ completionHandler: @escaping (Int) -> Void) {
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/class_delegate_protocol.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/class_delegate_protocol.html new file mode 100644 index 000000000..cf117145b --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/class_delegate_protocol.html @@ -0,0 +1,403 @@ + + + + class_delegate_protocol Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Class Delegate Protocol

+ +

Delegate protocols should be class-only so they can be weakly referenced

+ +
    +
  • Identifier: class_delegate_protocol
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
protocol FooDelegate: class {}
+
+
protocol FooDelegate: class, BarDelegate {}
+
+
protocol Foo {}
+
+
class FooDelegate {}
+
+
@objc protocol FooDelegate {}
+
+
@objc(MyFooDelegate)
+ protocol FooDelegate {}
+
+
protocol FooDelegate: BarDelegate {}
+
+
protocol FooDelegate: AnyObject {}
+
+
protocol FooDelegate: NSObjectProtocol {}
+
+
protocol FooDelegate where Self: BarDelegate {}
+
+
protocol FooDelegate where Self: AnyObject {}
+
+
protocol FooDelegate where Self: NSObjectProtocol {}
+
+

Triggering Examples

+
↓protocol FooDelegate {}
+
+
↓protocol FooDelegate: Bar {}
+
+
↓protocol FooDelegate where Self: StringProtocol {}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/closing_brace.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/closing_brace.html new file mode 100644 index 000000000..e1fdd9607 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/closing_brace.html @@ -0,0 +1,382 @@ + + + + closing_brace Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Closing Brace Spacing

+ +

Closing brace with closing parenthesis should not have any whitespaces in the middle

+ +
    +
  • Identifier: closing_brace
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
[].map({ })
+
+
[].map(
+  { }
+)
+
+

Triggering Examples

+
[].map({ ↓} )
+
+
[].map({ ↓}   )
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/closure_body_length.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/closure_body_length.html new file mode 100644 index 000000000..e77df7202 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/closure_body_length.html @@ -0,0 +1,1070 @@ + + + + closure_body_length Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Closure Body Length

+ +

Closure bodies should not span too many lines

+ +
    +
  • Identifier: closure_body_length
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: metrics
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +warning + +30 +
    +error + +100 +
  • +
+

Non Triggering Examples

+
foo.bar { $0 }
+
+
foo.bar { toto in
+}
+
+
foo.bar { toto in
+    let a0 = 0
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+
foo.bar { toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+}
+
+
foo.bar { toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+
foo.bar({ toto in
+})
+
+
foo.bar({ toto in
+    let a0 = 0
+})
+
+
foo.bar({ toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+})
+
+
foo.bar(label: { toto in
+})
+
+
foo.bar(label: { toto in
+    let a0 = 0
+})
+
+
foo.bar(label: { toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+})
+
+
foo.bar(label: { toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+}, anotherLabel: { toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+})
+
+
foo.bar(label: { toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+}) { toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+}
+
+
let foo: Bar = { toto in
+    let bar = Bar()
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    return bar
+}()
+
+

Triggering Examples

+
foo.bar ↓{ toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+    let a29 = 0
+    let a30 = 0
+}
+
+
foo.bar ↓{ toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+    let a29 = 0
+    let a30 = 0
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+    // toto
+
+
+
+
+
+
+
+
+
+
+}
+
+
foo.bar(↓{ toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+    let a29 = 0
+    let a30 = 0
+})
+
+
foo.bar(label: ↓{ toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+    let a29 = 0
+    let a30 = 0
+})
+
+
foo.bar(label: ↓{ toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+    let a29 = 0
+    let a30 = 0
+}, anotherLabel: ↓{ toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+    let a29 = 0
+    let a30 = 0
+})
+
+
foo.bar(label: ↓{ toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+    let a29 = 0
+    let a30 = 0
+}) ↓{ toto in
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+    let a29 = 0
+    let a30 = 0
+}
+
+
let foo: Bar = ↓{ toto in
+    let bar = Bar()
+    let a0 = 0
+    let a1 = 0
+    let a2 = 0
+    let a3 = 0
+    let a4 = 0
+    let a5 = 0
+    let a6 = 0
+    let a7 = 0
+    let a8 = 0
+    let a9 = 0
+    let a10 = 0
+    let a11 = 0
+    let a12 = 0
+    let a13 = 0
+    let a14 = 0
+    let a15 = 0
+    let a16 = 0
+    let a17 = 0
+    let a18 = 0
+    let a19 = 0
+    let a20 = 0
+    let a21 = 0
+    let a22 = 0
+    let a23 = 0
+    let a24 = 0
+    let a25 = 0
+    let a26 = 0
+    let a27 = 0
+    let a28 = 0
+    return bar
+}()
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/closure_end_indentation.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/closure_end_indentation.html new file mode 100644 index 000000000..e483a446e --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/closure_end_indentation.html @@ -0,0 +1,442 @@ + + + + closure_end_indentation Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Closure End Indentation

+ +

Closure end should have the same indentation as the line that started it.

+ +
    +
  • Identifier: closure_end_indentation
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
SignalProducer(values: [1, 2, 3])
+   .startWithNext { number in
+       print(number)
+   }
+
+
+
[1, 2].map { $0 + 1 }
+
+
+
return match(pattern: pattern, with: [.comment]).flatMap { range in
+   return Command(string: contents, range: range)
+}.flatMap { command in
+   return command.expand()
+}
+
+
+
foo(foo: bar,
+    options: baz) { _ in }
+
+
+
someReallyLongProperty.chainingWithAnotherProperty
+   .foo { _ in }
+
+
foo(abc, 123)
+{ _ in }
+
+
+
function(
+    closure: { x in
+        print(x)
+    },
+    anotherClosure: { y in
+        print(y)
+    })
+
+
function(parameter: param,
+         closure: { x in
+    print(x)
+})
+
+
function(parameter: param, closure: { x in
+        print(x)
+    },
+    anotherClosure: { y in
+        print(y)
+    })
+
+
(-variable).foo()
+
+

Triggering Examples

+
SignalProducer(values: [1, 2, 3])
+   .startWithNext { number in
+       print(number)
+↓}
+
+
+
return match(pattern: pattern, with: [.comment]).flatMap { range in
+   return Command(string: contents, range: range)
+   ↓}.flatMap { command in
+   return command.expand()
+↓}
+
+
+
function(
+    closure: { x in
+        print(x)
+↓},
+    anotherClosure: { y in
+        print(y)
+↓})
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/closure_parameter_position.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/closure_parameter_position.html new file mode 100644 index 000000000..5690511dc --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/closure_parameter_position.html @@ -0,0 +1,458 @@ + + + + closure_parameter_position Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Closure Parameter Position

+ +

Closure parameters should be on the same line as opening brace

+ +
    +
  • Identifier: closure_parameter_position
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
[1, 2].map { $0 + 1 }
+
+
[1, 2].map({ $0 + 1 })
+
+
[1, 2].map { number in
+ number + 1 
+}
+
+
[1, 2].map { number -> Int in
+ number + 1 
+}
+
+
[1, 2].map { (number: Int) -> Int in
+ number + 1 
+}
+
+
[1, 2].map { [weak self] number in
+ number + 1 
+}
+
+
[1, 2].something(closure: { number in
+ number + 1 
+})
+
+
let isEmpty = [1, 2].isEmpty()
+
+
rlmConfiguration.migrationBlock.map { rlmMigration in
+    return { migration, schemaVersion in
+        rlmMigration(migration.rlmMigration, schemaVersion)
+    }
+}
+
+
let mediaView: UIView = { [weak self] index in
+   return UIView()
+}(index)
+
+

Triggering Examples

+
[1, 2].map {
+    ↓number in
+    number + 1
+}
+
+
[1, 2].map {
+    ↓number -> Int in
+    number + 1
+}
+
+
[1, 2].map {
+    (↓number: Int) -> Int in
+    number + 1
+}
+
+
[1, 2].map {
+    [weak ↓self] ↓number in
+    number + 1
+}
+
+
[1, 2].map { [weak self]
+    ↓number in
+    number + 1
+}
+
+
[1, 2].map({
+    ↓number in
+    number + 1
+})
+
+
[1, 2].something(closure: {
+    ↓number in
+    number + 1
+})
+
+
[1, 2].reduce(0) {
+    ↓sum, ↓number in
+    number + sum
+})
+
+
f.completionHandler = {
+    ↓thing in
+    doStuff()
+}
+
+
foo {
+    [weak ↓self] in
+    self?.bar()
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/closure_spacing.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/closure_spacing.html new file mode 100644 index 000000000..92f966452 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/closure_spacing.html @@ -0,0 +1,390 @@ + + + + closure_spacing Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Closure Spacing

+ +

Closure expressions should have a single space inside each brace

+ +
    +
  • Identifier: closure_spacing
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
[].map ({ $0.description })
+
+
[].filter { $0.contains(location) }
+
+
extension UITableViewCell: ReusableView { }
+
+
extension UITableViewCell: ReusableView {}
+
+

Triggering Examples

+
[].filter↓{ $0.contains(location) }
+
+
[].filter(↓{$0.contains(location)})
+
+
[].map(↓{$0})
+
+
(↓{each in return result.contains(where: ↓{e in return e}) }).count
+
+
filter ↓{ sorted ↓{ $0 < $1}}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/collection_alignment.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/collection_alignment.html new file mode 100644 index 000000000..784346183 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/collection_alignment.html @@ -0,0 +1,459 @@ + + + + collection_alignment Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Collection Element Alignment

+ +

All elements in a collection literal should be vertically aligned

+ +
    +
  • Identifier: collection_alignment
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +align_colons + +false +
  • +
+

Non Triggering Examples

+
doThings(arg: [
+    "foo": 1,
+    "bar": 2,
+    "fizz": 2,
+    "buzz": 2
+])
+
+
let abc = [
+    "alpha": "a",
+    "beta": "b",
+    "gamma": "g",
+    "delta": "d",
+    "epsilon": "e"
+]
+
+
let meals = [
+                "breakfast": "oatmeal",
+                "lunch": "sandwich",
+                "dinner": "burger"
+]
+
+
NSAttributedString(string: "…", attributes: [.font: UIFont.systemFont(ofSize: 12, weight: .regular),
+                                             .foregroundColor: UIColor(white: 0, alpha: 0.2)])
+
+
let coordinates = [
+    CLLocationCoordinate2D(latitude: 0, longitude: 33),
+    CLLocationCoordinate2D(latitude: 0, longitude: 66),
+    CLLocationCoordinate2D(latitude: 0, longitude: 99)
+]
+
+
var evenNumbers: Set<Int> = [
+    2,
+    4,
+    6
+]
+
+
let abc = [1, 2, 3, 4]
+
+
let abc = [
+    1, 2, 3, 4
+]
+
+
let abc = [
+    "foo": "bar", "fizz": "buzz"
+]
+
+

Triggering Examples

+
doThings(arg: [
+    "foo": 1,
+    "bar": 2,
+   ↓"fizz": 2,
+   ↓"buzz": 2
+])
+
+
let abc = [
+    "alpha": "a",
+     ↓"beta": "b",
+    "gamma": "g",
+    "delta": "d",
+  ↓"epsilon": "e"
+]
+
+
let meals = [
+                "breakfast": "oatmeal",
+                "lunch": "sandwich",
+    ↓"dinner": "burger"
+]
+
+
let coordinates = [
+    CLLocationCoordinate2D(latitude: 0, longitude: 33),
+        ↓CLLocationCoordinate2D(latitude: 0, longitude: 66),
+    CLLocationCoordinate2D(latitude: 0, longitude: 99)
+]
+
+
var evenNumbers: Set<Int> = [
+    2,
+  ↓4,
+    6
+]
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/colon.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/colon.html new file mode 100644 index 000000000..bfdd6d377 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/colon.html @@ -0,0 +1,600 @@ + + + + colon Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Colon Spacing

+ +

Colons should be next to the identifier when specifying a type and next to the key in dictionary literals

+ +
    +
  • Identifier: colon
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +flexible_right_spacing + +false +
    +apply_to_dictionaries + +true +
  • +
+

Non Triggering Examples

+
let abc: Void
+
+
let abc: [Void: Void]
+
+
let abc: (Void, Void)
+
+
let abc: ([Void], String, Int)
+
+
let abc: [([Void], String, Int)]
+
+
let abc: String="def"
+
+
let abc: Int=0
+
+
let abc: Enum=Enum.Value
+
+
func abc(def: Void) {}
+
+
func abc(def: Void, ghi: Void) {}
+
+
let abc: String = "abc:"
+
+
let abc = [Void: Void]()
+
+
let abc = [1: [3: 2], 3: 4]
+
+
let abc = ["string": "string"]
+
+
let abc = ["string:string": "string"]
+
+
let abc: [String: Int]
+
+
func foo(bar: [String: Int]) {}
+
+
func foo() -> [String: Int] { return [:] }
+
+
let abc: Any
+
+
let abc: [Any: Int]
+
+
let abc: [String: Any]
+
+
class Foo: Bar {}
+
+
class Foo<T>: Bar {}
+
+
class Foo<T: Equatable>: Bar {}
+
+
class Foo<T, U>: Bar {}
+
+
class Foo<T: Equatable> {}
+
+
object.method(x: /* comment */ 5)
+
+
switch foo {
+case .bar:
+    _ = something()
+}
+
+
object.method(x: 5, y: "string")
+
+
object.method(x: 5, y:
+              "string")
+
+
object.method(5, y: "string")
+
+
func abc() { def(ghi: jkl) }
+
+
func abc(def: Void) { ghi(jkl: mno) }
+
+
class ABC { let def = ghi(jkl: mno) } }
+
+
func foo() { let dict = [1: 1] }
+
+
let aaa = Self.bbb ? Self.ccc : Self.ddd else {
+return nil
+Example("}
+
+
range.flatMap(file.syntaxMap.kinds(inByteRange:)) ?? []
+
+
@objc(receiveReply:)
+public class func receiveReply(_ reply: bad_instruction_exception_reply_t) -> CInt { 0 }
+
+
switch str {
+case "adlm", "adlam":             return .adlam
+case "aghb", "caucasianalbanian": return .caucasianAlbanian
+default:                          return nil
+}
+
+
precedencegroup PipelinePrecedence {
+  associativity: left
+}
+infix operator |> : PipelinePrecedence
+
+
switch scalar {
+  case 0x000A...0x000D /* LF ... CR */: return true
+  case 0x0085 /* NEXT LINE (NEL) */: return true
+  case 0x2028 /* LINE SEPARATOR */: return true
+  case 0x2029 /* PARAGRAPH SEPARATOR */: return true
+  default: return false
+}
+
+

Triggering Examples

+
let abc↓:Void
+
+
let abc↓:  Void
+
+
let abc↓ :Void
+
+
let abc↓ : Void
+
+
let abc↓ : [Void: Void]
+
+
let abc↓ : (Void, String, Int)
+
+
let abc↓ : ([Void], String, Int)
+
+
let abc↓ : [([Void], String, Int)]
+
+
let abc↓:  (Void, String, Int)
+
+
let abc↓:  ([Void], String, Int)
+
+
let abc↓:  [([Void], String, Int)]
+
+
let abc↓ :String="def"
+
+
let abc↓ :Int=0
+
+
let abc↓ :Int = 0
+
+
let abc↓:Int=0
+
+
let abc↓:Int = 0
+
+
let abc↓:Enum=Enum.Value
+
+
func abc(def↓:Void) {}
+
+
func abc(def↓:  Void) {}
+
+
func abc(def↓ :Void) {}
+
+
func abc(def↓ : Void) {}
+
+
func abc(def: Void, ghi↓ :Void) {}
+
+
let abc = [Void↓:Void]()
+
+
let abc = [Void↓ : Void]()
+
+
let abc = [Void↓:  Void]()
+
+
let abc = [Void↓ :  Void]()
+
+
let abc = [1: [3↓ : 2], 3: 4]
+
+
let abc = [1: [3↓ : 2], 3↓:  4]
+
+
let abc: [String↓ : Int]
+
+
let abc: [String↓:Int]
+
+
func foo(bar: [String↓ : Int]) {}
+
+
func foo(bar: [String↓:Int]) {}
+
+
func foo() -> [String↓ : Int] { return [:] }
+
+
func foo() -> [String↓:Int] { return [:] }
+
+
let abc↓ : Any
+
+
let abc: [Any↓ : Int]
+
+
let abc: [String↓ : Any]
+
+
class Foo↓ : Bar {}
+
+
class Foo↓:Bar {}
+
+
class Foo<T>↓ : Bar {}
+
+
class Foo<T>↓:Bar {}
+
+
class Foo<T, U>↓:Bar {}
+
+
class Foo<T: Equatable>↓:Bar {}
+
+
class Foo<T↓:Equatable> {}
+
+
class Foo<T↓ : Equatable> {}
+
+
object.method(x: 5, y↓ : "string")
+
+
object.method(x↓:5, y: "string")
+
+
object.method(x↓:  5, y: "string")
+
+
func abc() { def(ghi↓:jkl) }
+
+
func abc(def: Void) { ghi(jkl↓:mno) }
+
+
class ABC { let def = ghi(jkl↓:mno) } }
+
+
func foo() { let dict = [1↓ : 1] }
+
+
switch foo {
+case .bar↓ : return baz
+}
+
+
private var action↓:(() -> Void)?
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/comma.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/comma.html new file mode 100644 index 000000000..f2dc2d8a3 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/comma.html @@ -0,0 +1,422 @@ + + + + comma Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Comma Spacing

+ +

There should be no space before and one after any comma

+ +
    +
  • Identifier: comma
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func abc(a: String, b: String) { }
+
+
abc(a: "string", b: "string"
+
+
enum a { case a, b, c }
+
+
func abc(
+  a: String,  // comment
+  bcd: String // comment
+) {
+}
+
+
func abc(
+  a: String,
+  bcd: String
+) {
+}
+
+
#imageLiteral(resourceName: "foo,bar,baz")
+
+
kvcStringBuffer.advanced(by: rootKVCLength)
+  .storeBytes(of: 0x2E /* '.' */, as: CChar.self)
+
+

Triggering Examples

+
func abc(a: String↓ ,b: String) { }
+
+
func abc(a: String↓ ,b: String↓ ,c: String↓ ,d: String) { }
+
+
abc(a: "string"↓,b: "string"
+
+
enum a { case a↓ ,b }
+
+
let result = plus(
+    first: 3↓ , // #683
+    second: 4
+)
+
+
Foo(
+  parameter: a.b.c,
+  tag: a.d,
+  value: a.identifier.flatMap { Int64($0) }↓ ,
+  reason: Self.abcd()
+)
+
+
return Foo(bar: .baz, title: fuzz,
+          message: My.Custom.message↓ ,
+          another: parameter, doIt: true,
+          alignment: .center)
+
+
Logger.logError("Hat is too large"↓,  info: [])
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/comma_inheritance.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/comma_inheritance.html new file mode 100644 index 000000000..9c58d2a33 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/comma_inheritance.html @@ -0,0 +1,406 @@ + + + + comma_inheritance Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Comma Inheritance Rule

+ +

Use commas to separate types in inheritance lists

+ +
    +
  • Identifier: comma_inheritance
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
struct A: Codable, Equatable {}
+
+
enum B: Codable, Equatable {}
+
+
class C: Codable, Equatable {}
+
+
protocol D: Codable, Equatable {}
+
+
typealias E = Equatable & Codable
+
+
func foo<T: Equatable & Codable>(_ param: T) {}
+
+
protocol G {
+    associatedtype Model: Codable, Equatable
+}
+
+

Triggering Examples

+
struct A: Codable↓ & Equatable {}
+
+
struct A: Codable↓  & Equatable {}
+
+
struct A: Codable↓&Equatable {}
+
+
struct A: Codable↓& Equatable {}
+
+
enum B: Codable↓ & Equatable {}
+
+
class C: Codable↓ & Equatable {}
+
+
protocol D: Codable↓ & Equatable {}
+
+
protocol G {
+    associatedtype Model: Codable↓ & Equatable
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/comment_spacing.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/comment_spacing.html new file mode 100644 index 000000000..de98f4462 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/comment_spacing.html @@ -0,0 +1,428 @@ + + + + comment_spacing Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Comment Spacing

+ +

Prefer at least one space after slashes for comments

+ +
    +
  • Identifier: comment_spacing
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
// This is a comment
+
+
/// Triple slash comment
+
+
// Multiline double-slash
+// comment
+
+
/// Multiline triple-slash
+/// comment
+
+
/// Multiline triple-slash
+///   - This is indented
+
+
// - MARK: Mark comment
+
+
//: Swift Playground prose section
+
+
///////////////////////////////////////////////
+// Comment with some lines of slashes boxing it
+///////////////////////////////////////////////
+
+
//:#localized(key: "SwiftPlaygroundLocalizedProse")
+
+
/* Asterisk comment */
+
+
/*
+    Multiline asterisk comment
+*/
+
+
/*:
+    Multiline Swift Playground prose section
+*/
+
+
/*#-editable-code Swift Playground editable area*/default/*#-end-editable-code*/
+
+

Triggering Examples

+
//↓Something
+
+
//↓MARK
+
+
//↓👨‍👨‍👦‍👦Something
+
+
func a() {
+    //↓This needs refactoring
+    print("Something")
+}
+//↓We should improve above function
+
+
///↓This is a comment
+
+
/// Multiline triple-slash
+///↓This line is incorrect, though
+
+
//↓- MARK: Mark comment
+
+
//:↓Swift Playground prose section
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/compiler_protocol_init.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/compiler_protocol_init.html new file mode 100644 index 000000000..fffedc535 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/compiler_protocol_init.html @@ -0,0 +1,384 @@ + + + + compiler_protocol_init Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Compiler Protocol Init

+ +

The initializers declared in compiler protocols such as ExpressibleByArrayLiteral shouldn’t be called directly.

+ +
    +
  • Identifier: compiler_protocol_init
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let set: Set<Int> = [1, 2]
+
+
let set = Set(array)
+
+

Triggering Examples

+
let set = ↓Set(arrayLiteral: 1, 2)
+
+
let set = ↓Set (arrayLiteral: 1, 2)
+
+
let set = ↓Set.init(arrayLiteral: 1, 2)
+
+
let set = ↓Set.init(arrayLiteral : 1, 2)
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/computed_accessors_order.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/computed_accessors_order.html new file mode 100644 index 000000000..53ea9643b --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/computed_accessors_order.html @@ -0,0 +1,577 @@ + + + + computed_accessors_order Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Computed Accessors Order

+ +

Getter and setters in computed properties and subscripts should be in a consistent order.

+ +
    +
  • Identifier: computed_accessors_order
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +order + +get_set +
  • +
+

Non Triggering Examples

+
class Foo {
+    var foo: Int {
+        get { return 3 }
+        set { _abc = newValue }
+    }
+}
+
+
class Foo {
+    var foo: Int {
+        return 20
+    }
+}
+
+
class Foo {
+    static var foo: Int {
+        return 20
+    }
+}
+
+
class Foo {
+    static var foo: Int {
+        get { return 3 }
+        set { _abc = newValue }
+    }
+}
+
+
class Foo {
+    var foo: Int
+}
+
+
class Foo {
+    var foo: Int {
+        return getValueFromDisk()
+    }
+}
+
+
class Foo {
+    var foo: String {
+        return "get"
+    }
+}
+
+
protocol Foo {
+    var foo: Int { get }
+
+
protocol Foo {
+    var foo: Int { get set }
+}
+
+
protocol Foo {
+    var foo: Int { set get }
+
+
class Foo {
+    var foo: Int {
+        struct Bar {
+            var bar: Int {
+                get { return 1 }
+                set { _ = newValue }
+            }
+        }
+
+        return Bar().bar
+    }
+}
+
+
var _objCTaggedPointerBits: UInt {
+    @inline(__always) get { return 0 }
+    set { print(newValue) }
+}
+
+
var next: Int? {
+    mutating get {
+        defer { self.count += 1 }
+        return self.count
+    }
+    set {
+        self.count = newValue
+    }
+}
+
+
extension Foo {
+    var bar: Bool {
+        get { _bar }
+        set { self._bar = newValue }
+    }
+}
+
+
extension Foo {
+    var bar: Bool {
+        get { _bar }
+        set(newValue) { self._bar = newValue }
+    }
+}
+
+
extension Reactive where Base: UITapGestureRecognizer {
+    var tapped: CocoaAction<Base>? {
+        get {
+            return associatedAction.withValue { $0.flatMap { $0.action } }
+        }
+        nonmutating set {
+            setAction(newValue)
+        }
+    }
+}
+
+
extension Test {
+    var foo: Bool {
+        get {
+            bar?.boolValue ?? true // Comment mentioning word set which triggers violation
+        }
+        set {
+            bar = NSNumber(value: newValue as Bool)
+        }
+    }
+}
+
+
class Foo {
+    subscript(i: Int) -> Int {
+        return 20
+    }
+}
+
+
class Foo {
+    subscript(i: Int) -> Int {
+        get { return 3 }
+        set { _abc = newValue }
+    }
+}
+
+
protocol Foo {
+    subscript(i: Int) -> Int { get }
+}
+
+
protocol Foo {
+    subscript(i: Int) -> Int { get set }
+}
+
+
protocol Foo {
+    subscript(i: Int) -> Int { set get }
+}
+
+

Triggering Examples

+
class Foo {
+    var foo: Int {
+        ↓set {
+            print(newValue)
+        }
+        get {
+            return 20
+        }
+    }
+}
+
+
class Foo {
+    static var foo: Int {
+        ↓set {
+            print(newValue)
+        }
+        get {
+            return 20
+        }
+    }
+}
+
+
var foo: Int {
+    ↓set { print(newValue) }
+    get { return 20 }
+}
+
+
extension Foo {
+    var bar: Bool {
+        ↓set { print(bar) }
+        get { _bar }
+    }
+}
+
+
class Foo {
+    var foo: Int {
+        ↓set {
+            print(newValue)
+        }
+        mutating get {
+            return 20
+        }
+    }
+}
+
+
class Foo {
+    subscript(i: Int) -> Int {
+        ↓set {
+            print(i)
+        }
+        get {
+            return 20
+        }
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/conditional_returns_on_newline.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/conditional_returns_on_newline.html new file mode 100644 index 000000000..987c79b36 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/conditional_returns_on_newline.html @@ -0,0 +1,417 @@ + + + + conditional_returns_on_newline Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Conditional Returns on Newline

+ +

Conditional statements should always return on the next line

+ +
    +
  • Identifier: conditional_returns_on_newline
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +if_only + +false +
  • +
+

Non Triggering Examples

+
guard true else {
+ return true
+}
+
+
guard true,
+ let x = true else {
+ return true
+}
+
+
if true else {
+ return true
+}
+
+
if true,
+ let x = true else {
+ return true
+}
+
+
if textField.returnKeyType == .Next {
+
+
if true { // return }
+
+
guard something
+else { return }
+
+

Triggering Examples

+
↓guard true else { return }
+
+
↓if true { return }
+
+
↓if true { break } else { return }
+
+
↓if true { break } else {       return }
+
+
↓if true { return "YES" } else { return "NO" }
+
+
↓guard condition else { XCTFail(); return }
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/contains_over_filter_count.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/contains_over_filter_count.html new file mode 100644 index 000000000..6b3bfff3a --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/contains_over_filter_count.html @@ -0,0 +1,414 @@ + + + + contains_over_filter_count Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Contains over Filter Count

+ +

Prefer contains over comparing filter(where:).count to 0

+ +
    +
  • Identifier: contains_over_filter_count
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let result = myList.filter(where: { $0 % 2 == 0 }).count > 1
+
+
let result = myList.filter { $0 % 2 == 0 }.count > 1
+
+
let result = myList.filter(where: { $0 % 2 == 0 }).count > 01
+
+
let result = myList.filter(where: { $0 % 2 == 0 }).count == 1
+
+
let result = myList.filter { $0 % 2 == 0 }.count == 1
+
+
let result = myList.filter(where: { $0 % 2 == 0 }).count == 01
+
+
let result = myList.filter(where: { $0 % 2 == 0 }).count != 1
+
+
let result = myList.filter { $0 % 2 == 0 }.count != 1
+
+
let result = myList.filter(where: { $0 % 2 == 0 }).count != 01
+
+
let result = myList.contains(where: { $0 % 2 == 0 })
+
+
let result = !myList.contains(where: { $0 % 2 == 0 })
+
+
let result = myList.contains(10)
+
+

Triggering Examples

+
let result = ↓myList.filter(where: { $0 % 2 == 0 }).count > 0
+
+
let result = ↓myList.filter { $0 % 2 == 0 }.count > 0
+
+
let result = ↓myList.filter(where: someFunction).count > 0
+
+
let result = ↓myList.filter(where: { $0 % 2 == 0 }).count == 0
+
+
let result = ↓myList.filter { $0 % 2 == 0 }.count == 0
+
+
let result = ↓myList.filter(where: someFunction).count == 0
+
+
let result = ↓myList.filter(where: { $0 % 2 == 0 }).count != 0
+
+
let result = ↓myList.filter { $0 % 2 == 0 }.count != 0
+
+
let result = ↓myList.filter(where: someFunction).count != 0
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/contains_over_filter_is_empty.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/contains_over_filter_is_empty.html new file mode 100644 index 000000000..5d4301aa1 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/contains_over_filter_is_empty.html @@ -0,0 +1,398 @@ + + + + contains_over_filter_is_empty Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Contains over Filter is Empty

+ +

Prefer contains over using filter(where:).isEmpty

+ +
    +
  • Identifier: contains_over_filter_is_empty
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let result = myList.filter(where: { $0 % 2 == 0 }).count > 1
+
+
let result = myList.filter { $0 % 2 == 0 }.count > 1
+
+
let result = myList.filter(where: { $0 % 2 == 0 }).count == 1
+
+
let result = myList.filter { $0 % 2 == 0 }.count == 1
+
+
let result = myList.filter(where: { $0 % 2 == 0 }).count != 1
+
+
let result = myList.filter { $0 % 2 == 0 }.count != 1
+
+
let result = myList.contains(where: { $0 % 2 == 0 })
+
+
let result = !myList.contains(where: { $0 % 2 == 0 })
+
+
let result = myList.contains(10)
+
+

Triggering Examples

+
let result = ↓myList.filter(where: { $0 % 2 == 0 }).isEmpty
+
+
let result = !↓myList.filter(where: { $0 % 2 == 0 }).isEmpty
+
+
let result = ↓myList.filter { $0 % 2 == 0 }.isEmpty
+
+
let result = ↓myList.filter(where: someFunction).isEmpty
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/contains_over_first_not_nil.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/contains_over_first_not_nil.html new file mode 100644 index 000000000..5a40edd9f --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/contains_over_first_not_nil.html @@ -0,0 +1,428 @@ + + + + contains_over_first_not_nil Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Contains over First not Nil

+ +

Prefer contains over first(where:) != nil and firstIndex(where:) != nil.

+ +
    +
  • Identifier: contains_over_first_not_nil
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let first = myList.first(where: { $0 % 2 == 0 })
+
+
let first = myList.first { $0 % 2 == 0 }
+
+
let firstIndex = myList.firstIndex(where: { $0 % 2 == 0 })
+
+
let firstIndex = myList.firstIndex { $0 % 2 == 0 }
+
+

Triggering Examples

+
↓myList.first { $0 % 2 == 0 } != nil
+
+
↓myList.first(where: { $0 % 2 == 0 }) != nil
+
+
↓myList.map { $0 + 1 }.first(where: { $0 % 2 == 0 }) != nil
+
+
↓myList.first(where: someFunction) != nil
+
+
↓myList.map { $0 + 1 }.first { $0 % 2 == 0 } != nil
+
+
(↓myList.first { $0 % 2 == 0 }) != nil
+
+
↓myList.first { $0 % 2 == 0 } == nil
+
+
↓myList.first(where: { $0 % 2 == 0 }) == nil
+
+
↓myList.map { $0 + 1 }.first(where: { $0 % 2 == 0 }) == nil
+
+
↓myList.first(where: someFunction) == nil
+
+
↓myList.map { $0 + 1 }.first { $0 % 2 == 0 } == nil
+
+
(↓myList.first { $0 % 2 == 0 }) == nil
+
+
↓myList.firstIndex { $0 % 2 == 0 } != nil
+
+
↓myList.firstIndex(where: { $0 % 2 == 0 }) != nil
+
+
↓myList.map { $0 + 1 }.firstIndex(where: { $0 % 2 == 0 }) != nil
+
+
↓myList.firstIndex(where: someFunction) != nil
+
+
↓myList.map { $0 + 1 }.firstIndex { $0 % 2 == 0 } != nil
+
+
(↓myList.firstIndex { $0 % 2 == 0 }) != nil
+
+
↓myList.firstIndex { $0 % 2 == 0 } == nil
+
+
↓myList.firstIndex(where: { $0 % 2 == 0 }) == nil
+
+
↓myList.map { $0 + 1 }.firstIndex(where: { $0 % 2 == 0 }) == nil
+
+
↓myList.firstIndex(where: someFunction) == nil
+
+
↓myList.map { $0 + 1 }.firstIndex { $0 % 2 == 0 } == nil
+
+
(↓myList.firstIndex { $0 % 2 == 0 }) == nil
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/contains_over_range_nil_comparison.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/contains_over_range_nil_comparison.html new file mode 100644 index 000000000..8a92a389d --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/contains_over_range_nil_comparison.html @@ -0,0 +1,384 @@ + + + + contains_over_range_nil_comparison Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Contains over Range Comparison to Nil

+ +

Prefer contains over range(of:) != nil and range(of:) == nil

+ +
    +
  • Identifier: contains_over_range_nil_comparison
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let range = myString.range(of: "Test")
+
+
myString.contains("Test")
+
+
!myString.contains("Test")
+
+
resourceString.range(of: rule.regex, options: .regularExpression) != nil
+
+

Triggering Examples

+
↓myString.range(of: "Test") != nil
+
+
↓myString.range(of: "Test") == nil
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/contrasted_opening_brace.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/contrasted_opening_brace.html new file mode 100644 index 000000000..b26355fc4 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/contrasted_opening_brace.html @@ -0,0 +1,557 @@ + + + + contrasted_opening_brace Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Contrasted Opening Brace

+ +

The correct positioning of braces that introduce a block of code or member list is highly controversial. No matter which style is preferred, consistency is key. Apart from different tastes, the positioning of braces can also have a significant impact on the readability of the code, especially for visually impaired developers. This rule ensures that braces are on a separate line after the declaration to contrast the code block from the rest of the declaration. Comments between the declaration and the opening brace are respected. Check out the opening_brace rule for a different style.

+ +
    +
  • Identifier: contrasted_opening_brace
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func abc()
+{
+}
+
+
[].map()
+{
+    $0
+}
+
+
[].map(
+    {
+    }
+)
+
+
if let a = b
+{
+}
+
+
while a == b
+{
+}
+
+
guard let a = b else
+{
+}
+
+
struct Rule
+{
+}
+
+
struct Parent
+{
+    struct Child
+    {
+        let foo: Int
+    }
+}
+
+
func f(rect: CGRect)
+{
+    {
+        let centre = CGPoint(x: rect.midX, y: rect.midY)
+        print(centre)
+    }()
+}
+
+
func f(rect: CGRect) -> () -> Void
+{
+    {
+        let centre = CGPoint(x: rect.midX, y: rect.midY)
+        print(centre)
+    }
+}
+
+
func f() -> () -> Void
+{
+    {}
+}
+
+
@MyProperty class Rule:
+  NSObject
+{
+  var a: String
+  {
+    return ""
+  }
+}
+
+
self.foo(
+    (
+        "String parameter",
+        { "Do something here" }
+    )
+)
+
+
let pattern = #/(\{(?<key>\w+)\})/#
+
+
if c
+{}
+else
+{}
+
+
    if c /* comment */
+    {
+        return
+    }
+
+
if c1
+{
+  return
+} else if c2
+{
+  return
+} else if c3
+{
+  return
+}
+
+
let a = f.map
+{ a in
+    a
+}
+
+

Triggering Examples

+
func abc()↓{
+}
+
+
func abc() { }
+
+
func abc(a: A,
+         b: B) {}
+
+
[].map { $0 }
+
+
struct OldContentView: View ↓{
+  @State private var showOptions = false
+
+  var body: some View ↓{
+    Button(action: {
+      self.showOptions.toggle()
+    })↓{
+      Image(systemName: "gear")
+    } label: ↓{
+      Image(systemName: "gear")
+    }
+  }
+}
+
+
class Rule
+{
+  var a: String↓{
+    return ""
+  }
+}
+
+
@MyProperty class Rule
+{
+  var a: String
+  {
+    willSet↓{
+
+    }
+    didSet  ↓{
+
+    }
+  }
+}
+
+
precedencegroup Group ↓{
+  assignment: true
+}
+
+
if
+    "test".isEmpty ↓{
+    // code here
+}
+
+
if c  ↓{}
+else /* comment */  ↓{}
+
+
if c
+  ↓{
+    // code here
+}
+
+
if c1 ↓{
+  return
+} else if c2↓{
+  return
+} else if c3
+ ↓{
+  return
+}
+
+
func f()
+{
+    return a.map
+            ↓{ $0 }
+}
+
+
a ↓{
+    $0
+} b: ↓{
+    $1
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/control_statement.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/control_statement.html new file mode 100644 index 000000000..3ff876de3 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/control_statement.html @@ -0,0 +1,434 @@ + + + + control_statement Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Control Statement

+ +

if, for, guard, switch, while, and catch statements shouldn’t unnecessarily wrap their conditionals or arguments in parentheses

+ +
    +
  • Identifier: control_statement
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
if condition {}
+
+
if (a, b) == (0, 1) {}
+
+
if (a || b) && (c || d) {}
+
+
if (min...max).contains(value) {}
+
+
if renderGif(data) {}
+
+
renderGif(data)
+
+
guard condition else {}
+
+
while condition {}
+
+
do {} while condition {}
+
+
do { ; } while condition {}
+
+
switch foo {}
+
+
do {} catch let error as NSError {}
+
+
foo().catch(all: true) {}
+
+
if max(a, b) < c {}
+
+
switch (lhs, rhs) {}
+
+
if (f() { g() {} }) {}
+
+
if (a + f() {} == 1) {}
+
+
if ({ true }()) {}
+
+

Triggering Examples

+
↓if (condition) {}
+
+
↓if(condition) {}
+
+
↓if (condition == endIndex) {}
+
+
↓if ((a || b) && (c || d)) {}
+
+
↓if ((min...max).contains(value)) {}
+
+
↓guard (condition) else {}
+
+
↓while (condition) {}
+
+
↓while(condition) {}
+
+
do { ; } ↓while(condition) {}
+
+
do { ; } ↓while (condition) {}
+
+
↓switch (foo) {}
+
+
do {} ↓catch(let error as NSError) {}
+
+
↓if (max(a, b) < c) {}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/convenience_type.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/convenience_type.html new file mode 100644 index 000000000..32cf109c3 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/convenience_type.html @@ -0,0 +1,449 @@ + + + + convenience_type Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Convenience Type

+ +

Types used for hosting only static members should be implemented as a caseless enum to avoid instantiation

+ +
    +
  • Identifier: convenience_type
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
enum Math { // enum
+  public static let pi = 3.14
+}
+
+
// class with inheritance
+class MathViewController: UIViewController {
+  public static let pi = 3.14
+}
+
+
@objc class Math: NSObject { // class visible to Obj-C
+  public static let pi = 3.14
+}
+
+
struct Math { // type with non-static declarations
+  public static let pi = 3.14
+  public let randomNumber = 2
+}
+
+
class DummyClass {}
+
+
class Foo: NSObject { // class with Obj-C class property
+    class @objc let foo = 1
+}
+
+
class Foo: NSObject { // class with Obj-C static property
+    static @objc let foo = 1
+}
+
+
class Foo { // @objc class func can't exist on an enum
+   @objc class func foo() {}
+}
+
+
class Foo { // @objc static func can't exist on an enum
+   @objc static func foo() {}
+}
+
+
@objcMembers class Foo { // @objc static func can't exist on an enum
+   static func foo() {}
+}
+
+
final class Foo { // final class, but @objc class func can't exist on an enum
+   @objc class func foo() {}
+}
+
+
final class Foo { // final class, but @objc static func can't exist on an enum
+   @objc static func foo() {}
+}
+
+
@globalActor actor MyActor {
+  static let shared = MyActor()
+}
+
+

Triggering Examples

+
↓struct Math {
+  public static let pi = 3.14
+}
+
+
↓struct Math {
+  public static let pi = 3.14
+  @available(*, unavailable) init() {}
+}
+
+
final ↓class Foo { // final class can't be inherited
+    class let foo = 1
+}
+
+
↓class Foo {
+    class let foo = 1
+}
+
+
↓class Foo {
+    final class let foo = 1
+}
+
+
↓class SomeClass {
+    static func foo() {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/css/highlight.css b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/css/highlight.css new file mode 100644 index 000000000..c170357ce --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/css/highlight.css @@ -0,0 +1,202 @@ +/*! Jazzy - https://github.com/realm/jazzy + * Copyright Realm Inc. + * SPDX-License-Identifier: MIT + */ +/* Credit to https://gist.github.com/wataru420/2048287 */ +.highlight .c { + color: #999988; + font-style: italic; } + +.highlight .err { + color: #a61717; + background-color: #e3d2d2; } + +.highlight .k { + color: #000000; + font-weight: bold; } + +.highlight .o { + color: #000000; + font-weight: bold; } + +.highlight .cm { + color: #999988; + font-style: italic; } + +.highlight .cp { + color: #999999; + font-weight: bold; } + +.highlight .c1 { + color: #999988; + font-style: italic; } + +.highlight .cs { + color: #999999; + font-weight: bold; + font-style: italic; } + +.highlight .gd { + color: #000000; + background-color: #ffdddd; } + +.highlight .gd .x { + color: #000000; + background-color: #ffaaaa; } + +.highlight .ge { + color: #000000; + font-style: italic; } + +.highlight .gr { + color: #aa0000; } + +.highlight .gh { + color: #999999; } + +.highlight .gi { + color: #000000; + background-color: #ddffdd; } + +.highlight .gi .x { + color: #000000; + background-color: #aaffaa; } + +.highlight .go { + color: #888888; } + +.highlight .gp { + color: #555555; } + +.highlight .gs { + font-weight: bold; } + +.highlight .gu { + color: #aaaaaa; } + +.highlight .gt { + color: #aa0000; } + +.highlight .kc { + color: #000000; + font-weight: bold; } + +.highlight .kd { + color: #000000; + font-weight: bold; } + +.highlight .kp { + color: #000000; + font-weight: bold; } + +.highlight .kr { + color: #000000; + font-weight: bold; } + +.highlight .kt { + color: #445588; } + +.highlight .m { + color: #009999; } + +.highlight .s { + color: #d14; } + +.highlight .na { + color: #008080; } + +.highlight .nb { + color: #0086B3; } + +.highlight .nc { + color: #445588; + font-weight: bold; } + +.highlight .no { + color: #008080; } + +.highlight .ni { + color: #800080; } + +.highlight .ne { + color: #990000; + font-weight: bold; } + +.highlight .nf { + color: #990000; } + +.highlight .nn { + color: #555555; } + +.highlight .nt { + color: #000080; } + +.highlight .nv { + color: #008080; } + +.highlight .ow { + color: #000000; + font-weight: bold; } + +.highlight .w { + color: #bbbbbb; } + +.highlight .mf { + color: #009999; } + +.highlight .mh { + color: #009999; } + +.highlight .mi { + color: #009999; } + +.highlight .mo { + color: #009999; } + +.highlight .sb { + color: #d14; } + +.highlight .sc { + color: #d14; } + +.highlight .sd { + color: #d14; } + +.highlight .s2 { + color: #d14; } + +.highlight .se { + color: #d14; } + +.highlight .sh { + color: #d14; } + +.highlight .si { + color: #d14; } + +.highlight .sx { + color: #d14; } + +.highlight .sr { + color: #009926; } + +.highlight .s1 { + color: #d14; } + +.highlight .ss { + color: #990073; } + +.highlight .bp { + color: #999999; } + +.highlight .vc { + color: #008080; } + +.highlight .vg { + color: #008080; } + +.highlight .vi { + color: #008080; } + +.highlight .il { + color: #009999; } diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/css/jazzy.css b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/css/jazzy.css new file mode 100644 index 000000000..9d4b08b8c --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/css/jazzy.css @@ -0,0 +1,405 @@ +/*! Jazzy - https://github.com/realm/jazzy + * Copyright Realm Inc. + * SPDX-License-Identifier: MIT + */ +*, *:before, *:after { + box-sizing: inherit; } + +body { + margin: 0; + background: #fff; + color: #333; + font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif; + letter-spacing: .2px; + -webkit-font-smoothing: antialiased; + box-sizing: border-box; } + +h1 { + font-size: 2rem; + font-weight: 700; + margin: 1.275em 0 0.6em; } + +h2 { + font-size: 1.75rem; + font-weight: 700; + margin: 1.275em 0 0.3em; } + +h3 { + font-size: 1.5rem; + font-weight: 700; + margin: 1em 0 0.3em; } + +h4 { + font-size: 1.25rem; + font-weight: 700; + margin: 1.275em 0 0.85em; } + +h5 { + font-size: 1rem; + font-weight: 700; + margin: 1.275em 0 0.85em; } + +h6 { + font-size: 1rem; + font-weight: 700; + margin: 1.275em 0 0.85em; + color: #777; } + +p { + margin: 0 0 1em; } + +ul, ol { + padding: 0 0 0 2em; + margin: 0 0 0.85em; } + +blockquote { + margin: 0 0 0.85em; + padding: 0 15px; + color: #858585; + border-left: 4px solid #e5e5e5; } + +img { + max-width: 100%; } + +a { + color: #4183c4; + text-decoration: none; } + a:hover, a:focus { + outline: 0; + text-decoration: underline; } + a.discouraged { + text-decoration: line-through; } + a.discouraged:hover, a.discouraged:focus { + text-decoration: underline line-through; } + +table { + background: #fff; + width: 100%; + border-collapse: collapse; + border-spacing: 0; + overflow: auto; + margin: 0 0 0.85em; } + +tr:nth-child(2n) { + background-color: #fbfbfb; } + +th, td { + padding: 6px 13px; + border: 1px solid #ddd; } + +hr { + height: 1px; + border: none; + background-color: #ddd; } + +pre { + margin: 0 0 1.275em; + padding: .85em 1em; + overflow: auto; + background: #f7f7f7; + font-size: .85em; + font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; } + +code { + font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; } + +.item-container p > code, .item-container li > code, .top-matter p > code, .top-matter li > code { + background: #f7f7f7; + padding: .2em; } + .item-container p > code:before, .item-container p > code:after, .item-container li > code:before, .item-container li > code:after, .top-matter p > code:before, .top-matter p > code:after, .top-matter li > code:before, .top-matter li > code:after { + letter-spacing: -.2em; + content: "\00a0"; } + +pre code { + padding: 0; + white-space: pre; } + +.content-wrapper { + display: flex; + flex-direction: column; } + @media (min-width: 768px) { + .content-wrapper { + flex-direction: row; } } +.header { + display: flex; + padding: 8px; + font-size: 0.875em; + background: #444; + color: #999; } + +.header-col { + margin: 0; + padding: 0 8px; } + +.header-col--primary { + flex: 1; } + +.header-link { + color: #fff; } + +.header-icon { + padding-right: 2px; + vertical-align: -3px; + height: 16px; } + +.breadcrumbs { + font-size: 0.875em; + padding: 8px 16px; + margin: 0; + background: #fbfbfb; + border-bottom: 1px solid #ddd; } + +.carat { + height: 10px; + margin: 0 5px; } + +.navigation { + order: 2; } + @media (min-width: 768px) { + .navigation { + order: 1; + width: 25%; + max-width: 300px; + padding-bottom: 64px; + overflow: hidden; + word-wrap: normal; + background: #fbfbfb; + border-right: 1px solid #ddd; } } +.nav-groups { + list-style-type: none; + padding-left: 0; } + +.nav-group-name { + border-bottom: 1px solid #ddd; + padding: 8px 0 8px 16px; } + +.nav-group-name-link { + color: #333; } + +.nav-group-tasks { + margin: 8px 0; + padding: 0 0 0 8px; } + +.nav-group-task { + font-size: 1em; + list-style-type: none; + white-space: nowrap; } + +.nav-group-task-link { + color: #808080; } + +.main-content { + order: 1; } + @media (min-width: 768px) { + .main-content { + order: 2; + flex: 1; + padding-bottom: 60px; } } +.section { + padding: 0 32px; + border-bottom: 1px solid #ddd; } + +.section-content { + max-width: 834px; + margin: 0 auto; + padding: 16px 0; } + +.section-name { + color: #666; + display: block; } + .section-name p { + margin-bottom: inherit; } + +.declaration .highlight { + overflow-x: initial; + padding: 8px 0; + margin: 0; + background-color: transparent; + border: none; } + +.task-group-section { + border-top: 1px solid #ddd; } + +.task-group { + padding-top: 0px; } + +.task-name-container a[name]:before { + content: ""; + display: block; } + +.section-name-container { + position: relative; } + .section-name-container .section-name-link { + position: absolute; + top: 0; + left: 0; + bottom: 0; + right: 0; + margin-bottom: 0; } + .section-name-container .section-name { + position: relative; + pointer-events: none; + z-index: 1; } + .section-name-container .section-name a { + pointer-events: auto; } + +.item-container { + padding: 0; } + +.item { + padding-top: 8px; + width: 100%; + list-style-type: none; } + .item a[name]:before { + content: ""; + display: block; } + .item .token, .item .direct-link { + display: inline-block; + text-indent: -20px; + padding-left: 3px; + margin-left: 20px; + font-size: 1rem; } + +.declaration-note { + font-size: .85em; + color: #808080; + font-style: italic; } + +.pointer-container { + border-bottom: 1px solid #ddd; + left: -23px; + padding-bottom: 13px; + position: relative; + width: 110%; } + +.pointer { + left: 21px; + top: 7px; + display: block; + position: absolute; + width: 12px; + height: 12px; + border-left: 1px solid #ddd; + border-top: 1px solid #ddd; + background: #fff; + transform: rotate(45deg); } + +.height-container { + display: none; + position: relative; + width: 100%; + overflow: hidden; } + .height-container .section { + background: #fff; + border: 1px solid #ddd; + border-top-width: 0; + padding-top: 10px; + padding-bottom: 5px; + padding: 8px 16px; } + +.aside, .language { + padding: 6px 12px; + margin: 12px 0; + border-left: 5px solid #dddddd; + overflow-y: hidden; } + .aside .aside-title, .language .aside-title { + font-size: 9px; + letter-spacing: 2px; + text-transform: uppercase; + padding-bottom: 0; + margin: 0; + color: #aaa; + -webkit-user-select: none; } + .aside p:last-child, .language p:last-child { + margin-bottom: 0; } + +.language { + border-left: 5px solid #cde9f4; } + .language .aside-title { + color: #4183c4; } + +.aside-warning, .aside-deprecated, .aside-unavailable { + border-left: 5px solid #ff6666; } + .aside-warning .aside-title, .aside-deprecated .aside-title, .aside-unavailable .aside-title { + color: #ff0000; } + +.graybox { + border-collapse: collapse; + width: 100%; } + .graybox p { + margin: 0; + word-break: break-word; + min-width: 50px; } + .graybox td { + border: 1px solid #ddd; + padding: 5px 25px 5px 10px; + vertical-align: middle; } + .graybox tr td:first-of-type { + text-align: right; + padding: 7px; + vertical-align: top; + word-break: normal; + width: 40px; } + +.slightly-smaller { + font-size: 0.9em; } + +.footer { + padding: 8px 16px; + background: #444; + color: #ddd; + font-size: 0.8em; } + .footer p { + margin: 8px 0; } + .footer a { + color: #fff; } + +html.dash .header, html.dash .breadcrumbs, html.dash .navigation { + display: none; } + +html.dash .height-container { + display: block; } + +form[role=search] input { + font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif; + font-size: 14px; + line-height: 24px; + padding: 0 10px; + margin: 0; + border: none; + border-radius: 1em; } + .loading form[role=search] input { + background: white url(../img/spinner.gif) center right 4px no-repeat; } + +form[role=search] .tt-menu { + margin: 0; + min-width: 300px; + background: #fbfbfb; + color: #333; + border: 1px solid #ddd; } + +form[role=search] .tt-highlight { + font-weight: bold; } + +form[role=search] .tt-suggestion { + font: 16px/1.7 "Helvetica Neue", Helvetica, Arial, sans-serif; + padding: 0 8px; } + form[role=search] .tt-suggestion span { + display: table-cell; + white-space: nowrap; } + form[role=search] .tt-suggestion .doc-parent-name { + width: 100%; + text-align: right; + font-weight: normal; + font-size: 0.9em; + padding-left: 16px; } + +form[role=search] .tt-suggestion:hover, +form[role=search] .tt-suggestion.tt-cursor { + cursor: pointer; + background-color: #4183c4; + color: #fff; } + +form[role=search] .tt-suggestion:hover .doc-parent-name, +form[role=search] .tt-suggestion.tt-cursor .doc-parent-name { + color: #fff; } diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/custom_rules.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/custom_rules.html new file mode 100644 index 000000000..67dea3cd0 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/custom_rules.html @@ -0,0 +1,354 @@ + + + + custom_rules Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Custom Rules

+ +

Create custom rules by providing a regex string. Optionally specify what syntax kinds to match against, the severity level, and what message to display.

+ +
    +
  • Identifier: custom_rules
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/cyclomatic_complexity.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/cyclomatic_complexity.html new file mode 100644 index 000000000..90566caf8 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/cyclomatic_complexity.html @@ -0,0 +1,439 @@ + + + + cyclomatic_complexity Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Cyclomatic Complexity

+ +

Complexity of function bodies should be limited.

+ +
    +
  • Identifier: cyclomatic_complexity
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: metrics
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +warning + +10 +
    +error + +20 +
    +ignores_case_statements + +false +
  • +
+

Non Triggering Examples

+
func f1() {
+    if true {
+        for _ in 1..5 { }
+    }
+    if false { }
+}
+
+
func f(code: Int) -> Int {
+    switch code {
+    case 0: fallthrough
+    case 1: return 1
+    case 2: return 1
+    case 3: return 1
+    case 4: return 1
+    case 5: return 1
+    case 6: return 1
+    case 7: return 1
+    case 8: return 1
+    default: return 1
+    }
+}
+
+
func f1() {
+    if true {}; if true {}; if true {}; if true {}; if true {}; if true {}
+    func f2() {
+        if true {}; if true {}; if true {}; if true {}; if true {}
+    }
+}
+
+

Triggering Examples

+
↓func f1() {
+    if true {
+        if true {
+            if false {}
+        }
+    }
+    if false {}
+    let i = 0
+    switch i {
+        case 1: break
+        case 2: break
+        case 3: break
+        case 4: break
+        default: break
+    }
+    for _ in 1...5 {
+        guard true else {
+            return
+        }
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/deployment_target.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/deployment_target.html new file mode 100644 index 000000000..e88b7c942 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/deployment_target.html @@ -0,0 +1,514 @@ + + + + deployment_target Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Deployment Target

+ +

Availability checks or attributes shouldn’t be using older versions that are satisfied by the deployment target.

+ +
    +
  • Identifier: deployment_target
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +iOSApplicationExtension_deployment_target + +7.0 +
    +iOS_deployment_target + +7.0 +
    +macOSApplicationExtension_deployment_target + +10.9 +
    +macOS_deployment_target + +10.9 +
    +tvOSApplicationExtension_deployment_target + +9.0 +
    +tvOS_deployment_target + +9.0 +
    +watchOSApplicationExtension_deployment_target + +1.0 +
    +watchOS_deployment_target + +1.0 +
  • +
+

Non Triggering Examples

+
@available(iOS 12.0, *)
+class A {}
+
+
@available(iOSApplicationExtension 13.0, *)
+class A {}
+
+
@available(watchOS 4.0, *)
+class A {}
+
+
@available(watchOSApplicationExtension 4.0, *)
+class A {}
+
+
@available(swift 3.0.2)
+class A {}
+
+
class A {}
+
+
if #available(iOS 10.0, *) {}
+
+
if #available(iOS 10, *) {}
+
+
guard #available(iOS 12.0, *) else { return }
+
+
#if #unavailable(iOS 15.0) {}
+
+
#guard #unavailable(iOS 15.0) {} else { return }
+
+

Triggering Examples

+
↓@available(iOS 6.0, *)
+class A {}
+
+
↓@available(iOSApplicationExtension 6.0, *)
+class A {}
+
+
↓@available(iOS 7.0, *)
+class A {}
+
+
↓@available(iOS 6, *)
+class A {}
+
+
↓@available(iOS 6.0, macOS 10.12, *)
+ class A {}
+
+
↓@available(macOS 10.12, iOS 6.0, *)
+ class A {}
+
+
↓@available(macOS 10.7, *)
+class A {}
+
+
↓@available(macOSApplicationExtension 10.7, *)
+class A {}
+
+
↓@available(OSX 10.7, *)
+class A {}
+
+
↓@available(watchOS 0.9, *)
+class A {}
+
+
↓@available(watchOSApplicationExtension 0.9, *)
+class A {}
+
+
↓@available(tvOS 8, *)
+class A {}
+
+
↓@available(tvOSApplicationExtension 8, *)
+class A {}
+
+
if ↓#available(iOS 6.0, *) {}
+
+
if ↓#available(iOS 6, *) {}
+
+
guard ↓#available(iOS 6.0, *) else { return }
+
+
if ↓#unavailable(iOS 7.0) {}
+
+
if ↓#unavailable(iOS 6.9) {}
+
+
guard ↓#unavailable(iOS 7.0) {} else { return }
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/direct_return.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/direct_return.html new file mode 100644 index 000000000..2f62af37d --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/direct_return.html @@ -0,0 +1,434 @@ + + + + direct_return Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Direct Return

+ +

Directly return the expression instead of assigning it to a variable first

+ +
    +
  • Identifier: direct_return
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func f() -> Int {
+    let b = 2
+    let a = 1
+    return b
+}
+
+
struct S {
+    var a: Int {
+        var b = 1
+        b = 2
+        return b
+    }
+}
+
+
func f() -> Int {
+    let b = 2
+    f()
+    return b
+}
+
+
func f() -> Int {
+    { i in
+        let b = 2
+        return i
+    }(1)
+}
+
+

Triggering Examples

+
func f() -> Int {
+    let ↓b = 2
+    return b
+}
+
+
struct S {
+    var a: Int {
+        var ↓b = 1
+        // comment
+        return b
+    }
+}
+
+
func f() -> Bool {
+    let a = 1, ↓b = true
+    return b
+}
+
+
func f() -> Int {
+    { _ in
+        let ↓b = 2
+        return b
+    }(1)
+}
+
+
func f(i: Int) -> Int {
+    if i > 1 {
+        let ↓a = 2
+        return a
+    } else {
+        let ↓b = 2, a = 1
+        return b
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/discarded_notification_center_observer.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/discarded_notification_center_observer.html new file mode 100644 index 000000000..1c73b3d7a --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/discarded_notification_center_observer.html @@ -0,0 +1,438 @@ + + + + discarded_notification_center_observer Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Discarded Notification Center Observer

+ +

When registering for a notification using a block, the opaque observer that is returned should be stored so it can be removed later

+ +
    +
  • Identifier: discarded_notification_center_observer
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let foo = nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil) { }
+
+
let foo = nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { })
+
+
func foo() -> Any {
+    return nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { })
+}
+
+
func foo() -> Any {
+    nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { })
+}
+
+
var obs: [Any?] = []
+obs.append(nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { }))
+
+
var obs: [String: Any?] = []
+obs["foo"] = nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { })
+
+
var obs: [Any?] = []
+obs.append(nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { }))
+
+
func foo(_ notify: Any) {
+   obs.append(notify)
+}
+foo(nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { }))
+
+
var obs: [NSObjectProtocol] = [
+   nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { }),
+   nc.addObserver(forName: .CKAccountChanged, object: nil, queue: nil, using: { })
+]
+
+
names.map { self.notificationCenter.addObserver(forName: $0, object: object, queue: queue, using: block) }
+
+
f { return nc.addObserver(forName: $0, object: object, queue: queue, using: block) }
+
+

Triggering Examples

+
↓nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil) { }
+
+
_ = ↓nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil) { }
+
+
↓nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { })
+
+
@discardableResult func foo() -> Any {
+   return ↓nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { })
+}
+
+
class C {
+    var i: Int {
+        set { ↓notificationCenter.addObserver(forName: $0, object: object, queue: queue, using: block) }
+        get {
+            ↓notificationCenter.addObserver(forName: $0, object: object, queue: queue, using: block)
+            return 2
+        }
+    }
+}
+
+
f {
+    ↓nc.addObserver(forName: $0, object: object, queue: queue) {}
+    return 2
+}
+
+
func foo() -> Any {
+    if cond {
+        ↓nc.addObserver(forName: .NSSystemTimeZoneDidChange, object: nil, queue: nil, using: { })
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/discouraged_assert.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/discouraged_assert.html new file mode 100644 index 000000000..33c405cac --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/discouraged_assert.html @@ -0,0 +1,390 @@ + + + + discouraged_assert Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Discouraged Assert

+ +

Prefer assertionFailure() and/or preconditionFailure() over assert(false)

+ +
    +
  • Identifier: discouraged_assert
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
assert(true)
+
+
assert(true, "foobar")
+
+
assert(true, "foobar", file: "toto", line: 42)
+
+
assert(false || true)
+
+
XCTAssert(false)
+
+

Triggering Examples

+
↓assert(false)
+
+
↓assert(false, "foobar")
+
+
↓assert(false, "foobar", file: "toto", line: 42)
+
+
↓assert(   false    , "foobar")
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/discouraged_direct_init.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/discouraged_direct_init.html new file mode 100644 index 000000000..46fcde286 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/discouraged_direct_init.html @@ -0,0 +1,422 @@ + + + + discouraged_direct_init Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Discouraged Direct Initialization

+ +

Discouraged direct initialization of types that can be harmful

+ +
    +
  • Identifier: discouraged_direct_init
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +types + +[“Bundle”, “Bundle.init”, “NSError”, “NSError.init”, “UIDevice”, “UIDevice.init”] +
  • +
+

Non Triggering Examples

+
let foo = UIDevice.current
+
+
let foo = Bundle.main
+
+
let foo = Bundle(path: "bar")
+
+
let foo = Bundle(identifier: "bar")
+
+
let foo = Bundle.init(path: "bar")
+
+
let foo = Bundle.init(identifier: "bar")
+
+
let foo = NSError(domain: "bar", code: 0)
+
+
let foo = NSError.init(domain: "bar", code: 0)
+
+
func testNSError()
+
+

Triggering Examples

+
↓UIDevice()
+
+
↓Bundle()
+
+
let foo = ↓UIDevice()
+
+
let foo = ↓Bundle()
+
+
let foo = ↓NSError()
+
+
let foo = bar(bundle: ↓Bundle(), device: ↓UIDevice(), error: ↓NSError())
+
+
↓UIDevice.init()
+
+
↓Bundle.init()
+
+
↓NSError.init()
+
+
let foo = ↓UIDevice.init()
+
+
let foo = ↓Bundle.init()
+
+
let foo = bar(bundle: ↓Bundle.init(), device: ↓UIDevice.init(), error: ↓NSError.init())
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/discouraged_none_name.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/discouraged_none_name.html new file mode 100644 index 000000000..6fccd8fe2 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/discouraged_none_name.html @@ -0,0 +1,500 @@ + + + + discouraged_none_name Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Discouraged None Name

+ +

Enum cases and static members named none are discouraged as they can conflict with Optional<T>.none.

+ +
    +
  • Identifier: discouraged_none_name
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
enum MyEnum {
+    case nOne
+}
+
+
enum MyEnum {
+    case _none
+}
+
+
enum MyEnum {
+    case none_
+}
+
+
enum MyEnum {
+    case none(Any)
+}
+
+
enum MyEnum {
+    case nonenone
+}
+
+
class MyClass {
+    class var nonenone: MyClass { MyClass() }
+}
+
+
class MyClass {
+    static var nonenone = MyClass()
+}
+
+
class MyClass {
+    static let nonenone = MyClass()
+}
+
+
struct MyStruct {
+    static var nonenone = MyStruct()
+}
+
+
struct MyStruct {
+    static let nonenone = MyStruct()
+}
+
+
struct MyStruct {
+    let none = MyStruct()
+}
+
+
struct MyStruct {
+    var none = MyStruct()
+}
+
+
class MyClass {
+    let none = MyClass()
+}
+
+
class MyClass {
+    var none = MyClass()
+}
+
+

Triggering Examples

+
enum MyEnum {
+    case ↓none
+}
+
+
enum MyEnum {
+    case a, ↓none
+}
+
+
enum MyEnum {
+    case ↓none, b
+}
+
+
enum MyEnum {
+    case a, ↓none, b
+}
+
+
enum MyEnum {
+    case a
+    case ↓none
+}
+
+
enum MyEnum {
+    case ↓none
+    case b
+}
+
+
enum MyEnum {
+    case a
+    case ↓none
+    case b
+}
+
+
class MyClass {
+    ↓static let none = MyClass()
+}
+
+
class MyClass {
+    ↓static let none: MyClass = MyClass()
+}
+
+
class MyClass {
+    ↓static var none: MyClass = MyClass()
+}
+
+
class MyClass {
+    ↓class var none: MyClass { MyClass() }
+}
+
+
struct MyStruct {
+    ↓static var none = MyStruct()
+}
+
+
struct MyStruct {
+    ↓static var none: MyStruct = MyStruct()
+}
+
+
struct MyStruct {
+    ↓static var none = MyStruct()
+}
+
+
struct MyStruct {
+    ↓static var none: MyStruct = MyStruct()
+}
+
+
struct MyStruct {
+    ↓static var a = MyStruct(), none = MyStruct()
+}
+
+
struct MyStruct {
+    ↓static var none = MyStruct(), a = MyStruct()
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/discouraged_object_literal.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/discouraged_object_literal.html new file mode 100644 index 000000000..317c8b2ee --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/discouraged_object_literal.html @@ -0,0 +1,404 @@ + + + + discouraged_object_literal Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Discouraged Object Literal

+ +

Prefer initializers over object literals

+ +
    +
  • Identifier: discouraged_object_literal
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +image_literal + +true +
    +color_literal + +true +
  • +
+

Non Triggering Examples

+
let image = UIImage(named: aVariable)
+
+
let image = UIImage(named: "interpolated \(variable)")
+
+
let color = UIColor(red: value, green: value, blue: value, alpha: 1)
+
+
let image = NSImage(named: aVariable)
+
+
let image = NSImage(named: "interpolated \(variable)")
+
+
let color = NSColor(red: value, green: value, blue: value, alpha: 1)
+
+

Triggering Examples

+
let image = ↓#imageLiteral(resourceName: "image.jpg")
+
+
let color = ↓#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/discouraged_optional_boolean.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/discouraged_optional_boolean.html new file mode 100644 index 000000000..47c4ea333 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/discouraged_optional_boolean.html @@ -0,0 +1,756 @@ + + + + discouraged_optional_boolean Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Discouraged Optional Boolean

+ +

Prefer non-optional booleans over optional booleans

+ +
    +
  • Identifier: discouraged_optional_boolean
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
var foo: Bool
+
+
var foo: [String: Bool]
+
+
var foo: [Bool]
+
+
let foo: Bool = true
+
+
let foo: Bool = false
+
+
let foo: [String: Bool] = [:]
+
+
let foo: [Bool] = []
+
+
var foo: Bool { return true }
+
+
let foo: Bool { return false }()
+
+
func foo() -> Bool {}
+
+
func foo() -> [String: Bool] {}
+
+
func foo() -> ([Bool]) -> String {}
+
+
func foo(input: Bool = true) {}
+
+
func foo(input: [String: Bool] = [:]) {}
+
+
func foo(input: [Bool] = []) {}
+
+
class Foo {
+    func foo() -> Bool {}
+}
+
+
class Foo {
+    func foo() -> [String: Bool] {}
+}
+
+
class Foo {
+    func foo() -> ([Bool]) -> String {}
+}
+
+
struct Foo {
+    func foo() -> Bool {}
+}
+
+
struct Foo {
+    func foo() -> [String: Bool] {}
+}
+
+
struct Foo {
+    func foo() -> ([Bool]) -> String {}
+}
+
+
enum Foo {
+    func foo() -> Bool {}
+}
+
+
enum Foo {
+    func foo() -> [String: Bool] {}
+}
+
+
enum Foo {
+    func foo() -> ([Bool]) -> String {}
+}
+
+
class Foo {
+    func foo(input: Bool = true) {}
+}
+
+
class Foo {
+    func foo(input: [String: Bool] = [:]) {}
+}
+
+
class Foo {
+    func foo(input: [Bool] = []) {}
+}
+
+
struct Foo {
+    func foo(input: Bool = true) {}
+}
+
+
struct Foo {
+    func foo(input: [String: Bool] = [:]) {}
+}
+
+
struct Foo {
+    func foo(input: [Bool] = []) {}
+}
+
+
enum Foo {
+    func foo(input: Bool = true) {}
+}
+
+
enum Foo {
+    func foo(input: [String: Bool] = [:]) {}
+}
+
+
enum Foo {
+    func foo(input: [Bool] = []) {}
+}
+
+

Triggering Examples

+
var foo: ↓Bool?
+
+
var foo: [String: ↓Bool?]
+
+
var foo: [↓Bool?]
+
+
let foo: ↓Bool? = nil
+
+
let foo: [String: ↓Bool?] = [:]
+
+
let foo: [↓Bool?] = []
+
+
let foo = ↓Optional.some(false)
+
+
let foo = ↓Optional.some(true)
+
+
var foo: ↓Bool? { return nil }
+
+
let foo: ↓Bool? { return nil }()
+
+
func foo() -> ↓Bool? {}
+
+
func foo() -> [String: ↓Bool?] {}
+
+
func foo() -> [↓Bool?] {}
+
+
static func foo() -> ↓Bool? {}
+
+
static func foo() -> [String: ↓Bool?] {}
+
+
static func foo() -> [↓Bool?] {}
+
+
func foo() -> (↓Bool?) -> String {}
+
+
func foo() -> ([Int]) -> ↓Bool? {}
+
+
func foo(input: ↓Bool?) {}
+
+
func foo(input: [String: ↓Bool?]) {}
+
+
func foo(input: [↓Bool?]) {}
+
+
static func foo(input: ↓Bool?) {}
+
+
static func foo(input: [String: ↓Bool?]) {}
+
+
static func foo(input: [↓Bool?]) {}
+
+
class Foo {
+    var foo: ↓Bool?
+}
+
+
class Foo {
+    var foo: [String: ↓Bool?]
+}
+
+
class Foo {
+    let foo: ↓Bool? = nil
+}
+
+
class Foo {
+    let foo: [String: ↓Bool?] = [:]
+}
+
+
class Foo {
+    let foo: [↓Bool?] = []
+}
+
+
struct Foo {
+    var foo: ↓Bool?
+}
+
+
struct Foo {
+    var foo: [String: ↓Bool?]
+}
+
+
struct Foo {
+    let foo: ↓Bool? = nil
+}
+
+
struct Foo {
+    let foo: [String: ↓Bool?] = [:]
+}
+
+
struct Foo {
+    let foo: [↓Bool?] = []
+}
+
+
class Foo {
+    var foo: ↓Bool? { return nil }
+}
+
+
class Foo {
+    let foo: ↓Bool? { return nil }()
+}
+
+
struct Foo {
+    var foo: ↓Bool? { return nil }
+}
+
+
struct Foo {
+    let foo: ↓Bool? { return nil }()
+}
+
+
enum Foo {
+    var foo: ↓Bool? { return nil }
+}
+
+
enum Foo {
+    let foo: ↓Bool? { return nil }()
+}
+
+
class Foo {
+    func foo() -> ↓Bool? {}
+}
+
+
class Foo {
+    func foo() -> [String: ↓Bool?] {}
+}
+
+
class Foo {
+    func foo() -> [↓Bool?] {}
+}
+
+
class Foo {
+    static func foo() -> ↓Bool? {}
+}
+
+
class Foo {
+    static func foo() -> [String: ↓Bool?] {}
+}
+
+
class Foo {
+    static func foo() -> [↓Bool?] {}
+}
+
+
class Foo {
+    func foo() -> (↓Bool?) -> String {}
+}
+
+
class Foo {
+    func foo() -> ([Int]) -> ↓Bool? {}
+}
+
+
struct Foo {
+    func foo() -> ↓Bool? {}
+}
+
+
struct Foo {
+    func foo() -> [String: ↓Bool?] {}
+}
+
+
struct Foo {
+    func foo() -> [↓Bool?] {}
+}
+
+
struct Foo {
+    static func foo() -> ↓Bool? {}
+}
+
+
struct Foo {
+    static func foo() -> [String: ↓Bool?] {}
+}
+
+
struct Foo {
+    static func foo() -> [↓Bool?] {}
+}
+
+
struct Foo {
+    func foo() -> (↓Bool?) -> String {}
+}
+
+
struct Foo {
+    func foo() -> ([Int]) -> ↓Bool? {}
+}
+
+
enum Foo {
+    func foo() -> ↓Bool? {}
+}
+
+
enum Foo {
+    func foo() -> [String: ↓Bool?] {}
+}
+
+
enum Foo {
+    func foo() -> [↓Bool?] {}
+}
+
+
enum Foo {
+    static func foo() -> ↓Bool? {}
+}
+
+
enum Foo {
+    static func foo() -> [String: ↓Bool?] {}
+}
+
+
enum Foo {
+    static func foo() -> [↓Bool?] {}
+}
+
+
enum Foo {
+    func foo() -> (↓Bool?) -> String {}
+}
+
+
enum Foo {
+    func foo() -> ([Int]) -> ↓Bool? {}
+}
+
+
class Foo {
+    func foo(input: ↓Bool?) {}
+}
+
+
class Foo {
+    func foo(input: [String: ↓Bool?]) {}
+}
+
+
class Foo {
+    func foo(input: [↓Bool?]) {}
+}
+
+
class Foo {
+    static func foo(input: ↓Bool?) {}
+}
+
+
class Foo {
+    static func foo(input: [String: ↓Bool?]) {}
+}
+
+
class Foo {
+    static func foo(input: [↓Bool?]) {}
+}
+
+
struct Foo {
+    func foo(input: ↓Bool?) {}
+}
+
+
struct Foo {
+    func foo(input: [String: ↓Bool?]) {}
+}
+
+
struct Foo {
+    func foo(input: [↓Bool?]) {}
+}
+
+
struct Foo {
+    static func foo(input: ↓Bool?) {}
+}
+
+
struct Foo {
+    static func foo(input: [String: ↓Bool?]) {}
+}
+
+
struct Foo {
+    static func foo(input: [↓Bool?]) {}
+}
+
+
enum Foo {
+    func foo(input: ↓Bool?) {}
+}
+
+
enum Foo {
+    func foo(input: [String: ↓Bool?]) {}
+}
+
+
enum Foo {
+    func foo(input: [↓Bool?]) {}
+}
+
+
enum Foo {
+    static func foo(input: ↓Bool?) {}
+}
+
+
enum Foo {
+    static func foo(input: [String: ↓Bool?]) {}
+}
+
+
enum Foo {
+    static func foo(input: [↓Bool?]) {}
+}
+
+
_ = ↓Bool?.values()
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/discouraged_optional_collection.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/discouraged_optional_collection.html new file mode 100644 index 000000000..ac1cd2e3e --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/discouraged_optional_collection.html @@ -0,0 +1,936 @@ + + + + discouraged_optional_collection Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Discouraged Optional Collection

+ +

Prefer empty collection over optional collection

+ +
    +
  • Identifier: discouraged_optional_collection
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
var foo: [Int]
+
+
var foo: [String: Int]
+
+
var foo: Set<String>
+
+
var foo: [String: [String: Int]]
+
+
let foo: [Int] = []
+
+
let foo: [String: Int] = [:]
+
+
let foo: Set<String> = []
+
+
let foo: [String: [String: Int]] = [:]
+
+
var foo: [Int] { return [] }
+
+
func foo() -> [Int] {}
+
+
func foo() -> [String: String] {}
+
+
func foo() -> Set<Int> {}
+
+
func foo() -> ([Int]) -> String {}
+
+
func foo(input: [String] = []) {}
+
+
func foo(input: [String: String] = [:]) {}
+
+
func foo(input: Set<String> = []) {}
+
+
class Foo {
+    func foo() -> [Int] {}
+}
+
+
class Foo {
+    func foo() -> [String: String] {}
+}
+
+
class Foo {
+    func foo() -> Set<Int> {}
+}
+
+
class Foo {
+    func foo() -> ([Int]) -> String {}
+}
+
+
struct Foo {
+    func foo() -> [Int] {}
+}
+
+
struct Foo {
+    func foo() -> [String: String] {}
+}
+
+
struct Foo {
+    func foo() -> Set<Int> {}
+}
+
+
struct Foo {
+    func foo() -> ([Int]) -> String {}
+}
+
+
enum Foo {
+    func foo() -> [Int] {}
+}
+
+
enum Foo {
+    func foo() -> [String: String] {}
+}
+
+
enum Foo {
+    func foo() -> Set<Int> {}
+}
+
+
enum Foo {
+    func foo() -> ([Int]) -> String {}
+}
+
+
class Foo {
+    func foo(input: [String] = []) {}
+}
+
+
class Foo {
+    func foo(input: [String: String] = [:]) {}
+}
+
+
class Foo {
+    func foo(input: Set<String> = []) {}
+}
+
+
struct Foo {
+    func foo(input: [String] = []) {}
+}
+
+
struct Foo {
+    func foo(input: [String: String] = [:]) {}
+}
+
+
struct Foo {
+    func foo(input: Set<String> = []) {}
+}
+
+
enum Foo {
+    func foo(input: [String] = []) {}
+}
+
+
enum Foo {
+    func foo(input: [String: String] = [:]) {}
+}
+
+
enum Foo {
+    func foo(input: Set<String> = []) {}
+}
+
+

Triggering Examples

+
var foo: ↓[Int]?
+
+
var foo: ↓[String: Int]?
+
+
var foo: ↓Set<String>?
+
+
let foo: ↓[Int]? = nil
+
+
let foo: ↓[String: Int]? = nil
+
+
let foo: ↓Set<String>? = nil
+
+
var foo: ↓[Int]? { return nil }
+
+
let foo: ↓[Int]? { return nil }()
+
+
func foo() -> ↓[T]? {}
+
+
func foo() -> ↓[String: String]? {}
+
+
func foo() -> ↓[String: [String: String]]? {}
+
+
func foo() -> [String: ↓[String: String]?] {}
+
+
func foo() -> ↓Set<Int>? {}
+
+
static func foo() -> ↓[T]? {}
+
+
static func foo() -> ↓[String: String]? {}
+
+
static func foo() -> ↓[String: [String: String]]? {}
+
+
static func foo() -> [String: ↓[String: String]?] {}
+
+
static func foo() -> ↓Set<Int>? {}
+
+
func foo() -> (↓[Int]?) -> String {}
+
+
func foo() -> ([Int]) -> ↓[String]? {}
+
+
func foo(input: ↓[String: String]?) {}
+
+
func foo(input: ↓[String: [String: String]]?) {}
+
+
func foo(input: [String: ↓[String: String]?]) {}
+
+
func foo(input: ↓[String: ↓[String: String]?]?) {}
+
+
func foo<K, V>(_ dict1: [K: V], _ dict2: ↓[K: V]?) -> [K: V]
+
+
func foo<K, V>(dict1: [K: V], dict2: ↓[K: V]?) -> [K: V]
+
+
static func foo(input: ↓[String: String]?) {}
+
+
static func foo(input: ↓[String: [String: String]]?) {}
+
+
static func foo(input: [String: ↓[String: String]?]) {}
+
+
static func foo(input: ↓[String: ↓[String: String]?]?) {}
+
+
static func foo<K, V>(_ dict1: [K: V], _ dict2: ↓[K: V]?) -> [K: V]
+
+
static func foo<K, V>(dict1: [K: V], dict2: ↓[K: V]?) -> [K: V]
+
+
class Foo {
+    var foo: ↓[Int]?
+}
+
+
class Foo {
+    var foo: ↓[String: Int]?
+}
+
+
class Foo {
+    var foo: ↓Set<String>?
+}
+
+
class Foo {
+    let foo: ↓[Int]? = nil
+}
+
+
class Foo {
+    let foo: ↓[String: Int]? = nil
+}
+
+
class Foo {
+    let foo: ↓Set<String>? = nil
+}
+
+
struct Foo {
+    var foo: ↓[Int]?
+}
+
+
struct Foo {
+    var foo: ↓[String: Int]?
+}
+
+
struct Foo {
+    var foo: ↓Set<String>?
+}
+
+
struct Foo {
+    let foo: ↓[Int]? = nil
+}
+
+
struct Foo {
+    let foo: ↓[String: Int]? = nil
+}
+
+
struct Foo {
+    let foo: ↓Set<String>? = nil
+}
+
+
class Foo {
+    var foo: ↓[Int]? { return nil }
+}
+
+
class Foo {
+    let foo: ↓[Int]? { return nil }()
+}
+
+
class Foo {
+    var foo: ↓Set<String>? { return nil }
+}
+
+
class Foo {
+    let foo: ↓Set<String>? { return nil }()
+}
+
+
struct Foo {
+    var foo: ↓[Int]? { return nil }
+}
+
+
struct Foo {
+    let foo: ↓[Int]? { return nil }()
+}
+
+
struct Foo {
+    var foo: ↓Set<String>? { return nil }
+}
+
+
struct Foo {
+    let foo: ↓Set<String>? { return nil }()
+}
+
+
enum Foo {
+    var foo: ↓[Int]? { return nil }
+}
+
+
enum Foo {
+    let foo: ↓[Int]? { return nil }()
+}
+
+
enum Foo {
+    var foo: ↓Set<String>? { return nil }
+}
+
+
enum Foo {
+    let foo: ↓Set<String>? { return nil }()
+}
+
+
class Foo {
+    func foo() -> [T]? {}
+}
+
+
class Foo {
+    func foo() -> ↓[String: String]? {}
+}
+
+
class Foo {
+    func foo() -> [String: [String: String]]? {}
+}
+
+
class Foo {
+    func foo() -> [String: ↓[String: String]?] {}
+}
+
+
class Foo {
+    func foo() -> Set<Int>? {}
+}
+
+
class Foo {
+    static func foo() -> [T]? {}
+}
+
+
class Foo {
+    static func foo() -> ↓[String: String]? {}
+}
+
+
class Foo {
+    static func foo() -> [String: [String: String]]? {}
+}
+
+
class Foo {
+    static func foo() -> [String: ↓[String: String]?] {}
+}
+
+
class Foo {
+    static func foo() -> Set<Int>? {}
+}
+
+
class Foo {
+    func foo() -> ([Int]?) -> String {}
+}
+
+
class Foo {
+    func foo() -> ([Int]) -> [String]? {}
+}
+
+
struct Foo {
+    func foo() -> [T]? {}
+}
+
+
struct Foo {
+    func foo() -> ↓[String: String]? {}
+}
+
+
struct Foo {
+    func foo() -> [String: [String: String]]? {}
+}
+
+
struct Foo {
+    func foo() -> [String: ↓[String: String]?] {}
+}
+
+
struct Foo {
+    func foo() -> Set<Int>? {}
+}
+
+
struct Foo {
+    static func foo() -> [T]? {}
+}
+
+
struct Foo {
+    static func foo() -> ↓[String: String]? {}
+}
+
+
struct Foo {
+    static func foo() -> [String: [String: String]]? {}
+}
+
+
struct Foo {
+    static func foo() -> [String: ↓[String: String]?] {}
+}
+
+
struct Foo {
+    static func foo() -> Set<Int>? {}
+}
+
+
struct Foo {
+    func foo() -> ([Int]?) -> String {}
+}
+
+
struct Foo {
+    func foo() -> ([Int]) -> [String]? {}
+}
+
+
enum Foo {
+    func foo() -> [T]? {}
+}
+
+
enum Foo {
+    func foo() -> ↓[String: String]? {}
+}
+
+
enum Foo {
+    func foo() -> [String: [String: String]]? {}
+}
+
+
enum Foo {
+    func foo() -> [String: ↓[String: String]?] {}
+}
+
+
enum Foo {
+    func foo() -> Set<Int>? {}
+}
+
+
enum Foo {
+    static func foo() -> [T]? {}
+}
+
+
enum Foo {
+    static func foo() -> ↓[String: String]? {}
+}
+
+
enum Foo {
+    static func foo() -> [String: [String: String]]? {}
+}
+
+
enum Foo {
+    static func foo() -> [String: ↓[String: String]?] {}
+}
+
+
enum Foo {
+    static func foo() -> Set<Int>? {}
+}
+
+
enum Foo {
+    func foo() -> ([Int]?) -> String {}
+}
+
+
enum Foo {
+    func foo() -> ([Int]) -> [String]? {}
+}
+
+
class Foo {
+    func foo(input: ↓[String: String]?) {}
+}
+
+
class Foo {
+    func foo(input: ↓[String: [String: String]]?) {}
+}
+
+
class Foo {
+    func foo(input: [String: ↓[String: String]?]) {}
+}
+
+
class Foo {
+    func foo(input: ↓[String: ↓[String: String]?]?) {}
+}
+
+
class Foo {
+    func foo<K, V>(_ dict1: [K: V], _ dict2: ↓[K: V]?) -> [K: V]
+}
+
+
class Foo {
+    func foo<K, V>(dict1: [K: V], dict2: ↓[K: V]?) -> [K: V]
+}
+
+
class Foo {
+    static func foo(input: ↓[String: String]?) {}
+}
+
+
class Foo {
+    static func foo(input: ↓[String: [String: String]]?) {}
+}
+
+
class Foo {
+    static func foo(input: [String: ↓[String: String]?]) {}
+}
+
+
class Foo {
+    static func foo(input: ↓[String: ↓[String: String]?]?) {}
+}
+
+
class Foo {
+    static func foo<K, V>(_ dict1: [K: V], _ dict2: ↓[K: V]?) -> [K: V]
+}
+
+
class Foo {
+    static func foo<K, V>(dict1: [K: V], dict2: ↓[K: V]?) -> [K: V]
+}
+
+
struct Foo {
+    func foo(input: ↓[String: String]?) {}
+}
+
+
struct Foo {
+    func foo(input: ↓[String: [String: String]]?) {}
+}
+
+
struct Foo {
+    func foo(input: [String: ↓[String: String]?]) {}
+}
+
+
struct Foo {
+    func foo(input: ↓[String: ↓[String: String]?]?) {}
+}
+
+
struct Foo {
+    func foo<K, V>(_ dict1: [K: V], _ dict2: ↓[K: V]?) -> [K: V]
+}
+
+
struct Foo {
+    func foo<K, V>(dict1: [K: V], dict2: ↓[K: V]?) -> [K: V]
+}
+
+
struct Foo {
+    static func foo(input: ↓[String: String]?) {}
+}
+
+
struct Foo {
+    static func foo(input: ↓[String: [String: String]]?) {}
+}
+
+
struct Foo {
+    static func foo(input: [String: ↓[String: String]?]) {}
+}
+
+
struct Foo {
+    static func foo(input: ↓[String: ↓[String: String]?]?) {}
+}
+
+
struct Foo {
+    static func foo<K, V>(_ dict1: [K: V], _ dict2: ↓[K: V]?) -> [K: V]
+}
+
+
struct Foo {
+    static func foo<K, V>(dict1: [K: V], dict2: ↓[K: V]?) -> [K: V]
+}
+
+
enum Foo {
+    func foo(input: ↓[String: String]?) {}
+}
+
+
enum Foo {
+    func foo(input: ↓[String: [String: String]]?) {}
+}
+
+
enum Foo {
+    func foo(input: [String: ↓[String: String]?]) {}
+}
+
+
enum Foo {
+    func foo(input: ↓[String: ↓[String: String]?]?) {}
+}
+
+
enum Foo {
+    func foo<K, V>(_ dict1: [K: V], _ dict2: ↓[K: V]?) -> [K: V]
+}
+
+
enum Foo {
+    func foo<K, V>(dict1: [K: V], dict2: ↓[K: V]?) -> [K: V]
+}
+
+
enum Foo {
+    static func foo(input: ↓[String: String]?) {}
+}
+
+
enum Foo {
+    static func foo(input: ↓[String: [String: String]]?) {}
+}
+
+
enum Foo {
+    static func foo(input: [String: ↓[String: String]?]) {}
+}
+
+
enum Foo {
+    static func foo(input: ↓[String: ↓[String: String]?]?) {}
+}
+
+
enum Foo {
+    static func foo<K, V>(_ dict1: [K: V], _ dict2: ↓[K: V]?) -> [K: V]
+}
+
+
enum Foo {
+    static func foo<K, V>(dict1: [K: V], dict2: ↓[K: V]?) -> [K: V]
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/duplicate_conditions.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/duplicate_conditions.html new file mode 100644 index 000000000..42b549463 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/duplicate_conditions.html @@ -0,0 +1,494 @@ + + + + duplicate_conditions Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Duplicate Conditions

+ +

Duplicate sets of conditions in the same branch instruction should be avoided

+ +
    +
  • Identifier: duplicate_conditions
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +error +
  • +
+

Non Triggering Examples

+
if x < 5 {
+    foo()
+} else if y == "s" {
+    bar()
+}
+
+
if x < 5 {
+    foo()
+}
+if x < 5 {
+    bar()
+}
+
+
if x < 5, y == "s" {
+    foo()
+} else if x < 5 {
+    bar()
+}
+
+
switch x {
+case "a":
+    foo()
+    bar()
+}
+
+
switch x {
+case "a" where y == "s":
+    foo()
+case "a" where y == "t":
+    bar()
+}
+
+
if let x = maybeAbc {
+    foo()
+} else if let x = maybePqr {
+    bar()
+}
+
+
if let x = maybeAbc, let z = x.maybeY {
+    foo()
+} else if let x = maybePqr, let z = x.maybeY {
+    bar()
+}
+
+
if case .p = x {
+    foo()
+} else if case .q = x {
+    bar()
+}
+
+
if true {
+    if true { foo() }
+}
+
+

Triggering Examples

+
if ↓x < 5 {
+    foo()
+} else if y == "s" {
+    bar()
+} else if ↓x < 5 {
+    baz()
+}
+
+
if z {
+    if ↓x < 5 {
+        foo()
+    } else if y == "s" {
+        bar()
+    } else if ↓x < 5 {
+        baz()
+    }
+}
+
+
if ↓x < 5, y == "s" {
+    foo()
+} else if x < 10 {
+    bar()
+} else if ↓y == "s", x < 5 {
+    baz()
+}
+
+
switch x {
+case ↓"a", "b":
+    foo()
+case "c", ↓"a":
+    bar()
+}
+
+
switch x {
+case ↓"a" where y == "s":
+    foo()
+case ↓"a" where y == "s":
+    bar()
+}
+
+
if ↓let xyz = maybeXyz {
+    foo()
+} else if ↓let xyz = maybeXyz {
+    bar()
+}
+
+
if ↓let x = maybeAbc, let z = x.maybeY {
+    foo()
+} else if ↓let x = maybeAbc, let z = x.maybeY {
+    bar()
+}
+
+
if ↓#available(macOS 10.15, *) {
+    foo()
+} else if ↓#available(macOS 10.15, *) {
+    bar()
+}
+
+
if ↓case .p = x {
+    foo()
+} else if ↓case .p = x {
+    bar()
+}
+
+
if ↓x < 5 {}
+else if ↓x < 5 {}
+else if ↓x < 5 {}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/duplicate_enum_cases.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/duplicate_enum_cases.html new file mode 100644 index 000000000..faae28f5b --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/duplicate_enum_cases.html @@ -0,0 +1,408 @@ + + + + duplicate_enum_cases Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Duplicate Enum Cases

+ +

Enum shouldn’t contain multiple cases with the same name

+ +
    +
  • Identifier: duplicate_enum_cases
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +error +
  • +
+

Non Triggering Examples

+
enum PictureImport {
+    case addImage(image: UIImage)
+    case addData(data: Data)
+}
+
+
enum A {
+    case add(image: UIImage)
+}
+enum B {
+    case add(image: UIImage)
+}
+
+
enum Tag: String {
+#if CONFIG_A
+    case value = "CONFIG_A"
+#elseif CONFIG_B
+    case value = "CONFIG_B"
+#else
+    case value = "CONFIG_DEFAULT"
+#endif
+}
+
+
enum Target {
+#if os(iOS)
+  case file
+#else
+  case file(URL)
+#endif
+}
+
+

Triggering Examples

+
enum PictureImport {
+    case ↓add(image: UIImage)
+    case addURL(url: URL)
+    case ↓add(data: Data)
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/duplicate_imports.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/duplicate_imports.html new file mode 100644 index 000000000..8cc1dd064 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/duplicate_imports.html @@ -0,0 +1,479 @@ + + + + duplicate_imports Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Duplicate Imports

+ +

Imports should be unique

+ +
    +
  • Identifier: duplicate_imports
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
import A
+import B
+import C
+
+
import A.B
+import A.C
+
+
@_implementationOnly import A
+@_implementationOnly import B
+
+
@testable import A
+@testable import B
+
+
#if DEBUG
+    @testable import KsApi
+#else
+    import KsApi
+#endif
+
+
import A // module
+import B // module
+
+
#if TEST
+func test() {
+}
+
+
import Foo
+@testable import struct Foo.Bar
+
+

Triggering Examples

+
@_implementationOnly import A
+↓@_implementationOnly import A
+
+
+
@testable import A
+↓@testable import A
+
+
+
@testable import Foo
+import struct Foo.Bar
+
+
import A
+#if DEBUG
+    @testable import KsApi
+#else
+    import KsApi
+#endif
+↓import A
+
+
+
import A
+↓import class A.Foo
+
+
+
import A
+↓import enum A.Foo
+
+
+
import A
+↓import func A.Foo
+
+
+
import A
+↓import let A.Foo
+
+
+
import A
+↓import protocol A.Foo
+
+
+
import A
+↓import struct A.Foo
+
+
+
import A
+↓import typealias A.Foo
+
+
+
import A
+↓import var A.Foo
+
+
+
import A.B
+↓import A.B.C
+
+
+
import Foundation
+import Dispatch
+↓import Foundation
+
+
+
import Foundation
+↓import Foundation
+↓import Foundation
+
+
+
import Foundation
+↓import Foundation.NSString
+
+
+
↓import A.B.C
+import A.B
+
+
+
↓import Foundation.NSString
+import Foundation
+
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/duplicated_key_in_dictionary_literal.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/duplicated_key_in_dictionary_literal.html new file mode 100644 index 000000000..5b4bb2ffd --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/duplicated_key_in_dictionary_literal.html @@ -0,0 +1,426 @@ + + + + duplicated_key_in_dictionary_literal Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Duplicated Key in Dictionary Literal

+ +

Dictionary literals with duplicated keys will crash at runtime

+ +
    +
  • Identifier: duplicated_key_in_dictionary_literal
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
[
+    1: "1",
+    2: "2"
+]
+
+
[
+    "1": 1,
+    "2": 2
+]
+
+
[
+    foo: "1",
+    bar: "2"
+]
+
+
[
+    UUID(): "1",
+    UUID(): "2"
+]
+
+
[
+    #line: "1",
+    #line: "2"
+]
+
+

Triggering Examples

+
[
+    1: "1",
+    2: "2",
+    ↓1: "one"
+]
+
+
[
+    "1": 1,
+    "2": 2,
+    ↓"2": 2
+]
+
+
[
+    foo: "1",
+    bar: "2",
+    baz: "3",
+    ↓foo: "4",
+    zaz: "5"
+]
+
+
[
+    .one: "1",
+    .two: "2",
+    .three: "3",
+    ↓.one: "1",
+    .four: "4",
+    .five: "5"
+]
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/dynamic_inline.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/dynamic_inline.html new file mode 100644 index 000000000..dcf2b2baf --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/dynamic_inline.html @@ -0,0 +1,404 @@ + + + + dynamic_inline Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Dynamic Inline

+ +

Avoid using ‘dynamic’ and ‘@inline(__always)’ together

+ +
    +
  • Identifier: dynamic_inline
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +error +
  • +
+

Non Triggering Examples

+
class C {
+dynamic func f() {}}
+
+
class C {
+@inline(__always) func f() {}}
+
+
class C {
+@inline(never) dynamic func f() {}}
+
+

Triggering Examples

+
class C {
+@inline(__always) dynamic ↓func f() {}
+}
+
+
class C {
+@inline(__always) public dynamic ↓func f() {}
+}
+
+
class C {
+@inline(__always) dynamic internal ↓func f() {}
+}
+
+
class C {
+@inline(__always)
+dynamic ↓func f() {}
+}
+
+
class C {
+@inline(__always)
+dynamic
+↓func f() {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/empty_collection_literal.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/empty_collection_literal.html new file mode 100644 index 000000000..38605f22b --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/empty_collection_literal.html @@ -0,0 +1,396 @@ + + + + empty_collection_literal Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Empty Collection Literal

+ +

Prefer checking isEmpty over comparing collection to an empty array or dictionary literal

+ +
    +
  • Identifier: empty_collection_literal
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
myArray = []
+
+
myArray.isEmpty
+
+
!myArray.isEmpty
+
+
myDict = [:]
+
+

Triggering Examples

+
myArray↓ == []
+
+
myArray↓ != []
+
+
myArray↓ == [ ]
+
+
myDict↓ == [:]
+
+
myDict↓ != [:]
+
+
myDict↓ == [: ]
+
+
myDict↓ == [ :]
+
+
myDict↓ == [ : ]
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/empty_count.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/empty_count.html new file mode 100644 index 000000000..04b109839 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/empty_count.html @@ -0,0 +1,422 @@ + + + + empty_count Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Empty Count

+ +

Prefer checking isEmpty over comparing count to zero

+ +
    +
  • Identifier: empty_count
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +error +
    +only_after_dot + +false +
  • +
+

Non Triggering Examples

+
var count = 0
+
+
[Int]().isEmpty
+
+
[Int]().count > 1
+
+
[Int]().count == 1
+
+
[Int]().count == 0xff
+
+
[Int]().count == 0b01
+
+
[Int]().count == 0o07
+
+
discount == 0
+
+
order.discount == 0
+
+
let rule = #Rule(Tips.Event(id: "someTips")) { $0.donations.count == 0 }
+
+

Triggering Examples

+
[Int]().↓count == 0
+
+
0 == [Int]().↓count
+
+
[Int]().↓count==0
+
+
[Int]().↓count > 0
+
+
[Int]().↓count != 0
+
+
[Int]().↓count == 0x0
+
+
[Int]().↓count == 0x00_00
+
+
[Int]().↓count == 0b00
+
+
[Int]().↓count == 0o00
+
+
↓count == 0
+
+
#ExampleMacro { $0.list.↓count == 0 }
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/empty_enum_arguments.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/empty_enum_arguments.html new file mode 100644 index 000000000..f04129472 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/empty_enum_arguments.html @@ -0,0 +1,487 @@ + + + + empty_enum_arguments Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Empty Enum Arguments

+ +

Arguments can be omitted when matching enums with associated values if they are not used

+ +
    +
  • Identifier: empty_enum_arguments
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
switch foo {
+case .bar: break
+}
+
+
switch foo {
+case .bar(let x): break
+}
+
+
switch foo {
+case let .bar(x): break
+}
+
+
switch (foo, bar) {
+case (_, _): break
+}
+
+
switch foo {
+case "bar".uppercased(): break
+}
+
+
switch (foo, bar) {
+case (_, _) where !something: break
+}
+
+
switch foo {
+case (let f as () -> String)?: break
+}
+
+
switch foo {
+case .bar(Baz()): break
+}
+
+
switch foo {
+case .bar(.init()): break
+}
+
+
switch foo {
+default: break
+}
+
+
if case .bar = foo {
+}
+
+
guard case .bar = foo else {
+}
+
+
if foo == .bar() {}
+
+
guard foo == .bar() else { return }
+
+
if case .appStore = self.appInstaller, !UIDevice.isSimulator() {
+    viewController.present(self, animated: false)
+} else {
+    UIApplication.shared.open(self.appInstaller.url)
+}
+
+
let updatedUserNotificationSettings = deepLink.filter { nav in
+    guard case .settings(.notifications(_, nil)) = nav else { return false }
+    return true
+}
+
+

Triggering Examples

+
switch foo {
+case .bar↓(_): break
+}
+
+
switch foo {
+case .bar↓(): break
+}
+
+
switch foo {
+case .bar↓(_), .bar2↓(_): break
+}
+
+
switch foo {
+case .bar↓() where method() > 2: break
+}
+
+
switch foo {
+case .bar(.baz↓()): break
+}
+
+
switch foo {
+case .bar(.baz↓(_)): break
+}
+
+
func example(foo: Foo) {
+    switch foo {
+    case .bar↓(_):
+        break
+    }
+}
+
+
if case .bar↓(_) = foo {
+}
+
+
guard case .bar↓(_) = foo else {
+}
+
+
if case .bar↓() = foo {
+}
+
+
guard case .bar↓() = foo else {
+}
+
+
if case .appStore↓(_) = self.appInstaller, !UIDevice.isSimulator() {
+    viewController.present(self, animated: false)
+} else {
+    UIApplication.shared.open(self.appInstaller.url)
+}
+
+
let updatedUserNotificationSettings = deepLink.filter { nav in
+    guard case .settings(.notifications↓(_, _)) = nav else { return false }
+    return true
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/empty_parameters.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/empty_parameters.html new file mode 100644 index 000000000..d9e67b2d0 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/empty_parameters.html @@ -0,0 +1,392 @@ + + + + empty_parameters Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Empty Parameters

+ +

Prefer () -> over Void ->

+ +
    +
  • Identifier: empty_parameters
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let abc: () -> Void = {}
+
+
func foo(completion: () -> Void)
+
+
func foo(completion: () throws -> Void)
+
+
let foo: (ConfigurationTests) -> Void throws -> Void)
+
+
let foo: (ConfigurationTests) ->   Void throws -> Void)
+
+
let foo: (ConfigurationTests) ->Void throws -> Void)
+
+

Triggering Examples

+
let abc: ↓(Void) -> Void = {}
+
+
func foo(completion: ↓(Void) -> Void)
+
+
func foo(completion: ↓(Void) throws -> Void)
+
+
let foo: ↓(Void) -> () throws -> Void)
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/empty_parentheses_with_trailing_closure.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/empty_parentheses_with_trailing_closure.html new file mode 100644 index 000000000..b785bb1a0 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/empty_parentheses_with_trailing_closure.html @@ -0,0 +1,406 @@ + + + + empty_parentheses_with_trailing_closure Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Empty Parentheses with Trailing Closure

+ +

When using trailing closures, empty parentheses should be avoided after the method call

+ +
    +
  • Identifier: empty_parentheses_with_trailing_closure
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
[1, 2].map { $0 + 1 }
+
+
[1, 2].map({ $0 + 1 })
+
+
[1, 2].reduce(0) { $0 + $1 }
+
+
[1, 2].map { number in
+ number + 1 
+}
+
+
let isEmpty = [1, 2].isEmpty()
+
+
UIView.animateWithDuration(0.3, animations: {
+   self.disableInteractionRightView.alpha = 0
+}, completion: { _ in
+   ()
+})
+
+

Triggering Examples

+
[1, 2].map↓() { $0 + 1 }
+
+
[1, 2].map↓( ) { $0 + 1 }
+
+
[1, 2].map↓() { number in
+ number + 1 
+}
+
+
[1, 2].map↓(  ) { number in
+ number + 1 
+}
+
+
func foo() -> [Int] {
+    return [1, 2].map↓() { $0 + 1 }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/empty_string.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/empty_string.html new file mode 100644 index 000000000..6d9141703 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/empty_string.html @@ -0,0 +1,390 @@ + + + + empty_string Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Empty String

+ +

Prefer checking isEmpty over comparing string to an empty string literal

+ +
    +
  • Identifier: empty_string
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
myString.isEmpty
+
+
!myString.isEmpty
+
+
"""
+foo==
+"""
+
+

Triggering Examples

+
myString↓ == ""
+
+
myString↓ != ""
+
+
myString↓==""
+
+
myString↓ == #""#
+
+
myString↓ == ##""##
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/empty_xctest_method.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/empty_xctest_method.html new file mode 100644 index 000000000..29c15bbea --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/empty_xctest_method.html @@ -0,0 +1,519 @@ + + + + empty_xctest_method Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Empty XCTest Method

+ +

Empty XCTest method should be avoided

+ +
    +
  • Identifier: empty_xctest_method
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +test_parent_classes + +[“QuickSpec”, “XCTestCase”] +
  • +
+

Non Triggering Examples

+
class TotoTests: XCTestCase {
+    var foobar: Foobar?
+
+    override func setUp() {
+        super.setUp()
+        foobar = Foobar()
+    }
+
+    override func setUpWithError() throws {
+        foobar = nil
+    }
+
+    override func tearDown() {
+        foobar = nil
+        super.tearDown()
+    }
+
+    func testFoo() {
+        XCTAssertTrue(foobar?.foo)
+    }
+
+    func testBar() {
+        // comment...
+
+        XCTAssertFalse(foobar?.bar)
+
+        // comment...
+    }
+
+    func testBaz() {
+        _ = 4 + 4
+    }
+}
+
+
class Foobar {
+    func setUp() {}
+
+    func tearDown() {}
+
+    func testFoo() {}
+}
+
+
class TotoTests: XCTestCase {
+    func setUp(with object: Foobar) {}
+
+    func tearDown(object: Foobar) {}
+
+    func testFoo(_ foo: Foobar) {}
+
+    func testBar(bar: (String) -> Int) {}
+}
+
+
class TotoTests: XCTestCase {
+    func testFoo() { XCTAssertTrue(foobar?.foo) }
+
+    func testBar() { XCTAssertFalse(foobar?.bar) }
+}
+
+
class TotoTests: XCTestCase {
+    override class var runsForEachTargetApplicationUIConfiguration: Bool { true }
+
+    static var allTests = [("testFoo", testFoo)]
+
+    func testFoo() { XCTAssert(true) }
+}
+
+

Triggering Examples

+
class TotoTests: XCTestCase {
+    override ↓func setUp() {
+    }
+
+    override ↓func tearDown() {
+
+    }
+
+    ↓func testFoo() {
+
+
+    }
+
+    ↓func testBar() {
+
+
+
+    }
+
+    func helperFunction() {
+    }
+}
+
+
class TotoTests: XCTestCase {
+    override ↓func setUp() {}
+
+    override ↓func tearDown() {}
+
+    ↓func testFoo() {}
+
+    func helperFunction() {}
+}
+
+
class TotoTests: XCTestCase {
+    override ↓func setUp() {
+        // comment...
+    }
+
+    override ↓func tearDown() {
+        // comment...
+        // comment...
+    }
+
+    ↓func testFoo() {
+        // comment...
+
+        // comment...
+
+        // comment...
+    }
+
+    ↓func testBar() {
+        /*
+         * comment...
+         *
+         * comment...
+         *
+         * comment...
+         */
+    }
+
+    func helperFunction() {
+    }
+}
+
+
class FooTests: XCTestCase {
+    override ↓func setUp() {}
+}
+
+class BarTests: XCTestCase {
+    ↓func testFoo() {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/enum_case_associated_values_count.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/enum_case_associated_values_count.html new file mode 100644 index 000000000..1ae8ce9c8 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/enum_case_associated_values_count.html @@ -0,0 +1,398 @@ + + + + enum_case_associated_values_count Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Enum Case Associated Values Count

+ +

The number of associated values in an enum case should be low.

+ +
    +
  • Identifier: enum_case_associated_values_count
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: metrics
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +warning + +5 +
    +error + +6 +
  • +
+

Non Triggering Examples

+
enum Employee {
+    case fullTime(name: String, retirement: Date, designation: String, contactNumber: Int)
+    case partTime(name: String, age: Int, contractEndDate: Date)
+}
+
+
enum Barcode {
+    case upc(Int, Int, Int, Int)
+}
+
+

Triggering Examples

+
enum Employee {
+    case ↓fullTime(name: String, retirement: Date, age: Int, designation: String, contactNumber: Int)
+    case ↓partTime(name: String, contractEndDate: Date, age: Int, designation: String, contactNumber: Int)
+}
+
+
enum Barcode {
+    case ↓upc(Int, Int, Int, Int, Int, Int)
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/expiring_todo.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/expiring_todo.html new file mode 100644 index 000000000..23c32ab88 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/expiring_todo.html @@ -0,0 +1,470 @@ + + + + expiring_todo Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Expiring Todo

+ +

TODOs and FIXMEs should be resolved prior to their expiry date.

+ +
    +
  • Identifier: expiring_todo
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +approaching_expiry_severity + +warning +
    +expired_severity + +error +
    +bad_formatting_severity + +error +
    +approaching_expiry_threshold + +15 +
    +date_delimiters + + + + + + + + + + + + + + + +
    KeyValue
    +opening + +“[” +
    +closing + +“]” +
    +
    +date_format + +“MM/dd/yyyy” +
    +date_separator + +“/” +
  • +
+

Non Triggering Examples

+
// notaTODO:
+
+
// notaFIXME:
+
+
// TODO: [12/31/9999]
+
+
// TODO(note)
+
+
// FIXME(note)
+
+
/* FIXME: */
+
+
/* TODO: */
+
+
/** FIXME: */
+
+
/** TODO: */
+
+

Triggering Examples

+
// TODO: [↓10/14/2019]
+
+
// FIXME: [↓10/14/2019]
+
+
// FIXME: [↓1/14/2019]
+
+
// FIXME: [↓10/14/2019]
+
+
// TODO: [↓9999/14/10]
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/explicit_acl.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/explicit_acl.html new file mode 100644 index 000000000..b7d147a53 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/explicit_acl.html @@ -0,0 +1,473 @@ + + + + explicit_acl Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Explicit ACL

+ +

All declarations should specify Access Control Level keywords explicitly

+ +
    +
  • Identifier: explicit_acl
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
internal enum A {}
+
+
public final class B {}
+
+
private struct C {}
+
+
internal enum A { internal enum B {} }
+
+
internal final class Foo {}
+
+
internal
+class Foo {
+  private let bar = 5
+}
+
+
internal func a() { let a =  }
+
+
private func a() { func innerFunction() { } }
+
+
private enum Foo { enum Bar { } }
+
+
private struct C { let d = 5 }
+
+
internal protocol A {
+  func b()
+}
+
+
internal protocol A {
+  var b: Int
+}
+
+
internal class A { deinit {} }
+
+
extension A: Equatable {}
+
+
extension A {}
+
+
extension Foo {
+    internal func bar() {}
+}
+
+
internal enum Foo {
+    case bar
+}
+
+
extension Foo {
+    public var isValid: Bool {
+        let result = true
+        return result
+    }
+}
+
+
extension Foo {
+    private var isValid: Bool {
+        get {
+            return true
+        }
+        set(newValue) {
+            print(newValue)
+        }
+    }
+}
+
+
private extension Foo {
+    var isValid: Bool { true }
+    struct S {
+        let b = 2
+    }
+}
+
+

Triggering Examples

+
↓enum A {}
+
+
final ↓class B {}
+
+
internal struct C { ↓let d = 5 }
+
+
public struct C { private(set) ↓var d = 5 }
+
+
internal struct C { static ↓let d = 5 }
+
+
public struct C { ↓let d = 5 }
+
+
public struct C { ↓init() }
+
+
static ↓func a() {}
+
+
internal let a = 0
+↓func b() {}
+
+
extension Foo {
+    ↓func bar() {}
+    static ↓func baz() {}
+}
+
+
public extension E {
+    let a = 1
+    struct S {
+        ↓let b = 2
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/explicit_enum_raw_value.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/explicit_enum_raw_value.html new file mode 100644 index 000000000..36299eab6 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/explicit_enum_raw_value.html @@ -0,0 +1,424 @@ + + + + explicit_enum_raw_value Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Explicit Enum Raw Value

+ +

Enums should be explicitly assigned their raw values

+ +
    +
  • Identifier: explicit_enum_raw_value
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
enum Numbers {
+  case int(Int)
+  case short(Int16)
+}
+
+
enum Numbers: Int {
+  case one = 1
+  case two = 2
+}
+
+
enum Numbers: Double {
+  case one = 1.1
+  case two = 2.2
+}
+
+
enum Numbers: String {
+  case one = "one"
+  case two = "two"
+}
+
+
protocol Algebra {}
+enum Numbers: Algebra {
+  case one
+}
+
+

Triggering Examples

+
enum Numbers: Int {
+  case one = 10, ↓two, three = 30
+}
+
+
enum Numbers: NSInteger {
+  case ↓one
+}
+
+
enum Numbers: String {
+  case ↓one
+  case ↓two
+}
+
+
enum Numbers: String {
+   case ↓one, two = "two"
+}
+
+
enum Numbers: Decimal {
+  case ↓one, ↓two
+}
+
+
enum Outer {
+    enum Numbers: Decimal {
+      case ↓one, ↓two
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/explicit_init.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/explicit_init.html new file mode 100644 index 000000000..f72a63e01 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/explicit_init.html @@ -0,0 +1,430 @@ + + + + explicit_init Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Explicit Init

+ +

Explicitly calling .init() should be avoided

+ +
    +
  • Identifier: explicit_init
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +include_bare_init + +false +
  • +
+

Non Triggering Examples

+
import Foundation
+class C: NSObject {
+    override init() {
+        super.init()
+    }
+}
+
+
struct S {
+    let n: Int
+}
+extension S {
+    init() {
+        self.init(n: 1)
+    }
+}
+
+
[1].flatMap(String.init)
+
+
[String.self].map { $0.init(1) }
+
+
[String.self].map { type in type.init(1) }
+
+
Observable.zip(obs1, obs2, resultSelector: MyType.init).asMaybe()
+
+
_ = GleanMetrics.Tabs.someType.init()
+
+
Observable.zip(
+  obs1,
+  obs2,
+  resultSelector: MyType.init
+).asMaybe()
+
+

Triggering Examples

+
[1].flatMap{String↓.init($0)}
+
+
[String.self].map { Type in Type↓.init(1) }
+
+
func foo() -> [String] {
+    return [1].flatMap { String↓.init($0) }
+}
+
+
_ = GleanMetrics.Tabs.GroupedTabExtra↓.init()
+
+
_ = Set<KsApi.Category>↓.init()
+
+
Observable.zip(
+  obs1,
+  obs2,
+  resultSelector: { MyType↓.init($0, $1) }
+).asMaybe()
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/explicit_self.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/explicit_self.html new file mode 100644 index 000000000..39d5bf028 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/explicit_self.html @@ -0,0 +1,443 @@ + + + + explicit_self Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Explicit Self

+ +

Instance variables and functions should be explicitly accessed with ‘self.’

+ +
    +
  • Identifier: explicit_self
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: Yes
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
struct A {
+    func f1() {}
+    func f2() {
+        self.f1()
+    }
+}
+
+
struct A {
+    let p1: Int
+    func f1() {
+        _ = self.p1
+    }
+}
+
+
@propertyWrapper
+struct Wrapper<Value> {
+    let wrappedValue: Value
+    var projectedValue: [Value] {
+        [self.wrappedValue]
+    }
+}
+struct A {
+    @Wrapper var p1: Int
+    func f1() {
+        self.$p1
+        self._p1
+    }
+}
+func f1() {
+    A(p1: 10).$p1
+}
+
+

Triggering Examples

+
struct A {
+    func f1() {}
+    func f2() {
+        ↓f1()
+    }
+}
+
+
struct A {
+    let p1: Int
+    func f1() {
+        _ = ↓p1
+    }
+}
+
+
struct A {
+    func f1(a b: Int) {}
+    func f2() {
+        ↓f1(a: 0)
+    }
+}
+
+
@propertyWrapper
+struct Wrapper<Value> {
+    let wrappedValue: Value
+    var projectedValue: [Value] {
+        [self.wrappedValue]
+    }
+}
+struct A {
+    @Wrapper var p1: Int
+    func f1() {
+        ↓$p1
+        ↓_p1
+    }
+}
+func f1() {
+    A(p1: 10).$p1
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/explicit_top_level_acl.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/explicit_top_level_acl.html new file mode 100644 index 000000000..09a7dfd25 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/explicit_top_level_acl.html @@ -0,0 +1,403 @@ + + + + explicit_top_level_acl Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Explicit Top Level ACL

+ +

Top-level declarations should specify Access Control Level keywords explicitly

+ +
    +
  • Identifier: explicit_top_level_acl
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
internal enum A {}
+
+
public final class B {}
+
+
private struct S1 {
+    struct S2 {}
+}
+
+
internal enum A { enum B {} }
+
+
internal final actor Foo {}
+
+
internal typealias Foo = Bar
+
+
internal func a() {}
+
+
extension A: Equatable {}
+
+
extension A {}
+
+

Triggering Examples

+
↓enum A {}
+
+
final ↓class B {}
+
+
↓protocol P {}
+
+
↓func a() {}
+
+
internal let a = 0
+↓func b() {}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/explicit_type_interface.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/explicit_type_interface.html new file mode 100644 index 000000000..15348af32 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/explicit_type_interface.html @@ -0,0 +1,428 @@ + + + + explicit_type_interface Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Explicit Type Interface

+ +

Properties should have a type interface

+ +
    +
  • Identifier: explicit_type_interface
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +excluded + +[] +
    +allow_redundancy + +false +
  • +
+

Non Triggering Examples

+
class Foo {
+  var myVar: Int? = 0
+}
+
+
class Foo {
+  let myVar: Int? = 0, s: String = ""
+}
+
+
class Foo {
+  static var myVar: Int? = 0
+}
+
+
class Foo {
+  class var myVar: Int? = 0
+}
+
+

Triggering Examples

+
class Foo {
+  var ↓myVar = 0
+}
+
+
class Foo {
+  let ↓mylet = 0
+}
+
+
class Foo {
+  static var ↓myStaticVar = 0
+}
+
+
class Foo {
+  class var ↓myClassVar = 0
+}
+
+
class Foo {
+  let ↓myVar = Int(0), ↓s = ""
+}
+
+
class Foo {
+  let ↓myVar = Set<Int>(0)
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/extension_access_modifier.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/extension_access_modifier.html new file mode 100644 index 000000000..57ea7af8f --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/extension_access_modifier.html @@ -0,0 +1,503 @@ + + + + extension_access_modifier Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Extension Access Modifier

+ +

Prefer to use extension access modifiers

+ +
    +
  • Identifier: extension_access_modifier
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
extension Foo: SomeProtocol {
+  public var bar: Int { return 1 }
+}
+
+
extension Foo {
+  private var bar: Int { return 1 }
+  public var baz: Int { return 1 }
+}
+
+
extension Foo {
+  private var bar: Int { return 1 }
+  public func baz() {}
+}
+
+
extension Foo {
+  var bar: Int { return 1 }
+  var baz: Int { return 1 }
+}
+
+
extension Foo {
+  var bar: Int { return 1 }
+  internal var baz: Int { return 1 }
+}
+
+
internal extension Foo {
+  var bar: Int { return 1 }
+  var baz: Int { return 1 }
+}
+
+
public extension Foo {
+  var bar: Int { return 1 }
+  var baz: Int { return 1 }
+}
+
+
public extension Foo {
+  var bar: Int { return 1 }
+  internal var baz: Int { return 1 }
+}
+
+
extension Foo {
+  private var bar: Int { return 1 }
+  private var baz: Int { return 1 }
+}
+
+
extension Foo {
+  open var bar: Int { return 1 }
+  open var baz: Int { return 1 }
+}
+
+
extension Foo {
+    func setup() {}
+    public func update() {}
+}
+
+
private extension Foo {
+  private var bar: Int { return 1 }
+  var baz: Int { return 1 }
+}
+
+
extension Foo {
+  internal private(set) var bar: Int {
+    get { Foo.shared.bar }
+    set { Foo.shared.bar = newValue }
+  }
+}
+
+
extension Foo {
+  private(set) internal var bar: Int {
+    get { Foo.shared.bar }
+    set { Foo.shared.bar = newValue }
+  }
+}
+
+
public extension Foo {
+  private(set) var value: Int { 1 }
+}
+
+

Triggering Examples

+
↓extension Foo {
+   public var bar: Int { return 1 }
+   public var baz: Int { return 1 }
+}
+
+
↓extension Foo {
+   public var bar: Int { return 1 }
+   public func baz() {}
+}
+
+
public extension Foo {
+  ↓public func bar() {}
+  ↓public func baz() {}
+}
+
+
↓extension Foo {
+   public var bar: Int {
+      let value = 1
+      return value
+   }
+
+   public var baz: Int { return 1 }
+}
+
+
↓extension Array where Element: Equatable {
+    public var unique: [Element] {
+        var uniqueValues = [Element]()
+        for item in self where !uniqueValues.contains(item) {
+            uniqueValues.append(item)
+        }
+        return uniqueValues
+    }
+}
+
+
↓extension Foo {
+   #if DEBUG
+   public var bar: Int {
+      let value = 1
+      return value
+   }
+   #endif
+
+   public var baz: Int { return 1 }
+}
+
+
public extension Foo {
+  ↓private func bar() {}
+  ↓private func baz() {}
+}
+
+
↓extension Foo {
+  private(set) public var value: Int { 1 }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/fallthrough.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/fallthrough.html new file mode 100644 index 000000000..c646b5bb9 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/fallthrough.html @@ -0,0 +1,384 @@ + + + + fallthrough Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Fallthrough

+ +

Fallthrough should be avoided

+ +
    +
  • Identifier: fallthrough
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
switch foo {
+case .bar, .bar2, .bar3:
+  something()
+}
+
+

Triggering Examples

+
switch foo {
+case .bar:
+  ↓fallthrough
+case .bar2:
+  something()
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/fatal_error_message.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/fatal_error_message.html new file mode 100644 index 000000000..c180b85db --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/fatal_error_message.html @@ -0,0 +1,388 @@ + + + + fatal_error_message Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Fatal Error Message

+ +

A fatalError call should have a message

+ +
    +
  • Identifier: fatal_error_message
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func foo() {
+  fatalError("Foo")
+}
+
+
func foo() {
+  fatalError(x)
+}
+
+

Triggering Examples

+
func foo() {
+  ↓fatalError("")
+}
+
+
func foo() {
+  ↓fatalError()
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/file_header.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/file_header.html new file mode 100644 index 000000000..36888e391 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/file_header.html @@ -0,0 +1,392 @@ + + + + file_header Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

File Header

+ +

Header comments should be consistent with project patterns. The SWIFTLINT_CURRENT_FILENAME placeholder can optionally be used in the required and forbidden patterns. It will be replaced by the real file name.

+ +
    +
  • Identifier: file_header
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let foo = "Copyright"
+
+
let foo = 2 // Copyright
+
+
let foo = 2
+ // Copyright
+
+

Triggering Examples

+
// ↓Copyright
+
+
//
+// ↓Copyright
+
+
//
+//  FileHeaderRule.swift
+//  SwiftLint
+//
+//  Created by Marcelo Fabri on 27/11/16.
+//  ↓Copyright © 2016 Realm. All rights reserved.
+//
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/file_length.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/file_length.html new file mode 100644 index 000000000..35fc1f5ba --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/file_length.html @@ -0,0 +1,1999 @@ + + + + file_length Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

File Length

+ +

Files should not span too many lines.

+ +
    +
  • Identifier: file_length
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: metrics
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +warning + +400 +
    +error + +1000 +
    +ignore_comment_only_lines + +false +
  • +
+

Non Triggering Examples

+
print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+
+
+

Triggering Examples

+
print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+
+
+
print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+//
+
+
+
print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/file_name.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/file_name.html new file mode 100644 index 000000000..e8163a596 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/file_name.html @@ -0,0 +1,410 @@ + + + + file_name Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

File Name

+ +

File name should match a type or extension declared in the file (if any)

+ +
    +
  • Identifier: file_name
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +excluded + +[“LinuxMain.swift”, “main.swift”] +
    +prefix_pattern + +“” +
    +suffix_pattern + +“+.*” +
    +nested_type_separator + +“.” +
    +require_fully_qualified_names + +false +
  • +
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/file_name_no_space.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/file_name_no_space.html new file mode 100644 index 000000000..1c8a33da0 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/file_name_no_space.html @@ -0,0 +1,378 @@ + + + + file_name_no_space Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

File Name no Space

+ +

File name should not contain any whitespace

+ +
    +
  • Identifier: file_name_no_space
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +excluded + +[] +
  • +
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/file_types_order.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/file_types_order.html new file mode 100644 index 000000000..e29a07d31 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/file_types_order.html @@ -0,0 +1,585 @@ + + + + file_types_order Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

File Types Order

+ +

Specifies how the types within a file should be ordered.

+ +
    +
  • Identifier: file_types_order
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +order + +[[supporting_type], [main_type], [extension], [preview_provider], [library_content_provider]] +
  • +
+

Non Triggering Examples

+
// Supporting Types
+protocol TestViewControllerDelegate {
+    func didPressTrackedButton()
+}
+
+// Main Type
+class TestViewController: UIViewController {
+    // Type Aliases
+    typealias CompletionHandler = ((TestEnum) -> Void)
+
+    // Subtypes
+    class TestClass {
+        // 10 lines
+    }
+
+    struct TestStruct {
+        // 3 lines
+    }
+
+    enum TestEnum {
+        // 5 lines
+    }
+
+    // Stored Type Properties
+    static let cellIdentifier: String = "AmazingCell"
+
+    // Stored Instance Properties
+    var shouldLayoutView1: Bool!
+    weak var delegate: TestViewControllerDelegate?
+    private var hasLayoutedView1: Bool = false
+    private var hasLayoutedView2: Bool = false
+
+    // Computed Instance Properties
+    private var hasAnyLayoutedView: Bool {
+         return hasLayoutedView1 || hasLayoutedView2
+    }
+
+    // IBOutlets
+    @IBOutlet private var view1: UIView!
+    @IBOutlet private var view2: UIView!
+
+    // Initializers
+    override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
+        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
+    }
+
+    required init?(coder aDecoder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+
+    // Type Methods
+    static func makeViewController() -> TestViewController {
+        // some code
+    }
+
+    // Life-Cycle Methods
+    override func viewDidLoad() {
+        super.viewDidLoad()
+    }
+
+    override func viewDidLayoutSubviews() {
+        super.viewDidLayoutSubviews()
+    }
+
+    // IBActions
+    @IBAction func goNextButtonPressed() {
+        goToNextVc()
+        delegate?.didPressTrackedButton()
+    }
+
+    @objc
+    func goToRandomVcButtonPressed() {
+        goToRandomVc()
+    }
+
+    // MARK: Other Methods
+    func goToNextVc() { /* TODO */ }
+
+    func goToInfoVc() { /* TODO */ }
+
+    func goToRandomVc() {
+        let viewCtrl = getRandomVc()
+        present(viewCtrl, animated: true)
+    }
+
+    private func getRandomVc() -> UIViewController { return UIViewController() }
+
+    // Subscripts
+    subscript(_ someIndexThatIsNotEvenUsed: Int) -> String {
+        get {
+            return "This is just a test"
+        }
+
+        set {
+            log.warning("Just a test", newValue)
+        }
+    }
+}
+
+// Extensions
+extension TestViewController: UITableViewDataSource {
+    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        return 1
+    }
+}
+
+
// Only extensions
+extension Foo {}
+extension Bar {
+}
+
+
// Main Type
+struct ContentView: View {
+    var body: some View {
+        Text("Hello, World!")
+    }
+}
+
+// Preview Provider
+struct ContentView_Previews: PreviewProvider {
+    static var previews: some View { ContentView() }
+}
+
+// Library Content Provider
+struct ContentView_LibraryContent: LibraryContentProvider {
+    var views: [LibraryItem] {
+        LibraryItem(ContentView())
+    }
+}
+
+

Triggering Examples

+
↓class TestViewController: UIViewController {}
+
+// Supporting Types
+protocol TestViewControllerDelegate {
+    func didPressTrackedButton()
+}
+
+
// Extensions
+↓extension TestViewController: UITableViewDataSource {
+    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        return 1
+    }
+}
+
+class TestViewController: UIViewController {}
+
+
// Supporting Types
+protocol TestViewControllerDelegate {
+    func didPressTrackedButton()
+}
+
+↓class TestViewController: UIViewController {}
+
+// Supporting Types
+protocol TestViewControllerDelegate {
+    func didPressTrackedButton()
+}
+
+
// Supporting Types
+protocol TestViewControllerDelegate {
+    func didPressTrackedButton()
+}
+
+// Extensions
+↓extension TestViewController: UITableViewDataSource {
+    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        return 1
+    }
+}
+
+class TestViewController: UIViewController {}
+
+// Extensions
+extension TestViewController: UITableViewDataSource {
+    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        return 1
+    }
+}
+
+
// Preview Provider
+↓struct ContentView_Previews: PreviewProvider {
+    static var previews: some View { ContentView() }
+}
+
+// Main Type
+struct ContentView: View {
+    var body: some View {
+        Text("Hello, World!")
+    }
+}
+
+
// Library Content Provider
+↓struct ContentView_LibraryContent: LibraryContentProvider {
+    var views: [LibraryItem] {
+        LibraryItem(ContentView())
+    }
+}
+
+// Main Type
+struct ContentView: View {
+    var body: some View {
+        Text("Hello, World!")
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/final_test_case.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/final_test_case.html new file mode 100644 index 000000000..cc48dcca1 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/final_test_case.html @@ -0,0 +1,406 @@ + + + + final_test_case Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Final Test Case

+ +

Test cases should be final

+ +
    +
  • Identifier: final_test_case
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +test_parent_classes + +[“QuickSpec”, “XCTestCase”] +
  • +
+

Non Triggering Examples

+
final class Test: XCTestCase {}
+
+
open class Test: XCTestCase {}
+
+
public final class Test: QuickSpec {}
+
+
class Test: MyTestCase {}
+
+
//
+// test_parent_classes: ["MyTestCase", "QuickSpec", "XCTestCase"]
+//
+
+struct Test: MyTestCase {}
+
+
+

Triggering Examples

+
class ↓Test: XCTestCase {}
+
+
public class ↓Test: QuickSpec {}
+
+
//
+// test_parent_classes: ["MyTestCase", "QuickSpec", "XCTestCase"]
+//
+
+class ↓Test: MyTestCase {}
+
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/first_where.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/first_where.html new file mode 100644 index 000000000..447626659 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/first_where.html @@ -0,0 +1,405 @@ + + + + first_where Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

First Where

+ +

Prefer using .first(where:) over .filter { }.first in collections

+ +
    +
  • Identifier: first_where
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
kinds.filter(excludingKinds.contains).isEmpty && kinds.first == .identifier
+
+
myList.first(where: { $0 % 2 == 0 })
+
+
match(pattern: pattern).filter { $0.first == .identifier }
+
+
(myList.filter { $0 == 1 }.suffix(2)).first
+
+
collection.filter("stringCol = '3'").first
+
+
realm?.objects(User.self).filter(NSPredicate(format: "email ==[c] %@", email)).first
+
+
if let pause = timeTracker.pauses.filter("beginDate < %@", beginDate).first { print(pause) }
+
+

Triggering Examples

+
↓myList.filter { $0 % 2 == 0 }.first
+
+
↓myList.filter({ $0 % 2 == 0 }).first
+
+
↓myList.map { $0 + 1 }.filter({ $0 % 2 == 0 }).first
+
+
↓myList.map { $0 + 1 }.filter({ $0 % 2 == 0 }).first?.something()
+
+
↓myList.filter(someFunction).first
+
+
↓myList.filter({ $0 % 2 == 0 })
+.first
+
+
(↓myList.filter { $0 == 1 }).first
+
+
↓myListOfDict.filter { dict in dict["1"] }.first
+
+
↓myListOfDict.filter { $0["someString"] }.first
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/flatmap_over_map_reduce.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/flatmap_over_map_reduce.html new file mode 100644 index 000000000..07da0cbaf --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/flatmap_over_map_reduce.html @@ -0,0 +1,378 @@ + + + + flatmap_over_map_reduce Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Flat Map over Map Reduce

+ +

Prefer flatMap over map followed by reduce([], +)

+ +
    +
  • Identifier: flatmap_over_map_reduce
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let foo = bar.map { $0.count }.reduce(0, +)
+
+
let foo = bar.flatMap { $0.array }
+
+

Triggering Examples

+
let foo = ↓bar.map { $0.array }.reduce([], +)
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/for_where.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/for_where.html new file mode 100644 index 000000000..4019ae279 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/for_where.html @@ -0,0 +1,472 @@ + + + + for_where Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Prefer For-Where

+ +

where clauses are preferred over a single if inside a for

+ +
    +
  • Identifier: for_where
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +allow_for_as_filter + +false +
  • +
+

Non Triggering Examples

+
for user in users where user.id == 1 { }
+
+
for user in users {
+  if let id = user.id { }
+}
+
+
for user in users {
+  if var id = user.id { }
+}
+
+
for user in users {
+  if user.id == 1 { } else { }
+}
+
+
for user in users {
+  if user.id == 1 {
+  } else if user.id == 2 { }
+}
+
+
for user in users {
+  if user.id == 1 { }
+  print(user)
+}
+
+
for user in users {
+  let id = user.id
+  if id == 1 { }
+}
+
+
for user in users {
+  if user.id == 1 { }
+  return true
+}
+
+
for user in users {
+  if user.id == 1 && user.age > 18 { }
+}
+
+
for user in users {
+  if user.id == 1, user.age > 18 { }
+}
+
+
for (index, value) in array.enumerated() {
+  if case .valueB(_) = value {
+    return index
+  }
+}
+
+
//
+// allow_for_as_filter: true
+//
+
+for user in users {
+  if user.id == 1 { return true }
+}
+
+
+
//
+// allow_for_as_filter: true
+//
+
+for user in users {
+  if user.id == 1 {
+    let derivedValue = calculateValue(from: user)
+    return derivedValue != 0
+  }
+}
+
+
+

Triggering Examples

+
for user in users {
+  ↓if user.id == 1 { return true }
+}
+
+
for subview in subviews {
+    ↓if !(subview is UIStackView) {
+        subview.removeConstraints(subview.constraints)
+        subview.removeFromSuperview()
+    }
+}
+
+
//
+// allow_for_as_filter: true
+//
+
+for subview in subviews {
+    ↓if !(subview is UIStackView) {
+        subview.removeConstraints(subview.constraints)
+        subview.removeFromSuperview()
+    }
+}
+
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/force_cast.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/force_cast.html new file mode 100644 index 000000000..2d6c8ea43 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/force_cast.html @@ -0,0 +1,376 @@ + + + + force_cast Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Force Cast

+ +

Force casts should be avoided

+ +
    +
  • Identifier: force_cast
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +error +
  • +
+

Non Triggering Examples

+
NSNumber() as? Int
+
+

Triggering Examples

+
NSNumber() ↓as! Int
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/force_try.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/force_try.html new file mode 100644 index 000000000..c61cb474f --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/force_try.html @@ -0,0 +1,380 @@ + + + + force_try Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Force Try

+ +

Force tries should be avoided

+ +
    +
  • Identifier: force_try
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +error +
  • +
+

Non Triggering Examples

+
func a() throws {}
+do {
+  try a()
+} catch {}
+
+

Triggering Examples

+
func a() throws {}
+↓try! a()
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/force_unwrapping.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/force_unwrapping.html new file mode 100644 index 000000000..7397b0fb1 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/force_unwrapping.html @@ -0,0 +1,450 @@ + + + + force_unwrapping Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Force Unwrapping

+ +

Force unwrapping should be avoided

+ +
    +
  • Identifier: force_unwrapping
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
if let url = NSURL(string: query)
+
+
navigationController?.pushViewController(viewController, animated: true)
+
+
let s as! Test
+
+
try! canThrowErrors()
+
+
let object: Any!
+
+
@IBOutlet var constraints: [NSLayoutConstraint]!
+
+
setEditing(!editing, animated: true)
+
+
navigationController.setNavigationBarHidden(!navigationController.navigationBarHidden, animated: true)
+
+
if addedToPlaylist && (!self.selectedFilters.isEmpty || self.searchBar?.text?.isEmpty == false) {}
+
+
print("\(xVar)!")
+
+
var test = (!bar)
+
+
var a: [Int]!
+
+
private var myProperty: (Void -> Void)!
+
+
func foo(_ options: [AnyHashable: Any]!) {
+
+
func foo() -> [Int]!
+
+
func foo() -> [AnyHashable: Any]!
+
+
func foo() -> [Int]! { return [] }
+
+
return self
+
+

Triggering Examples

+
let url = NSURL(string: query)↓!
+
+
navigationController↓!.pushViewController(viewController, animated: true)
+
+
let unwrapped = optional↓!
+
+
return cell↓!
+
+
let url = NSURL(string: "http://www.google.com")↓!
+
+
let dict = ["Boooo": "👻"]
+func bla() -> String {
+    return dict["Boooo"]↓!
+}
+
+
let dict = ["Boooo": "👻"]
+func bla() -> String {
+    return dict["Boooo"]↓!.contains("B")
+}
+
+
let a = dict["abc"]↓!.contains("B")
+
+
dict["abc"]↓!.bar("B")
+
+
if dict["a"]↓!↓!↓!↓! {}
+
+
var foo: [Bool]! = dict["abc"]↓!
+
+
realm.objects(SwiftUTF8Object.self).filter("%K == %@", "柱нǢкƱаم👍", utf8TestString).first↓!
+
+
context("abc") {
+  var foo: [Bool]! = dict["abc"]↓!
+}
+
+
open var computed: String { return foo.bar↓! }
+
+
return self↓!
+
+
[1, 3, 5, 6].first { $0.isMultiple(of: 2) }↓!
+
+
map["a"]↓!↓!
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/function_body_length.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/function_body_length.html new file mode 100644 index 000000000..9c331145f --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/function_body_length.html @@ -0,0 +1,378 @@ + + + + function_body_length Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Function Body Length

+ +

Function bodies should not span too many lines

+ +
    +
  • Identifier: function_body_length
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: metrics
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +warning + +50 +
    +error + +100 +
  • +
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/function_default_parameter_at_end.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/function_default_parameter_at_end.html new file mode 100644 index 000000000..abcecc898 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/function_default_parameter_at_end.html @@ -0,0 +1,433 @@ + + + + function_default_parameter_at_end Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Function Default Parameter at End

+ +

Prefer to locate parameters with defaults toward the end of the parameter list

+ +
    +
  • Identifier: function_default_parameter_at_end
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +ignore_first_isolation_inheritance_parameter + +true +
  • +
+

Non Triggering Examples

+
func foo(baz: String, bar: Int = 0) {}
+
+
func foo(x: String, y: Int = 0, z: CGFloat = 0) {}
+
+
func foo(bar: String, baz: Int = 0, z: () -> Void) {}
+
+
func foo(bar: String, z: () -> Void, baz: Int = 0) {}
+
+
func foo(bar: Int = 0) {}
+
+
func foo() {}
+
+
class A: B {
+  override func foo(bar: Int = 0, baz: String) {}
+
+
func foo(bar: Int = 0, completion: @escaping CompletionHandler) {}
+
+
func foo(a: Int, b: CGFloat = 0) {
+  let block = { (error: Error?) in }
+}
+
+
func foo(a: String, b: String? = nil,
+         c: String? = nil, d: @escaping AlertActionHandler = { _ in }) {}
+
+
override init?(for date: Date = Date(), coordinate: CLLocationCoordinate2D) {}
+
+
func handleNotification(_ userInfo: NSDictionary,
+                        userInteraction: Bool = false,
+                        completionHandler: ((UIBackgroundFetchResult) -> Void)?) {}
+
+
func write(withoutNotifying tokens: [NotificationToken] =  {}, _ block: (() throws -> Int)) {}
+
+
func foo(bar: Int, baz: Int = 0, z: () -> Void) {}
+
+
func foo(bar: Int, baz: Int = 0, z: () -> Void, x: Int = 0) {}
+
+
func foo(isolation: isolated (any Actor)? = #isolation, bar: String) {}
+
+

Triggering Examples

+
func foo(↓bar: Int = 0, baz: String) {}
+
+
private func foo(↓bar: Int = 0, baz: String) {}
+
+
public init?(↓for date: Date = Date(), coordinate: CLLocationCoordinate2D) {}
+
+
func foo(bar: Int, ↓baz: Int = 0, z: () -> Void, x: Int) {}
+
+
//
+// ignore_first_isolation_inheritance_parameter: false
+//
+
+func foo(isolation: isolated (any Actor)? = #isolation, bar: String) {}
+
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/function_parameter_count.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/function_parameter_count.html new file mode 100644 index 000000000..73542318f --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/function_parameter_count.html @@ -0,0 +1,419 @@ + + + + function_parameter_count Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Function Parameter Count

+ +

Number of function parameters should be low.

+ +
    +
  • Identifier: function_parameter_count
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: metrics
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +warning + +5 +
    +error + +8 +
    +ignores_default_parameters + +true +
  • +
+

Non Triggering Examples

+
init(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}
+
+
init (a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}
+
+
`init`(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}
+
+
init?(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}
+
+
init?<T>(a: T, b: Int, c: Int, d: Int, e: Int, f: Int) {}
+
+
init?<T: String>(a: T, b: Int, c: Int, d: Int, e: Int, f: Int) {}
+
+
func f2(p1: Int, p2: Int) { }
+
+
func f(a: Int, b: Int, c: Int, d: Int, x: Int = 42) {}
+
+
func f(a: [Int], b: Int, c: Int, d: Int, f: Int) -> [Int] {
+    let s = a.flatMap { $0 as? [String: Int] } ?? []}}
+
+
override func f(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}
+
+

Triggering Examples

+
↓func f(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}
+
+
↓func initialValue(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}
+
+
private ↓func f(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int = 2, g: Int) {}
+
+
struct Foo {
+    init(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}
+    ↓func bar(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/generic_type_name.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/generic_type_name.html new file mode 100644 index 000000000..aaa930c9d --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/generic_type_name.html @@ -0,0 +1,528 @@ + + + + generic_type_name Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Generic Type Name

+ +

Generic type name should only contain alphanumeric characters, start with an uppercase character and span between 1 and 20 characters in length.

+ +
    +
  • Identifier: generic_type_name
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +min_length + + + + + + + + + + + + + + + +
    KeyValue
    +warning + +1 +
    +error + +0 +
    +
    +max_length + + + + + + + + + + + + + + + +
    KeyValue
    +warning + +20 +
    +error + +1000 +
    +
    +excluded + +[] +
    +allowed_symbols + +[] +
    +unallowed_symbols_severity + +error +
    +validates_start_with_lowercase + +error +
  • +
+

Non Triggering Examples

+
func foo<T>() {}
+
+
func foo<T>() -> T {}
+
+
func foo<T, U>(param: U) -> T {}
+
+
func foo<T: Hashable, U: Rule>(param: U) -> T {}
+
+
struct Foo<T> {}
+
+
class Foo<T> {}
+
+
enum Foo<T> {}
+
+
func run(_ options: NoOptions<CommandantError<()>>) {}
+
+
func foo(_ options: Set<type>) {}
+
+
func < <T: Comparable>(lhs: T?, rhs: T?) -> Bool
+
+
func configureWith(data: Either<MessageThread, (project: Project, backing: Backing)>)
+
+
typealias StringDictionary<T> = Dictionary<String, T>
+
+
typealias BackwardTriple<T1, T2, T3> = (T3, T2, T1)
+
+
typealias DictionaryOfStrings<T : Hashable> = Dictionary<T, String>
+
+

Triggering Examples

+
func foo<↓T_Foo>() {}
+
+
func foo<T, ↓U_Foo>(param: U_Foo) -> T {}
+
+
func foo<↓TTTTTTTTTTTTTTTTTTTTT>() {}
+
+
func foo<↓type>() {}
+
+
typealias StringDictionary<↓T_Foo> = Dictionary<String, T_Foo>
+
+
typealias BackwardTriple<T1, ↓T2_Bar, T3> = (T3, T2_Bar, T1)
+
+
typealias DictionaryOfStrings<↓T_Foo: Hashable> = Dictionary<T_Foo, String>
+
+
class Foo<↓T_Foo> {}
+
+
class Foo<T, ↓U_Foo> {}
+
+
class Foo<↓T_Foo, ↓U_Foo> {}
+
+
class Foo<↓TTTTTTTTTTTTTTTTTTTTT> {}
+
+
class Foo<↓type> {}
+
+
struct Foo<↓T_Foo> {}
+
+
struct Foo<T, ↓U_Foo> {}
+
+
struct Foo<↓T_Foo, ↓U_Foo> {}
+
+
struct Foo<↓TTTTTTTTTTTTTTTTTTTTT> {}
+
+
struct Foo<↓type> {}
+
+
enum Foo<↓T_Foo> {}
+
+
enum Foo<T, ↓U_Foo> {}
+
+
enum Foo<↓T_Foo, ↓U_Foo> {}
+
+
enum Foo<↓TTTTTTTTTTTTTTTTTTTTT> {}
+
+
enum Foo<↓type> {}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/ibinspectable_in_extension.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/ibinspectable_in_extension.html new file mode 100644 index 000000000..1dd0556ff --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/ibinspectable_in_extension.html @@ -0,0 +1,380 @@ + + + + ibinspectable_in_extension Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

IBInspectable in Extension

+ +

Extensions shouldn’t add @IBInspectable properties

+ +
    +
  • Identifier: ibinspectable_in_extension
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class Foo {
+  @IBInspectable private var x: Int
+}
+
+

Triggering Examples

+
extension Foo {
+  ↓@IBInspectable private var x: Int
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/identical_operands.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/identical_operands.html new file mode 100644 index 000000000..745e61806 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/identical_operands.html @@ -0,0 +1,858 @@ + + + + identical_operands Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Identical Operands

+ +

Comparing two identical operands is likely a mistake

+ +
    +
  • Identifier: identical_operands
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
1 == 2
+
+
foo == bar
+
+
prefixedFoo == foo
+
+
foo.aProperty == foo.anotherProperty
+
+
self.aProperty == self.anotherProperty
+
+
"1 == 1"
+
+
self.aProperty == aProperty
+
+
lhs.aProperty == rhs.aProperty
+
+
lhs.identifier == rhs.identifier
+
+
i == index
+
+
$0 == 0
+
+
keyValues?.count ?? 0 == 0
+
+
string == string.lowercased()
+
+
let num: Int? = 0
+_ = num != nil && num == num?.byteSwapped
+
+
num == num!.byteSwapped
+
+
1    + 1 ==   1     +    2
+
+
f(  i :   2) ==   f (i: 3 )
+
+
1 != 2
+
+
foo != bar
+
+
prefixedFoo != foo
+
+
foo.aProperty != foo.anotherProperty
+
+
self.aProperty != self.anotherProperty
+
+
"1 != 1"
+
+
self.aProperty != aProperty
+
+
lhs.aProperty != rhs.aProperty
+
+
lhs.identifier != rhs.identifier
+
+
i != index
+
+
$0 != 0
+
+
keyValues?.count ?? 0 != 0
+
+
string != string.lowercased()
+
+
let num: Int? = 0
+_ = num != nil && num != num?.byteSwapped
+
+
num != num!.byteSwapped
+
+
1    + 1 !=   1     +    2
+
+
f(  i :   2) !=   f (i: 3 )
+
+
1 === 2
+
+
foo === bar
+
+
prefixedFoo === foo
+
+
foo.aProperty === foo.anotherProperty
+
+
self.aProperty === self.anotherProperty
+
+
"1 === 1"
+
+
self.aProperty === aProperty
+
+
lhs.aProperty === rhs.aProperty
+
+
lhs.identifier === rhs.identifier
+
+
i === index
+
+
$0 === 0
+
+
keyValues?.count ?? 0 === 0
+
+
string === string.lowercased()
+
+
let num: Int? = 0
+_ = num != nil && num === num?.byteSwapped
+
+
num === num!.byteSwapped
+
+
1    + 1 ===   1     +    2
+
+
f(  i :   2) ===   f (i: 3 )
+
+
1 !== 2
+
+
foo !== bar
+
+
prefixedFoo !== foo
+
+
foo.aProperty !== foo.anotherProperty
+
+
self.aProperty !== self.anotherProperty
+
+
"1 !== 1"
+
+
self.aProperty !== aProperty
+
+
lhs.aProperty !== rhs.aProperty
+
+
lhs.identifier !== rhs.identifier
+
+
i !== index
+
+
$0 !== 0
+
+
keyValues?.count ?? 0 !== 0
+
+
string !== string.lowercased()
+
+
let num: Int? = 0
+_ = num != nil && num !== num?.byteSwapped
+
+
num !== num!.byteSwapped
+
+
1    + 1 !==   1     +    2
+
+
f(  i :   2) !==   f (i: 3 )
+
+
1 > 2
+
+
foo > bar
+
+
prefixedFoo > foo
+
+
foo.aProperty > foo.anotherProperty
+
+
self.aProperty > self.anotherProperty
+
+
"1 > 1"
+
+
self.aProperty > aProperty
+
+
lhs.aProperty > rhs.aProperty
+
+
lhs.identifier > rhs.identifier
+
+
i > index
+
+
$0 > 0
+
+
keyValues?.count ?? 0 > 0
+
+
string > string.lowercased()
+
+
let num: Int? = 0
+_ = num != nil && num > num?.byteSwapped
+
+
num > num!.byteSwapped
+
+
1    + 1 >   1     +    2
+
+
f(  i :   2) >   f (i: 3 )
+
+
1 >= 2
+
+
foo >= bar
+
+
prefixedFoo >= foo
+
+
foo.aProperty >= foo.anotherProperty
+
+
self.aProperty >= self.anotherProperty
+
+
"1 >= 1"
+
+
self.aProperty >= aProperty
+
+
lhs.aProperty >= rhs.aProperty
+
+
lhs.identifier >= rhs.identifier
+
+
i >= index
+
+
$0 >= 0
+
+
keyValues?.count ?? 0 >= 0
+
+
string >= string.lowercased()
+
+
let num: Int? = 0
+_ = num != nil && num >= num?.byteSwapped
+
+
num >= num!.byteSwapped
+
+
1    + 1 >=   1     +    2
+
+
f(  i :   2) >=   f (i: 3 )
+
+
1 < 2
+
+
foo < bar
+
+
prefixedFoo < foo
+
+
foo.aProperty < foo.anotherProperty
+
+
self.aProperty < self.anotherProperty
+
+
"1 < 1"
+
+
self.aProperty < aProperty
+
+
lhs.aProperty < rhs.aProperty
+
+
lhs.identifier < rhs.identifier
+
+
i < index
+
+
$0 < 0
+
+
keyValues?.count ?? 0 < 0
+
+
string < string.lowercased()
+
+
let num: Int? = 0
+_ = num != nil && num < num?.byteSwapped
+
+
num < num!.byteSwapped
+
+
1    + 1 <   1     +    2
+
+
f(  i :   2) <   f (i: 3 )
+
+
1 <= 2
+
+
foo <= bar
+
+
prefixedFoo <= foo
+
+
foo.aProperty <= foo.anotherProperty
+
+
self.aProperty <= self.anotherProperty
+
+
"1 <= 1"
+
+
self.aProperty <= aProperty
+
+
lhs.aProperty <= rhs.aProperty
+
+
lhs.identifier <= rhs.identifier
+
+
i <= index
+
+
$0 <= 0
+
+
keyValues?.count ?? 0 <= 0
+
+
string <= string.lowercased()
+
+
let num: Int? = 0
+_ = num != nil && num <= num?.byteSwapped
+
+
num <= num!.byteSwapped
+
+
1    + 1 <=   1     +    2
+
+
f(  i :   2) <=   f (i: 3 )
+
+
func evaluate(_ mode: CommandMode) -> Result<Options, CommandantError<CommandantError<()>>>
+
+
let array = Array<Array<Int>>()
+
+
guard Set(identifiers).count != identifiers.count else { return }
+
+
expect("foo") == "foo"
+
+
type(of: model).cachePrefix == cachePrefix
+
+
histogram[156].0 == 0x003B8D96 && histogram[156].1 == 1
+
+
[Wrapper(type: .three), Wrapper(type: .one)].sorted { "\($0.type)" > "\($1.type)"}
+
+
array.sorted { "\($0)" < "\($1)" }
+
+

Triggering Examples

+
↓1 == 1
+
+
↓foo == foo
+
+
↓foo.aProperty == foo.aProperty
+
+
↓self.aProperty == self.aProperty
+
+
↓$0 == $0
+
+
↓a?.b == a?.b
+
+
if (↓elem == elem) {}
+
+
XCTAssertTrue(↓s3 == s3)
+
+
if let tab = tabManager.selectedTab, ↓tab.webView == tab.webView
+
+
↓1    + 1 ==   1     +    1
+
+
 ↓f(  i :   2) ==   f (i: 
+ 2 )
+
+
↓1 != 1
+
+
↓foo != foo
+
+
↓foo.aProperty != foo.aProperty
+
+
↓self.aProperty != self.aProperty
+
+
↓$0 != $0
+
+
↓a?.b != a?.b
+
+
if (↓elem != elem) {}
+
+
XCTAssertTrue(↓s3 != s3)
+
+
if let tab = tabManager.selectedTab, ↓tab.webView != tab.webView
+
+
↓1    + 1 !=   1     +    1
+
+
 ↓f(  i :   2) !=   f (i: 
+ 2 )
+
+
↓1 === 1
+
+
↓foo === foo
+
+
↓foo.aProperty === foo.aProperty
+
+
↓self.aProperty === self.aProperty
+
+
↓$0 === $0
+
+
↓a?.b === a?.b
+
+
if (↓elem === elem) {}
+
+
XCTAssertTrue(↓s3 === s3)
+
+
if let tab = tabManager.selectedTab, ↓tab.webView === tab.webView
+
+
↓1    + 1 ===   1     +    1
+
+
 ↓f(  i :   2) ===   f (i: 
+ 2 )
+
+
↓1 !== 1
+
+
↓foo !== foo
+
+
↓foo.aProperty !== foo.aProperty
+
+
↓self.aProperty !== self.aProperty
+
+
↓$0 !== $0
+
+
↓a?.b !== a?.b
+
+
if (↓elem !== elem) {}
+
+
XCTAssertTrue(↓s3 !== s3)
+
+
if let tab = tabManager.selectedTab, ↓tab.webView !== tab.webView
+
+
↓1    + 1 !==   1     +    1
+
+
 ↓f(  i :   2) !==   f (i: 
+ 2 )
+
+
↓1 > 1
+
+
↓foo > foo
+
+
↓foo.aProperty > foo.aProperty
+
+
↓self.aProperty > self.aProperty
+
+
↓$0 > $0
+
+
↓a?.b > a?.b
+
+
if (↓elem > elem) {}
+
+
XCTAssertTrue(↓s3 > s3)
+
+
if let tab = tabManager.selectedTab, ↓tab.webView > tab.webView
+
+
↓1    + 1 >   1     +    1
+
+
 ↓f(  i :   2) >   f (i: 
+ 2 )
+
+
↓1 >= 1
+
+
↓foo >= foo
+
+
↓foo.aProperty >= foo.aProperty
+
+
↓self.aProperty >= self.aProperty
+
+
↓$0 >= $0
+
+
↓a?.b >= a?.b
+
+
if (↓elem >= elem) {}
+
+
XCTAssertTrue(↓s3 >= s3)
+
+
if let tab = tabManager.selectedTab, ↓tab.webView >= tab.webView
+
+
↓1    + 1 >=   1     +    1
+
+
 ↓f(  i :   2) >=   f (i: 
+ 2 )
+
+
↓1 < 1
+
+
↓foo < foo
+
+
↓foo.aProperty < foo.aProperty
+
+
↓self.aProperty < self.aProperty
+
+
↓$0 < $0
+
+
↓a?.b < a?.b
+
+
if (↓elem < elem) {}
+
+
XCTAssertTrue(↓s3 < s3)
+
+
if let tab = tabManager.selectedTab, ↓tab.webView < tab.webView
+
+
↓1    + 1 <   1     +    1
+
+
 ↓f(  i :   2) <   f (i: 
+ 2 )
+
+
↓1 <= 1
+
+
↓foo <= foo
+
+
↓foo.aProperty <= foo.aProperty
+
+
↓self.aProperty <= self.aProperty
+
+
↓$0 <= $0
+
+
↓a?.b <= a?.b
+
+
if (↓elem <= elem) {}
+
+
XCTAssertTrue(↓s3 <= s3)
+
+
if let tab = tabManager.selectedTab, ↓tab.webView <= tab.webView
+
+
↓1    + 1 <=   1     +    1
+
+
 ↓f(  i :   2) <=   f (i: 
+ 2 )
+
+
    return ↓lhs.foo == lhs.foo &&
+           lhs.bar == rhs.bar
+
+
    return lhs.foo == rhs.foo &&
+           ↓lhs.bar == lhs.bar
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/identifier_name.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/identifier_name.html new file mode 100644 index 000000000..3e8da37da --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/identifier_name.html @@ -0,0 +1,582 @@ + + + + identifier_name Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Identifier Name

+ +

Identifier names should only contain alphanumeric characters and start with a lowercase character or should only contain capital letters. In an exception to the above, variable names may start with a capital letter when they are declared as static. Variable names should not be too long or too short.

+ +
    +
  • Identifier: identifier_name
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +min_length + + + + + + + + + + + + + + + +
    KeyValue
    +warning + +3 +
    +error + +2 +
    +
    +max_length + + + + + + + + + + + + + + + +
    KeyValue
    +warning + +40 +
    +error + +60 +
    +
    +excluded + +[“^id$”] +
    +allowed_symbols + +[] +
    +unallowed_symbols_severity + +error +
    +validates_start_with_lowercase + +error +
    +additional_operators + +[“!”, “%”, “&”, “*”, “+”, “-”, “.”, “/”, “<”, “=”, “>”, “?”, “^”, “|”, “~”] +
  • +
+

Non Triggering Examples

+
let myLet = 0
+
+
var myVar = 0
+
+
private let _myLet = 0
+
+
private func _myFunc() {}
+
+
fileprivate let _myLet = 0
+
+
fileprivate func _myFunc() {}
+
+
fileprivate func _myFunc() {}
+
+
class Abc { static let MyLet = 0 }
+
+
let URL: NSURL? = nil
+
+
let XMLString: String? = nil
+
+
override var i = 0
+
+
enum Foo { case myEnum }
+
+
func isOperator(name: String) -> Bool
+
+
func typeForKind(_ kind: SwiftDeclarationKind) -> String
+
+
func == (lhs: SyntaxToken, rhs: SyntaxToken) -> Bool
+
+
override func IsOperator(name: String) -> Bool
+
+
enum Foo { case `private` }
+
+
enum Foo { case value(String) }
+
+
f { $abc in }
+
+
class Foo {
+   static let Bar = 0
+}
+
+
class Foo {
+   static var Bar = 0
+}
+
+
//
+// additional_operators: ["!", "%", "&", "*", "+", "-", ".", "/", "<", "=", ">", "?", "^", "|", "~", "√"]
+//
+
+func √ (arg: Double) -> Double { arg }
+
+
+

Triggering Examples

+
class C { static let ↓_myLet = 0 }
+
+
class C { class let ↓MyLet = 0 }
+
+
class C { static func ↓MyFunc() {} }
+
+
class C { class func ↓MyFunc() {} }
+
+
private let ↓myLet_ = 0
+
+
let ↓myExtremelyVeryVeryVeryVeryVeryVeryLongLet = 0
+
+
var ↓myExtremelyVeryVeryVeryVeryVeryVeryLongVar = 0
+
+
private let ↓_myExtremelyVeryVeryVeryVeryVeryVeryLongLet = 0
+
+
let ↓i = 0
+
+
var ↓aa = 0
+
+
private let ↓_i = 0
+
+
if let ↓_x {}
+
+
guard var ↓x = x else {}
+
+
func myFunc(
+    _ ↓s: String,
+    i ↓j: Int,
+    _ goodName: Double,
+    name ↓n: String,
+    ↓x: Int,
+    abc: Double,
+    _: Double,
+    last _: Double
+) {}
+
+
let (↓a, abc) = (1, 1)
+
+
if let ↓i {}
+
+
for ↓i in [] {}
+
+
f { ↓x in }
+
+
f { ↓$x in }
+
+
f { (x abc: Int, _ ↓x: Int) in }
+
+
enum E {
+    case ↓c
+    case case1(Int)
+    case case2(↓a: Int)
+    case case3(_ ↓a: Int)
+}
+
+
class C {
+    var ↓x: Int {
+        get { 1 }
+        set(↓y) { x = y }
+    }
+}
+
+
func ↓√ (arg: Double) -> Double { arg }
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/img/carat.png b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/img/carat.png new file mode 100755 index 000000000..29d2f7fd4 Binary files /dev/null and b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/img/carat.png differ diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/img/dash.png b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/img/dash.png new file mode 100755 index 000000000..6f694c7a0 Binary files /dev/null and b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/img/dash.png differ diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/img/gh.png b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/img/gh.png new file mode 100755 index 000000000..628da97c7 Binary files /dev/null and b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/img/gh.png differ diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/img/spinner.gif b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/img/spinner.gif new file mode 100644 index 000000000..e3038d0a4 Binary files /dev/null and b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/img/spinner.gif differ diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/implicit_getter.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/implicit_getter.html new file mode 100644 index 000000000..a8dc05666 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/implicit_getter.html @@ -0,0 +1,599 @@ + + + + implicit_getter Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Implicit Getter

+ +

Computed read-only properties and subscripts should avoid using the get keyword.

+ +
    +
  • Identifier: implicit_getter
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class Foo {
+    var foo: Int {
+        get { return 3 }
+        set { _abc = newValue }
+    }
+}
+
+
class Foo {
+    var foo: Int {
+        return 20
+    }
+}
+
+
class Foo {
+    static var foo: Int {
+        return 20
+    }
+}
+
+
class Foo {
+    static var foo: Int {
+        get { return 3 }
+        set { _abc = newValue }
+    }
+}
+
+
class Foo {
+    var foo: Int {
+        get { _foo }
+        _modify { yield &_foo }
+    }
+}
+
+
class Foo {
+    var _foo: Int
+    var foo: Int {
+        @storageRestrictions(initializes: _foo)
+        init { _foo = newValue }
+        get { _foo }
+    }
+}
+
+
class Foo {
+    var foo: Int
+}
+
+
class Foo {
+    var foo: Int {
+        return getValueFromDisk()
+    }
+}
+
+
class Foo {
+    var foo: String {
+        return "get"
+    }
+}
+
+
protocol Foo {
+    var foo: Int { get }
+}
+
+
protocol Foo {
+    var foo: Int { get set }
+}
+
+
class Foo {
+    var foo: Int {
+        struct Bar {
+            var bar: Int {
+                get { return 1 }
+                set { _ = newValue }
+            }
+        }
+
+        return Bar().bar
+    }
+}
+
+
var _objCTaggedPointerBits: UInt {
+    @inline(__always) get { return 0 }
+}
+
+
var next: Int? {
+    mutating get {
+        defer { self.count += 1 }
+        return self.count
+    }
+}
+
+
extension Foo {
+    var bar: Bool {
+        get { _bar }
+        set { self._bar = newValue }
+    }
+}
+
+
extension Foo {
+    var bar: Bool {
+        get { _bar }
+        set(newValue) { self._bar = newValue }
+    }
+}
+
+
extension Float {
+    var clamped: Float {
+        set {
+            self = min(1, max(0, newValue))
+        }
+        get {
+            min(1, max(0, self))
+        }
+    }
+}
+
+
extension Reactive where Base: UITapGestureRecognizer {
+    var tapped: CocoaAction<Base>? {
+        get {
+            return associatedAction.withValue { $0.flatMap { $0.action } }
+        }
+        nonmutating set {
+            setAction(newValue)
+        }
+    }
+}
+
+
extension Test {
+    var foo: Bool {
+        get {
+            bar?.boolValue ?? true // Comment mentioning word set which triggers violation
+        }
+        set {
+            bar = NSNumber(value: newValue as Bool)
+        }
+    }
+}
+
+
class Foo {
+    subscript(i: Int) -> Int {
+        return 20
+    }
+}
+
+
class Foo {
+    subscript(i: Int) -> Int {
+        get { return 3 }
+        set { _abc = newValue }
+    }
+}
+
+
protocol Foo {
+    subscript(i: Int) -> Int { get }
+}
+
+
protocol Foo {
+    subscript(i: Int) -> Int { get set }
+}
+
+
class DatabaseEntity {
+    var isSynced: Bool {
+        get async {
+            await database.isEntitySynced(self)
+        }
+    }
+}
+
+
struct Test {
+    subscript(value: Int) -> Int {
+        get throws {
+            if value == 0 {
+                throw NSError()
+            } else {
+                return value
+            }
+        }
+    }
+}
+
+

Triggering Examples

+
class Foo {
+    var foo: Int {
+        ↓get {
+            return 20
+        }
+    }
+}
+
+
class Foo {
+    var foo: Int {
+        ↓get{ return 20 }
+    }
+}
+
+
class Foo {
+    static var foo: Int {
+        ↓get {
+            return 20
+        }
+    }
+}
+
+
var foo: Int {
+    ↓get { return 20 }
+}
+
+
class Foo {
+    @objc func bar() {}
+    var foo: Int {
+        ↓get {
+            return 20
+        }
+    }
+}
+
+
extension Foo {
+    var bar: Bool {
+        ↓get { _bar }
+    }
+}
+
+
class Foo {
+    subscript(i: Int) -> Int {
+        ↓get {
+            return 20
+        }
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/implicit_return.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/implicit_return.html new file mode 100644 index 000000000..dd2e490c7 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/implicit_return.html @@ -0,0 +1,520 @@ + + + + implicit_return Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Implicit Return

+ +

Prefer implicit returns in closures, functions and getters

+ +
    +
  • Identifier: implicit_return
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +included + +[closure, function, getter, initializer, subscript] +
  • +
+

Non Triggering Examples

+
foo.map { $0 + 1 }
+
+
foo.map({ $0 + 1 })
+
+
foo.map { value in value + 1 }
+
+
[1, 2].first(where: {
+    true
+})
+
+
func foo() -> Int {
+    0
+}
+
+
class Foo {
+    func foo() -> Int { 0 }
+}
+
+
func fetch() -> Data? {
+    do {
+        return try loadData()
+    } catch {
+        return nil
+    }
+}
+
+
func f() -> Int {
+    let i = 4
+    return i
+}
+
+
func f() -> Int {
+    return 3
+    let i = 2
+}
+
+
func f() -> Int {
+    return g()
+    func g() -> Int { 4 }
+}
+
+
var foo: Bool { true }
+
+
class Foo {
+    var bar: Int {
+        get {
+            0
+        }
+    }
+}
+
+
class Foo {
+    static var bar: Int {
+        0
+    }
+}
+
+
class C {
+    let i: Int
+    init(i: Int) {
+        if i < 3 {
+            self.i = 1
+            return
+        }
+        self.i = 2
+    }
+}
+
+
class C {
+    init?() {
+        let i = 1
+        return nil
+    }
+}
+
+
class C {
+    subscript(i: Int) -> Int {
+        let res = i
+        return res
+    }
+}
+
+

Triggering Examples

+
foo.map { value in
+    ↓return value + 1
+}
+
+
foo.map {
+    ↓return $0 + 1
+}
+
+
foo.map({ ↓return $0 + 1})
+
+
[1, 2].first(where: {
+    ↓return true
+})
+
+
func foo() -> Int {
+    ↓return 0
+}
+
+
class Foo {
+    func foo() -> Int { ↓return 0 }
+}
+
+
func f() { ↓return }
+
+
var foo: Bool { ↓return true }
+
+
class Foo {
+    var bar: Int {
+        get {
+            ↓return 0
+        }
+    }
+}
+
+
class Foo {
+    static var bar: Int {
+        ↓return 0
+    }
+}
+
+
class C {
+    init() {
+        ↓return
+    }
+}
+
+
class C {
+    init?() {
+        ↓return nil
+    }
+}
+
+
class C {
+    subscript(i: Int) -> Int {
+        ↓return i
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/implicitly_unwrapped_optional.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/implicitly_unwrapped_optional.html new file mode 100644 index 000000000..b305b1644 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/implicitly_unwrapped_optional.html @@ -0,0 +1,416 @@ + + + + implicitly_unwrapped_optional Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Implicitly Unwrapped Optional

+ +

Implicitly unwrapped optionals should be avoided when possible

+ +
    +
  • Identifier: implicitly_unwrapped_optional
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +mode + +all_except_iboutlets +
  • +
+

Non Triggering Examples

+
@IBOutlet private var label: UILabel!
+
+
@IBOutlet var label: UILabel!
+
+
@IBOutlet var label: [UILabel!]
+
+
if !boolean {}
+
+
let int: Int? = 42
+
+
let int: Int? = nil
+
+

Triggering Examples

+
let label: ↓UILabel!
+
+
let IBOutlet: ↓UILabel!
+
+
let labels: [↓UILabel!]
+
+
var ints: [↓Int!] = [42, nil, 42]
+
+
let label: ↓IBOutlet!
+
+
let int: ↓Int! = 42
+
+
let int: ↓Int! = nil
+
+
var int: ↓Int! = 42
+
+
let collection: AnyCollection<↓Int!>
+
+
func foo(int: ↓Int!) {}
+
+
class MyClass {
+    weak var bar: ↓SomeObject!
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/inclusive_language.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/inclusive_language.html new file mode 100644 index 000000000..6adff3f4d --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/inclusive_language.html @@ -0,0 +1,406 @@ + + + + inclusive_language Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Inclusive Language

+ +

Identifiers should use inclusive language that avoids discrimination against groups of people based on race, gender, or socioeconomic status.

+ +
    +
  • Identifier: inclusive_language
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let foo = "abc"
+
+
enum AllowList {
+    case foo, bar
+}
+
+
func updateAllowList(add: String) {}
+
+
enum WalletItemType {
+    case visa
+    case mastercard
+}
+
+
func chargeMasterCard(_ card: Card) {}
+
+

Triggering Examples

+
let ↓slave = "abc"
+
+
enum ↓BlackList {
+    case foo, bar
+}
+
+
func ↓updateWhiteList(add: String) {}
+
+
enum ListType {
+    case ↓whitelist
+    case ↓blacklist
+}
+
+
init(↓master: String, ↓slave: String) {}
+
+
final class FooBar {
+    func register<↓Master, ↓Slave>(one: Master, two: Slave) {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/indentation_width.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/indentation_width.html new file mode 100644 index 000000000..3608df6a4 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/indentation_width.html @@ -0,0 +1,442 @@ + + + + indentation_width Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Indentation Width

+ +

Indent code using either one tab or the configured amount of spaces, unindent to match previous indentations. Don’t indent the first line.

+ +
    +
  • Identifier: indentation_width
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +indentation_width + +4 +
    +include_comments + +true +
    +include_compiler_directives + +true +
    +include_multiline_strings + +true +
  • +
+

Non Triggering Examples

+
firstLine
+secondLine
+
+
firstLine
+    secondLine
+
+
firstLine
+    secondLine
+        thirdLine
+
+        fourthLine
+
+
firstLine
+    secondLine
+        thirdLine
+    //test
+        fourthLine
+
+
firstLine
+    secondLine
+        thirdLine
+fourthLine
+
+

Triggering Examples

+
↓    firstLine
+
+
firstLine
+        secondLine
+
+
firstLine
+    secondLine
+
+↓         fourthLine
+
+
firstLine
+    secondLine
+        thirdLine
+↓ fourthLine
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/index.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/index.html new file mode 100644 index 000000000..afd554a38 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/index.html @@ -0,0 +1,1307 @@ + + + + SwiftLintCore Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

SwiftLint

+ +

A tool to enforce Swift style and conventions, loosely based on the now +archived GitHub Swift Style Guide. +SwiftLint enforces the style guide rules that are generally accepted by the +Swift community. These rules are well described in popular style guides like +Kodeco’s Swift Style Guide.

+ +

SwiftLint hooks into Clang and +SourceKit to use the +AST representation +of your source files for more accurate results.

+ +

Supported Swift Versions +Supported Platforms +Azure Build Status +Buildkite Build Status

+ +

+ +

This project adheres to the +Contributor Covenant Code of Conduct. +By participating, you are expected to uphold this code.

+ +
+

Switch Language: +中文 +한국어

+
+

Video Introduction

+ +

To get a high-level overview of SwiftLint, we encourage you to watch this +presentation recorded January 9th, 2017 by JP Simard (transcript provided):

+ +

Presentation

+

Installation

+

Swift Package Manager

+ +

SwiftLint can be used as a command plugin +or a build tool plugin.

+ +

Add

+
.package(url: "https://github.com/SimplyDanny/SwiftLintPlugins", from: "<version>")
+
+ +

to your Package.swift file to consume the latest release of SwiftLint +automatically or pin the dependency to a specific version:

+
.package(url: "https://github.com/SimplyDanny/SwiftLintPlugins", exact: "<version>")
+
+ +

Therein, replace <version> with the desired minimum or exact version.

+ +
+

[!NOTE] +Consuming the plugins directly from the SwiftLint repository comes +with several drawbacks. To avoid them and reduce the overhead imposed, it’s +highly recommended to consume the plugins from the dedicated +SwiftLintPlugins repository, +even though plugins from the SwiftLint repository are also absolutely +functional. If the plugins from SwiftLint are preferred, just use the URL +https://github.com/realm/SwiftLint in the package declarations above.

+ +

However, SwiftLintPlugins +facilitates plugin adoption massively. It lists some of the reasons that +drive the plugins as provided by SwiftLint itself very troublesome. Since +the plugin code and the releases are kept in sync, there is no difference +in functionality between the two, but you spare yourself a lot of time and +trouble using the dedicated plugins repository.

+ +

This document assumes you’re relying on SwiftLintPlugins.

+
+

Xcode Package Dependency

+ +

Use the following link to add SwiftLint as a Package Dependency to an Xcode +project:

+
https://github.com/SimplyDanny/SwiftLintPlugins
+
+

Homebrew

+
brew install swiftlint
+
+

CocoaPods

+ +

Add the following to your Podfile:

+
pod 'SwiftLint'
+
+ +

This will download the SwiftLint binaries and dependencies in Pods/ during +your next pod install execution and will allow you to invoke it via +${PODS_ROOT}/SwiftLint/swiftlint in your Script Build Phases.

+ +

Installing via Cocoapods also enables pinning to a specific version of +SwiftLint rather than simply the latest (which is the case with +Homebrew).

+ +

Note that this will add the SwiftLint binaries, its dependencies’ binaries, and +the Swift binary library distribution to the Pods/ directory, so checking in +this directory to SCM such as Git is discouraged.

+

Mint

+
mint install realm/SwiftLint
+
+

Bazel

+ +

Put this in your MODULE.bazel:

+
bazel_dep(name = "swiftlint", version = "0.52.4", repo_name = "SwiftLint")
+
+ +

Or put this in your WORKSPACE:

+ +
+ +WORKSPACE + +“`bzl +load(”@bazel_tools//tools/build_defs/repo:http.bzl", “http_archive”) + +http_archive( + name = “build_bazel_rules_apple”, + sha256 = “390841dd5f8a85fc25776684f4793d56e21b098dfd7243cd145b9831e6ef8be6”, + url = “https://github.com/bazelbuild/rules_apple/releases/download/2.4.1/rules_apple.2.4.1.tar.gz”, +) + +load( + “@build_bazel_rules_apple//apple:repositories.bzl”, + “apple_rules_dependencies”, +) + +apple_rules_dependencies() + +load( + “@build_bazel_rules_swift//swift:repositories.bzl”, + “swift_rules_dependencies”, +) + +swift_rules_dependencies() + +load( + “@build_bazel_rules_swift//swift:extras.bzl”, + “swift_rules_extra_dependencies”, +) + +swift_rules_extra_dependencies() + +http_archive( + name = “SwiftLint”, + sha256 = “c6ea58b9c72082cdc1ada4a2d48273ecc355896ed72204cedcc586b6ccb8aca6”, + url = “https://github.com/realm/SwiftLint/releases/download/0.52.4/bazel.tar.gz”, +) + +load(“@SwiftLint//bazel:repos.bzl”, “swiftlint_repos”) + +swiftlint_repos() + +load(“@SwiftLint//bazel:deps.bzl”, “swiftlint_deps”) + +swiftlint_deps() +“` + +
+ +

Then you can run SwiftLint in the current directory with this command:

+
bazel run -c opt @SwiftLint//:swiftlint
+
+

Pre-Built Package

+ +

Download SwiftLint.pkg from the +latest GitHub release and +run it.

+

From Source

+ +

Make sure the build tool Bazel and a +recent Swift toolchain are +installed and all tools are discoverable in your PATH.

+ +

To build SwiftLint, clone this repository and run make install.

+

Setup

+ +
+

[!IMPORTANT] +While it may seem intuitive to run SwiftLint before compiling Swift source +files to exit a build early when there are lint violations, it is important +to understand that SwiftLint is designed to analyze valid source code that +is compilable. Non-compiling code can very easily lead to unexpected and +confusing results, especially when executing with --fix/--autocorrect +command line arguments.

+
+

Build Tool Plugins

+ +

SwiftLint can be used as a build tool plugin for both +Swift Package projects +and Xcode projects.

+ +

The build tool plugin determines the SwiftLint working directory by locating +the topmost config file within the package/project directory. If a config file +is not found therein, the package/project directory is used as the working +directory.

+ +

The plugin throws an error when it is unable to resolve the SwiftLint working +directory. For example, this will occur in Xcode projects where the target’s +Swift files are not located within the project directory.

+ +

To maximize compatibility with the plugin, avoid project structures that require +the use of the --config option.

+

Swift Package Projects

+ +
+

[!NOTE] +Requires installing via Swift Package Manager.

+
+ +

Build tool plugins run when building each target. When a project has multiple +targets, the plugin must be added to the desired targets individually.

+ +

To do this, add the plugin to the target(s) to be linted as follows:

+
.target(
+    ...
+    plugins: [.plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLintPlugins")]
+),
+
+

Swift Package Command Plugin

+ +
+

[!NOTE] +Requires installing via Swift Package Manager.

+
+ +

The command plugin enables running SwiftLint from the command line as follows:

+
swift package plugin swiftlint
+
+

Xcode Projects

+ +
+

[!NOTE] +Requires installing via Xcode Package Dependency.

+
+ +

Build tool plugins run as a build phase of each target. When a project has +multiple targets, the plugin must be added to the desired targets individually.

+ +

To do this, add the SwiftLintBuildToolPlugin to the Run Build Tool Plug-ins +phase of the Build Phases for the target(s) to be linted.

+ +
+

[!TIP] +When using the plugin for the first time, be sure to trust and enable +it when prompted. If a macros build warning exists, select it to trust +and enable the macros as well.

+
+ +

For unattended use (e.g. on CI), package plugin and macro +validations can be disabled with either of the following:

+ +
    +
  • Using xcodebuild options:
  • +
+
  -skipPackagePluginValidation
+  -skipMacroValidation
+
+ +
    +
  • Setting Xcode defaults:
  • +
+
  defaults write com.apple.dt.Xcode IDESkipPackagePluginFingerprintValidatation -bool YES
+  defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES
+
+ +
+

[!IMPORTANT] +The unattended use options bypass Xcode’s validation dialogs +and implicitly trust all plugins and macros, which has security implications.

+
+

Unexpected Xcode Project Structures

+ +

Project structures where SwiftLint’s configuration file is located +outside of the package/project directory are not directly supported +by the build tool plugin. This is because it isn’t possible to pass +arguments to build tool plugins (e.g., passing the config file path).

+ +

If your project structure doesn’t work directly with the build tool +plugin, please consider one of the following options:

+ +
    +
  • To use a config file located outside the package/project directory, a config +file may be added to that directory specifying a parent config path to the +other config file, e.g., parent_config: path/to/.swiftlint.yml.
  • +
  • You can also consider the use of a +Run Script Build Phase in place of the build +tool plugin.
  • +
+

Xcode Run Script Build Phase

+ +
+

[!NOTE] +Based upon the installation method used, the shell command syntax in the +Run Script Build Phase may be different or additional configuration could +be required. Refer to the installation instructions for +more information.

+
+ +

If the build tool plugin does not work for your project setup or when +additional custom setup is required, SwiftLint can be added as a Run Script +Build Phase. This is useful when a project setup relies on the --config +SwiftLint option; or to lint all targets together in a single swiftlint +invocation. File inclusions and exclusions can be configured in the +.swiftlint.yml configuration.

+ +

To do this, add a custom script to a Run Script phase of the Build Phases +of the primary app target, after the Compile Sources phase. Use the +following script implementation:

+
if command -v swiftlint >/dev/null 2>&1
+then
+    swiftlint
+else
+    echo "warning: `swiftlint` command not found - See https://github.com/realm/SwiftLint#installation for installation instructions."
+fi
+
+ +

If you’re using the SwiftLintPlugin in a Swift package, +you may refer to the swiftlint executable in the +following way:

+
SWIFT_PACKAGE_DIR="${BUILD_DIR%Build/*}SourcePackages/artifacts"
+SWIFTLINT_CMD=$(ls "$SWIFT_PACKAGE_DIR"/swiftlintplugins/SwiftLintBinary/SwiftLintBinary.artifactbundle/swiftlint-*/bin/swiftlint | head -n 1)
+
+if test -f "$SWIFTLINT_CMD" 2>&1
+then
+    "$SWIFTLINT_CMD"
+else
+    echo "warning: `swiftlint` command not found - See https://github.com/realm/SwiftLint#installation for installation instructions."
+fi
+
+ +
+

[!NOTE] +The SWIFTLINT_CMD path uses the default Xcode configuration and has been +tested on Xcode 15/16. In case of another configuration (e.g. a custom +Swift package path), please adapt the values accordingly.

+ +

[!TIP] +Uncheck Based on dependency analysis to run swiftlint on all incremental +builds, suppressing the unspecified outputs warning.

+
+

Consideration for Xcode 15.0

+ +

Xcode 15 made a significant change by setting the default value of the +ENABLE_USER_SCRIPT_SANDBOXING build setting from NO to YES. +As a result, SwiftLint encounters an error related to missing file permissions, +which typically manifests as +error: Sandbox: swiftlint(19427) deny(1) file-read-data.

+ +

To resolve this issue, it is necessary to manually set the +ENABLE_USER_SCRIPT_SANDBOXING setting to NO for the specific target that +SwiftLint is being configured for.

+

Consideration for Apple Silicon

+ +

If you installed SwiftLint via Homebrew on Apple Silicon, you might experience +this warning:

+
warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint
+
+ +

That is because Homebrew on Apple Silicon installs the binaries into the +/opt/homebrew/bin folder by default. To instruct Xcode where to find +SwiftLint, you can either add /opt/homebrew/bin to the PATH environment +variable in your build phase:

+
if [[ "$(uname -m)" == arm64 ]]
+then
+    export PATH="/opt/homebrew/bin:$PATH"
+fi
+
+if command -v swiftlint >/dev/null 2>&1
+then
+    swiftlint
+else
+    echo "warning: `swiftlint` command not found - See https://github.com/realm/SwiftLint#installation for installation instructions."
+fi
+
+ +

or you can create a symbolic link in /usr/local/bin pointing to the actual +binary:

+
ln -s /opt/homebrew/bin/swiftlint /usr/local/bin/swiftlint
+
+

Additional Considerations

+ +

If you wish to fix violations as well, your script could run +swiftlint --fix && swiftlint instead of just swiftlint. This will mean +that all correctable violations are fixed while ensuring warnings show up in +your project for remaining violations.

+ +

If you’ve installed SwiftLint via CocoaPods the script should look like this:

+
"${PODS_ROOT}/SwiftLint/swiftlint"
+
+

Visual Studio Code

+ +

To integrate SwiftLint with Visual Studio Code, install the +vscode-swiftlint +extension from the marketplace.

+

Fastlane

+ +

You can use the official +swiftlint fastlane action +to run SwiftLint as part of your fastlane process.

+
swiftlint(
+    mode: :lint,                            # SwiftLint mode: :lint (default) or :autocorrect
+    executable: "Pods/SwiftLint/swiftlint", # The SwiftLint binary path (optional). Important if you've installed it via CocoaPods
+    path: "/path/to/lint",                  # Specify path to lint (optional)
+    output_file: "swiftlint.result.json",   # The path of the output file (optional)
+    reporter: "json",                       # The custom reporter to use (optional)
+    config_file: ".swiftlint-ci.yml",       # The path of the configuration file (optional)
+    files: [                                # List of files to process (optional)
+        "AppDelegate.swift",
+        "path/to/project/Model.swift"
+    ],
+    ignore_exit_status: true,               # Allow fastlane to continue even if SwiftLint returns a non-zero exit status (Default: false)
+    quiet: true,                            # Don't print status logs like 'Linting ' & 'Done linting' (Default: false)
+    strict: true                            # Fail on warnings? (Default: false)
+)
+
+

Docker

+ +

SwiftLint is also available as a Docker image using +Ubuntu. So just the first time you need to pull the docker image using the +next command:

+
docker pull ghcr.io/realm/swiftlint:latest
+
+ +

Then following times, you just run swiftlint inside of the docker like:

+
docker run -it -v `pwd`:`pwd` -w `pwd` ghcr.io/realm/swiftlint:latest
+
+ +

This will execute swiftlint in the folder where you are right now (pwd), +showing an output like:

+
$ docker run -it -v `pwd`:`pwd` -w `pwd` ghcr.io/realm/swiftlint:latest
+Linting Swift files in current working directory
+Linting 'RuleDocumentation.swift' (1/490)
+...
+Linting 'YamlSwiftLintTests.swift' (490/490)
+Done linting! Found 0 violations, 0 serious in 490 files.
+
+ +

Here you have more documentation about the usage of +Docker Images.

+

Command Line Usage

+
$ swiftlint help
+OVERVIEW: A tool to enforce Swift style and conventions.
+
+USAGE: swiftlint <subcommand>
+
+OPTIONS:
+  --version               Show the version.
+  -h, --help              Show help information.
+
+SUBCOMMANDS:
+  analyze                 Run analysis rules
+  docs                    Open SwiftLint documentation website in the default web browser
+  generate-docs           Generates markdown documentation for selected group of rules
+  lint (default)          Print lint warnings and errors
+  baseline                Operations on existing baselines
+  reporters               Display the list of reporters and their identifiers
+  rules                   Display the list of rules and their identifiers
+  version                 Display the current version of SwiftLint
+
+  See 'swiftlint help <subcommand>' for detailed help.
+
+ +

Run swiftlint in the directory containing the Swift files to lint. Directories +will be searched recursively.

+ +

To specify a list of files when using lint or analyze +(like the list of files modified by Xcode specified by the +ExtraBuildPhase Xcode +plugin, or modified files in the working tree based on git ls-files -m), you +can do so by passing the option --use-script-input-files and setting the +following instance variables: SCRIPT_INPUT_FILE_COUNT +and SCRIPT_INPUT_FILE_0, SCRIPT_INPUT_FILE_1, …, +SCRIPT_INPUT_FILE_{SCRIPT_INPUT_FILE_COUNT - 1}. +Similarly, files can be read from file lists by passing +the option --use-script-input-file-lists and setting the +following instance variables: SCRIPT_INPUT_FILE_LIST_COUNT +and SCRIPT_INPUT_FILE_LIST_0, SCRIPT_INPUT_FILE_LIST_1, …, +SCRIPT_INPUT_FILE_LIST_{SCRIPT_INPUT_FILE_LIST_COUNT - 1}.

+ +

These are same environment variables set for input files to +custom Xcode script phases.

+

Working With Multiple Swift Versions

+ +

SwiftLint hooks into SourceKit so it continues working even as Swift evolves!

+ +

This also keeps SwiftLint lean, as it doesn’t need to ship with a full Swift +compiler, it just communicates with the official one you already have installed +on your machine.

+ +

You should always run SwiftLint with the same toolchain you use to compile your +code.

+ +

You may want to override SwiftLint’s default Swift toolchain if you have +multiple toolchains or Xcodes installed.

+ +

Here’s the order in which SwiftLint determines which Swift toolchain to use:

+ +
    +
  • $XCODE_DEFAULT_TOOLCHAIN_OVERRIDE
  • +
  • $TOOLCHAIN_DIR or $TOOLCHAINS
  • +
  • xcrun -find swift
  • +
  • /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
  • +
  • /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
  • +
  • ~/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
  • +
  • ~/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
  • +
+ +

sourcekitd.framework is expected to be found in the usr/lib/ subdirectory of +the value passed in the paths above.

+ +

You may also set the TOOLCHAINS environment variable to the reverse-DNS +notation that identifies a Swift toolchain version:

+
TOOLCHAINS=com.apple.dt.toolchain.Swift_2_3 swiftlint --fix
+
+ +

On Linux, SourceKit is expected to be located in +/usr/lib/libsourcekitdInProc.so or specified by the LINUX_SOURCEKIT_LIB_PATH +environment variable.

+

Git pre-commit Hook

+ +

SwiftLint can be run as a pre-commit hook. +Once installed, add this to the +.pre-commit-config.yaml in the root of your repository:

+
repos:
+  - repo: https://github.com/realm/SwiftLint
+    rev: 0.57.1
+    hooks:
+      - id: swiftlint
+
+ +

Adjust rev to the SwiftLint version of your choice. pre-commit autoupdate +can be used to update to the current version.

+ +

SwiftLint can be configured using entry to apply fixes and fail on errors:

+
-   repo: https://github.com/realm/SwiftLint
+    rev: 0.57.1
+    hooks:
+    -   id: swiftlint
+        entry: swiftlint --fix --strict
+
+

Rules

+ +

Over 200 rules are included in SwiftLint and the Swift community (that’s you!) +continues to contribute more over time. +Pull requests +are encouraged.

+ +

You can find an updated list of rules and more information about them +here.

+ +

You can also check the +Source/SwiftLintBuiltInRules/Rules +directory to see their implementation.

+

Opt-In Rules

+ +

opt_in_rules are disabled by default (i.e., you have to explicitly enable them +in your configuration file).

+ +

Guidelines on when to mark a rule as opt-in:

+ +
    +
  • A rule that can have many false positives (e.g. empty_count)
  • +
  • A rule that is too slow
  • +
  • A rule that is not general consensus or is only useful in some cases +(e.g. force_unwrapping)
  • +
+

Disable rules in code

+ +

Rules can be disabled with a comment inside a source file with the following +format:

+ +

// swiftlint:disable <rule1> [<rule2> <rule3>...]

+ +

The rules will be disabled until the end of the file or until the linter sees a +matching enable comment:

+ +

// swiftlint:enable <rule1> [<rule2> <rule3>...]

+ +

For example:

+
// swiftlint:disable colon
+let noWarning :String = "" // No warning about colons immediately after variable names!
+// swiftlint:enable colon
+let hasWarning :String = "" // Warning generated about colons immediately after variable names
+
+ +

Including the all keyword will disable all rules until the linter sees a +matching enable comment:

+ +

// swiftlint:disable all +// swiftlint:enable all

+ +

For example:

+
// swiftlint:disable all
+let noWarning :String = "" // No warning about colons immediately after variable names!
+let i = "" // Also no warning about short identifier names
+// swiftlint:enable all
+let hasWarning :String = "" // Warning generated about colons immediately after variable names
+let y = "" // Warning generated about short identifier names
+
+ +

It’s also possible to modify a disable or enable command by appending +:previous, :this or :next for only applying the command to the previous, +this (current) or next line respectively.

+ +

For example:

+
// swiftlint:disable:next force_cast
+let noWarning = NSNumber() as! Int
+let hasWarning = NSNumber() as! Int
+let noWarning2 = NSNumber() as! Int // swiftlint:disable:this force_cast
+let noWarning3 = NSNumber() as! Int
+// swiftlint:disable:previous force_cast
+
+ +

Run swiftlint rules to print a list of all available rules and their +identifiers.

+

Configuration

+ +

Configure SwiftLint by adding a .swiftlint.yml file from the directory you’ll +run SwiftLint from. The following parameters can be configured:

+ +

Rule inclusion:

+ +
    +
  • disabled_rules: Disable rules from the default enabled set.
  • +
  • opt_in_rules: Enable rules that are not part of the default set. The +special all identifier will enable all opt in linter rules, except the ones +listed in disabled_rules.
  • +
  • only_rules: Only the rules specified in this list will be enabled. +Cannot be specified alongside disabled_rules or opt_in_rules.
  • +
  • analyzer_rules: This is an entirely separate list of rules that are only +run by the analyze command. All analyzer rules are opt-in, so this is the +only configurable rule list, there are no equivalents for disabled_rules +and only_rules. The special all identifier can also be used here to enable +all analyzer rules, except the ones listed in disabled_rules.
  • +
+
# By default, SwiftLint uses a set of sensible default rules you can adjust:
+disabled_rules: # rule identifiers turned on by default to exclude from running
+  - colon
+  - comma
+  - control_statement
+opt_in_rules: # some rules are turned off by default, so you need to opt-in
+  - empty_count # find all the available rules by running: `swiftlint rules`
+
+# Alternatively, specify all rules explicitly by uncommenting this option:
+# only_rules: # delete `disabled_rules` & `opt_in_rules` if using this
+#   - empty_parameters
+#   - vertical_whitespace
+
+analyzer_rules: # rules run by `swiftlint analyze`
+  - explicit_self
+
+# Case-sensitive paths to include during linting. Directory paths supplied on the
+# command line will be ignored.
+included: 
+  - Sources
+excluded: # case-sensitive paths to ignore during linting. Takes precedence over `included`
+  - Carthage
+  - Pods
+  - Sources/ExcludedFolder
+  - Sources/ExcludedFile.swift
+  - Sources/*/ExcludedFile.swift # exclude files with a wildcard
+
+# If true, SwiftLint will not fail if no lintable files are found.
+allow_zero_lintable_files: false
+
+# If true, SwiftLint will treat all warnings as errors.
+strict: false
+
+# If true, SwiftLint will treat all errors as warnings.
+lenient: false
+
+# The path to a baseline file, which will be used to filter out detected violations.
+baseline: Baseline.json
+
+# The path to save detected violations to as a new baseline.
+write_baseline: Baseline.json
+
+# If true, SwiftLint will check for updates after linting or analyzing.
+check_for_updates: true
+
+# configurable rules can be customized from this configuration file
+# binary rules can set their severity level
+force_cast: warning # implicitly
+force_try:
+  severity: warning # explicitly
+# rules that have both warning and error levels, can set just the warning level
+# implicitly
+line_length: 110
+# they can set both implicitly with an array
+type_body_length:
+  - 300 # warning
+  - 400 # error
+# or they can set both explicitly
+file_length:
+  warning: 500
+  error: 1200
+# naming rules can set warnings/errors for min_length and max_length
+# additionally they can set excluded names
+type_name:
+  min_length: 4 # only warning
+  max_length: # warning and error
+    warning: 40
+    error: 50
+  excluded: iPhone # excluded via string
+  allowed_symbols: ["_"] # these are allowed in type names
+identifier_name:
+  min_length: # only min_length
+    error: 4 # only error
+  excluded: # excluded via string array
+    - id
+    - URL
+    - GlobalAPIKey
+reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, codeclimate, junit, html, emoji, sonarqube, markdown, github-actions-logging, summary)
+
+ +

You can also use environment variables in your configuration file, +by using ${SOME_VARIABLE} in a string.

+

Defining Custom Rules

+ +

In addition to the rules that the main SwiftLint project ships with, SwiftLint +can also run two types of custom rules that you can define yourself in your own +projects:

+

1. Swift Custom Rules

+ +

These rules are written the same way as the Swift-based rules that ship with +SwiftLint so they’re fast, accurate, can leverage SwiftSyntax, can be unit +tested, and more.

+ +

Using these requires building SwiftLint with Bazel as described in +this video or its associated code in +github.com/jpsim/swiftlint-bazel-example.

+

2. Regex Custom Rules

+ +

You can define custom regex-based rules in your configuration file using the +following syntax:

+
custom_rules:
+  pirates_beat_ninjas: # rule identifier
+    included:
+      - ".*\\.swift" # regex that defines paths to include during linting. optional.
+    excluded:
+      - ".*Test\\.swift" # regex that defines paths to exclude during linting. optional
+    name: "Pirates Beat Ninjas" # rule name. optional.
+    regex: "([nN]inja)" # matching pattern
+    capture_group: 0 # number of regex capture group to highlight the rule violation at. optional.
+    match_kinds: # SyntaxKinds to match. optional.
+      - comment
+      - identifier
+    message: "Pirates are better than ninjas." # violation message. optional.
+    severity: error # violation severity. optional.
+  no_hiding_in_strings:
+    regex: "([nN]inja)"
+    match_kinds: string
+
+ +

This is what the output would look like:

+ +

+ +

It is important to note that the regular expression pattern is used with the +flags s and m enabled, that is . +matches newlines +and ^/$ +match the start and end of lines, +respectively. If you do not want to have . match newlines, for example, the +regex can be prepended by (?-s).

+ +

You can filter the matches by providing one or more match_kinds, which will +reject matches that include syntax kinds that are not present in this list. Here +are all the possible syntax kinds:

+ +
    +
  • argument
  • +
  • attribute.builtin
  • +
  • attribute.id
  • +
  • buildconfig.id
  • +
  • buildconfig.keyword
  • +
  • comment
  • +
  • comment.mark
  • +
  • comment.url
  • +
  • doccomment
  • +
  • doccomment.field
  • +
  • identifier
  • +
  • keyword
  • +
  • number
  • +
  • objectliteral
  • +
  • parameter
  • +
  • placeholder
  • +
  • string
  • +
  • string_interpolation_anchor
  • +
  • typeidentifier
  • +
+ +

All syntax kinds used in a snippet of Swift code can be extracted asking +SourceKitten. For example, +sourcekitten syntax --text "struct S {}" delivers

+ +
    +
  • source.lang.swift.syntaxtype.keyword for the struct keyword and
  • +
  • source.lang.swift.syntaxtype.identifier for its name S
  • +
+ +

which match to keyword and identifier in the above list.

+ +

If using custom rules in combination with only_rules, you must include the +literal string custom_rules in the only_rules list:

+
only_rules:
+  - custom_rules
+
+custom_rules:
+  no_hiding_in_strings:
+    regex: "([nN]inja)"
+    match_kinds: string
+
+ +

Unlike Swift custom rules, you can use official SwiftLint builds +(e.g. from Homebrew) to run regex custom rules.

+

Auto-correct

+ +

SwiftLint can automatically correct certain violations. Files on disk are +overwritten with a corrected version.

+ +

Please make sure to have backups of these files before running +swiftlint --fix, otherwise important data may be lost.

+ +

Standard linting is disabled while correcting because of the high likelihood of +violations (or their offsets) being incorrect after modifying a file while +applying corrections.

+

Analyze

+ +

The swiftlint analyze command can lint Swift files using the +full type-checked AST. The compiler log path containing the clean swiftc build +command invocation (incremental builds will fail) must be passed to analyze +via the --compiler-log-path flag. +e.g. --compiler-log-path /path/to/xcodebuild.log

+ +

This can be obtained by

+ +
    +
  1. Cleaning DerivedData (incremental builds won’t work with analyze)
  2. +
  3. Running xcodebuild -workspace {WORKSPACE}.xcworkspace -scheme {SCHEME} > xcodebuild.log
  4. +
  5. Running swiftlint analyze --compiler-log-path xcodebuild.log
  6. +
+ +

Analyzer rules tend to be considerably slower than lint rules.

+

Using Multiple Configuration Files

+ +

SwiftLint offers a variety of ways to include multiple configuration files. +Multiple configuration files get merged into one single configuration that is +then applied just as a single configuration file would get applied.

+ +

There are quite a lot of use cases where using multiple configuration files +could be helpful:

+ +

For instance, one could use a team-wide shared SwiftLint configuration while +allowing overrides in each project via a child configuration file.

+ +

Team-Wide Configuration:

+
disabled_rules:
+- force_cast
+
+ +

Project-Specific Configuration:

+
opt_in_rules:
+- force_cast
+
+

Child/Parent Configs (Locally)

+ +

You can specify a child_config and/or a parent_config reference within a +configuration file. These references should be local paths relative to the +folder of the configuration file they are specified in. This even works +recursively, as long as there are no cycles and no ambiguities.

+ +

A child config is treated as a refinement and thus has a higher priority, +while a parent config is considered a base with lower priority in case of +conflicts.

+ +

Here’s an example, assuming you have the following file structure:

+
ProjectRoot
+    |_ .swiftlint.yml
+    |_ .swiftlint_refinement.yml
+    |_ Base
+        |_ .swiftlint_base.yml
+
+ +

To include both the refinement and the base file, your .swiftlint.yml should +look like this:

+
child_config: .swiftlint_refinement.yml
+parent_config: Base/.swiftlint_base.yml
+
+ +

When merging parent and child configs, included and excluded configurations +are processed carefully to account for differences in the directory location +of the containing configuration files.

+

Child/Parent Configs (Remote)

+ +

Just as you can provide local child_config/parent_config references, +instead of referencing local paths, you can just put urls that lead to +configuration files. In order for SwiftLint to detect these remote references, +they must start with http:// or https://.

+ +

The referenced remote configuration files may even recursively reference other +remote configuration files, but aren’t allowed to include local references.

+ +

Using a remote reference, your .swiftlint.yml could look like this:

+
parent_config: https://myteamserver.com/our-base-swiftlint-config.yml
+
+ +

Every time you run SwiftLint and have an Internet connection, SwiftLint tries +to get a new version of every remote configuration that is referenced. If this +request times out, a cached version is used if available. If there is no cached +version available, SwiftLint fails – but no worries, a cached version should be +there once SwiftLint has run successfully at least once.

+ +

If needed, the timeouts for the remote configuration fetching can be specified +manually via the configuration file(s) using the +remote_timeout/remote_timeout_if_cached specifiers. These values default +to 2 seconds or 1 second, respectively.

+

Command Line

+ +

Instead of just providing one configuration file when running SwiftLint via the +command line, you can also pass a hierarchy, where the first configuration is +treated as a parent, while the last one is treated as the highest-priority +child.

+ +

A simple example including just two configuration files looks like this:

+ +

swiftlint --config .swiftlint.yml --config .swiftlint_child.yml

+

Nested Configurations

+ +

In addition to a main configuration (the .swiftlint.yml file in the root +folder), you can put other configuration files named .swiftlint.yml into the +directory structure that then get merged as a child config, but only with an +effect for those files that are within the same directory as the config or in a +deeper directory where there isn’t another configuration file. In other words: +Nested configurations don’t work recursively – there’s a maximum number of one +nested configuration per file that may be applied in addition to the main +configuration.

+ +

.swiftlint.yml files are only considered as a nested configuration if they +have not been used to build the main configuration already (e. g. by having +been referenced via something like child_config: Folder/.swiftlint.yml). +Also, parent_config/child_config specifications of nested configurations +are getting ignored because there’s no sense to that.

+ +

If one (or more) SwiftLint file(s) are explicitly specified via the --config +parameter, that configuration will be treated as an override, no matter whether +there exist other .swiftlint.yml files somewhere within the directory. +So if you want to use nested configurations, you can’t use the --config +parameter.

+

License

+ +

MIT licensed.

+

About

+ +

SwiftLint is utterly maintained by volunteers contributing to its success +entirely in their free time. As such, SwiftLint isn’t a commercial product +in any way.

+ +

Be kind to the people maintaining SwiftLint as a hobby and accept that their +time is limited. Support them by contributing to the project, reporting issues, +and helping others in the community.

+ +

Special thanks go to MacStadium for providing +physical Mac mini machines to run our performance tests.

+ +

+ +

We also thank Realm (now MongoDB) for their inital contributions and setup of +the project.

+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/invalid_swiftlint_command.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/invalid_swiftlint_command.html new file mode 100644 index 000000000..f87fee9d5 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/invalid_swiftlint_command.html @@ -0,0 +1,414 @@ + + + + invalid_swiftlint_command Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Invalid SwiftLint Command

+ +

swiftlint command is invalid

+ +
    +
  • Identifier: invalid_swiftlint_command
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
// swiftlint:disable unused_import
+
+
// swiftlint:enable unused_import
+
+
// swiftlint:disable:next unused_import
+
+
// swiftlint:disable:previous unused_import
+
+
// swiftlint:disable:this unused_import
+
+
//swiftlint:disable:this unused_import
+
+

Triggering Examples

+
// ↓swiftlint:
+
+
// ↓swiftlint: 
+
+
// ↓swiftlint::
+
+
// ↓swiftlint:: 
+
+
// ↓swiftlint:disable
+
+
// ↓swiftlint:dissable unused_import
+
+
// ↓swiftlint:enaaaable unused_import
+
+
// ↓swiftlint:disable:nxt unused_import
+
+
// ↓swiftlint:enable:prevus unused_import
+
+
// ↓swiftlint:enable:ths unused_import
+
+
// ↓swiftlint:enable
+
+
// ↓swiftlint:enable:
+
+
// ↓swiftlint:enable: 
+
+
// ↓swiftlint:disable: unused_import
+
+
// s↓swiftlint:disable unused_import
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/is_disjoint.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/is_disjoint.html new file mode 100644 index 000000000..e5b10d499 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/is_disjoint.html @@ -0,0 +1,384 @@ + + + + is_disjoint Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Is Disjoint

+ +

Prefer using Set.isDisjoint(with:) over Set.intersection(_:).isEmpty

+ +
    +
  • Identifier: is_disjoint
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
_ = Set(syntaxKinds).isDisjoint(with: commentAndStringKindsSet)
+
+
let isObjc = !objcAttributes.isDisjoint(with: dictionary.enclosedSwiftAttributes)
+
+
_ = Set(syntaxKinds).intersection(commentAndStringKindsSet)
+
+
_ = !objcAttributes.intersection(dictionary.enclosedSwiftAttributes)
+
+

Triggering Examples

+
_ = Set(syntaxKinds).↓intersection(commentAndStringKindsSet).isEmpty
+
+
let isObjc = !objcAttributes.↓intersection(dictionary.enclosedSwiftAttributes).isEmpty
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/joined_default_parameter.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/joined_default_parameter.html new file mode 100644 index 000000000..8f6bc621b --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/joined_default_parameter.html @@ -0,0 +1,387 @@ + + + + joined_default_parameter Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Joined Default Parameter

+ +

Discouraged explicit usage of the default separator

+ +
    +
  • Identifier: joined_default_parameter
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let foo = bar.joined()
+
+
let foo = bar.joined(separator: ",")
+
+
let foo = bar.joined(separator: toto)
+
+

Triggering Examples

+
let foo = bar.joined(↓separator: "")
+
+
let foo = bar.filter(toto)
+             .joined(↓separator: ""),
+
+
func foo() -> String {
+  return ["1", "2"].joined(↓separator: "")
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/js/jazzy.js b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/js/jazzy.js new file mode 100755 index 000000000..198441660 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/js/jazzy.js @@ -0,0 +1,74 @@ +// Jazzy - https://github.com/realm/jazzy +// Copyright Realm Inc. +// SPDX-License-Identifier: MIT + +window.jazzy = {'docset': false} +if (typeof window.dash != 'undefined') { + document.documentElement.className += ' dash' + window.jazzy.docset = true +} +if (navigator.userAgent.match(/xcode/i)) { + document.documentElement.className += ' xcode' + window.jazzy.docset = true +} + +function toggleItem($link, $content) { + var animationDuration = 300; + $link.toggleClass('token-open'); + $content.slideToggle(animationDuration); +} + +function itemLinkToContent($link) { + return $link.parent().parent().next(); +} + +// On doc load + hash-change, open any targetted item +function openCurrentItemIfClosed() { + if (window.jazzy.docset) { + return; + } + var $link = $(`a[name="${location.hash.substring(1)}"]`).nextAll('.token'); + $content = itemLinkToContent($link); + if ($content.is(':hidden')) { + toggleItem($link, $content); + } +} + +$(openCurrentItemIfClosed); +$(window).on('hashchange', openCurrentItemIfClosed); + +// On item link ('token') click, toggle its discussion +$('.token').on('click', function(event) { + if (window.jazzy.docset) { + return; + } + var $link = $(this); + toggleItem($link, itemLinkToContent($link)); + + // Keeps the document from jumping to the hash. + var href = $link.attr('href'); + if (history.pushState) { + history.pushState({}, '', href); + } else { + location.hash = href; + } + event.preventDefault(); +}); + +// Clicks on links to the current, closed, item need to open the item +$("a:not('.token')").on('click', function() { + if (location == this.href) { + openCurrentItemIfClosed(); + } +}); + +// KaTeX rendering +if ("katex" in window) { + $($('.math').each( (_, element) => { + katex.render(element.textContent, element, { + displayMode: $(element).hasClass('m-block'), + throwOnError: false, + trust: true + }); + })) +} diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/js/jazzy.search.js b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/js/jazzy.search.js new file mode 100644 index 000000000..359cdbb8b --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/js/jazzy.search.js @@ -0,0 +1,74 @@ +// Jazzy - https://github.com/realm/jazzy +// Copyright Realm Inc. +// SPDX-License-Identifier: MIT + +$(function(){ + var $typeahead = $('[data-typeahead]'); + var $form = $typeahead.parents('form'); + var searchURL = $form.attr('action'); + + function displayTemplate(result) { + return result.name; + } + + function suggestionTemplate(result) { + var t = '
'; + t += '' + result.name + ''; + if (result.parent_name) { + t += '' + result.parent_name + ''; + } + t += '
'; + return t; + } + + $typeahead.one('focus', function() { + $form.addClass('loading'); + + $.getJSON(searchURL).then(function(searchData) { + const searchIndex = lunr(function() { + this.ref('url'); + this.field('name'); + this.field('abstract'); + for (const [url, doc] of Object.entries(searchData)) { + this.add({url: url, name: doc.name, abstract: doc.abstract}); + } + }); + + $typeahead.typeahead( + { + highlight: true, + minLength: 3, + autoselect: true + }, + { + limit: 10, + display: displayTemplate, + templates: { suggestion: suggestionTemplate }, + source: function(query, sync) { + const lcSearch = query.toLowerCase(); + const results = searchIndex.query(function(q) { + q.term(lcSearch, { boost: 100 }); + q.term(lcSearch, { + boost: 10, + wildcard: lunr.Query.wildcard.TRAILING + }); + }).map(function(result) { + var doc = searchData[result.ref]; + doc.url = result.ref; + return doc; + }); + sync(results); + } + } + ); + $form.removeClass('loading'); + $typeahead.trigger('focus'); + }); + }); + + var baseURL = searchURL.slice(0, -"search.json".length); + + $typeahead.on('typeahead:select', function(e, result) { + window.location = baseURL + result.url; + }); +}); diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/js/jquery.min.js b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/js/jquery.min.js new file mode 100644 index 000000000..7f37b5d99 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/js/jquery.min.js @@ -0,0 +1,2 @@ +/*! jQuery v3.7.1 | (c) OpenJS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(ie,e){"use strict";var oe=[],r=Object.getPrototypeOf,ae=oe.slice,g=oe.flat?function(e){return oe.flat.call(e)}:function(e){return oe.concat.apply([],e)},s=oe.push,se=oe.indexOf,n={},i=n.toString,ue=n.hasOwnProperty,o=ue.toString,a=o.call(Object),le={},v=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},y=function(e){return null!=e&&e===e.window},C=ie.document,u={type:!0,src:!0,nonce:!0,noModule:!0};function m(e,t,n){var r,i,o=(n=n||C).createElement("script");if(o.text=e,t)for(r in u)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[i.call(e)]||"object":typeof e}var t="3.7.1",l=/HTML$/i,ce=function(e,t){return new ce.fn.init(e,t)};function c(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!v(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+ge+")"+ge+"*"),x=new RegExp(ge+"|>"),j=new RegExp(g),A=new RegExp("^"+t+"$"),D={ID:new RegExp("^#("+t+")"),CLASS:new RegExp("^\\.("+t+")"),TAG:new RegExp("^("+t+"|[*])"),ATTR:new RegExp("^"+p),PSEUDO:new RegExp("^"+g),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ge+"*(even|odd|(([+-]|)(\\d*)n|)"+ge+"*(?:([+-]|)"+ge+"*(\\d+)|))"+ge+"*\\)|)","i"),bool:new RegExp("^(?:"+f+")$","i"),needsContext:new RegExp("^"+ge+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ge+"*((?:-\\d)?\\d*)"+ge+"*\\)|)(?=[^-]|$)","i")},N=/^(?:input|select|textarea|button)$/i,q=/^h\d$/i,L=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,H=/[+~]/,O=new RegExp("\\\\[\\da-fA-F]{1,6}"+ge+"?|\\\\([^\\r\\n\\f])","g"),P=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},M=function(){V()},R=J(function(e){return!0===e.disabled&&fe(e,"fieldset")},{dir:"parentNode",next:"legend"});try{k.apply(oe=ae.call(ye.childNodes),ye.childNodes),oe[ye.childNodes.length].nodeType}catch(e){k={apply:function(e,t){me.apply(e,ae.call(t))},call:function(e){me.apply(e,ae.call(arguments,1))}}}function I(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(V(e),e=e||T,C)){if(11!==p&&(u=L.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return k.call(n,a),n}else if(f&&(a=f.getElementById(i))&&I.contains(e,a)&&a.id===i)return k.call(n,a),n}else{if(u[2])return k.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&e.getElementsByClassName)return k.apply(n,e.getElementsByClassName(i)),n}if(!(h[t+" "]||d&&d.test(t))){if(c=t,f=e,1===p&&(x.test(t)||m.test(t))){(f=H.test(t)&&U(e.parentNode)||e)==e&&le.scope||((s=e.getAttribute("id"))?s=ce.escapeSelector(s):e.setAttribute("id",s=S)),o=(l=Y(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+Q(l[o]);c=l.join(",")}try{return k.apply(n,f.querySelectorAll(c)),n}catch(e){h(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return re(t.replace(ve,"$1"),e,n,r)}function W(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function F(e){return e[S]=!0,e}function $(e){var t=T.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function B(t){return function(e){return fe(e,"input")&&e.type===t}}function _(t){return function(e){return(fe(e,"input")||fe(e,"button"))&&e.type===t}}function z(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&R(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function X(a){return F(function(o){return o=+o,F(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function U(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function V(e){var t,n=e?e.ownerDocument||e:ye;return n!=T&&9===n.nodeType&&n.documentElement&&(r=(T=n).documentElement,C=!ce.isXMLDoc(T),i=r.matches||r.webkitMatchesSelector||r.msMatchesSelector,r.msMatchesSelector&&ye!=T&&(t=T.defaultView)&&t.top!==t&&t.addEventListener("unload",M),le.getById=$(function(e){return r.appendChild(e).id=ce.expando,!T.getElementsByName||!T.getElementsByName(ce.expando).length}),le.disconnectedMatch=$(function(e){return i.call(e,"*")}),le.scope=$(function(){return T.querySelectorAll(":scope")}),le.cssHas=$(function(){try{return T.querySelector(":has(*,:jqfake)"),!1}catch(e){return!0}}),le.getById?(b.filter.ID=function(e){var t=e.replace(O,P);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(O,P);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)},b.find.CLASS=function(e,t){if("undefined"!=typeof t.getElementsByClassName&&C)return t.getElementsByClassName(e)},d=[],$(function(e){var t;r.appendChild(e).innerHTML="",e.querySelectorAll("[selected]").length||d.push("\\["+ge+"*(?:value|"+f+")"),e.querySelectorAll("[id~="+S+"-]").length||d.push("~="),e.querySelectorAll("a#"+S+"+*").length||d.push(".#.+[+~]"),e.querySelectorAll(":checked").length||d.push(":checked"),(t=T.createElement("input")).setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),r.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&d.push(":enabled",":disabled"),(t=T.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||d.push("\\["+ge+"*name"+ge+"*="+ge+"*(?:''|\"\")")}),le.cssHas||d.push(":has"),d=d.length&&new RegExp(d.join("|")),l=function(e,t){if(e===t)return a=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!le.sortDetached&&t.compareDocumentPosition(e)===n?e===T||e.ownerDocument==ye&&I.contains(ye,e)?-1:t===T||t.ownerDocument==ye&&I.contains(ye,t)?1:o?se.call(o,e)-se.call(o,t):0:4&n?-1:1)}),T}for(e in I.matches=function(e,t){return I(e,null,null,t)},I.matchesSelector=function(e,t){if(V(e),C&&!h[t+" "]&&(!d||!d.test(t)))try{var n=i.call(e,t);if(n||le.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){h(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(O,P),e[3]=(e[3]||e[4]||e[5]||"").replace(O,P),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||I.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&I.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return D.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&j.test(n)&&(t=Y(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(O,P).toLowerCase();return"*"===e?function(){return!0}:function(e){return fe(e,t)}},CLASS:function(e){var t=s[e+" "];return t||(t=new RegExp("(^|"+ge+")"+e+"("+ge+"|$)"))&&s(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=I.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function T(e,n,r){return v(n)?ce.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?ce.grep(e,function(e){return e===n!==r}):"string"!=typeof n?ce.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(ce.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||k,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:S.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof ce?t[0]:t,ce.merge(this,ce.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:C,!0)),w.test(r[1])&&ce.isPlainObject(t))for(r in t)v(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=C.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==n.ready?n.ready(e):e(ce):ce.makeArray(e,this)}).prototype=ce.fn,k=ce(C);var E=/^(?:parents|prev(?:Until|All))/,j={children:!0,contents:!0,next:!0,prev:!0};function A(e,t){while((e=e[t])&&1!==e.nodeType);return e}ce.fn.extend({has:function(e){var t=ce(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,Ce=/^$|^module$|\/(?:java|ecma)script/i;xe=C.createDocumentFragment().appendChild(C.createElement("div")),(be=C.createElement("input")).setAttribute("type","radio"),be.setAttribute("checked","checked"),be.setAttribute("name","t"),xe.appendChild(be),le.checkClone=xe.cloneNode(!0).cloneNode(!0).lastChild.checked,xe.innerHTML="",le.noCloneChecked=!!xe.cloneNode(!0).lastChild.defaultValue,xe.innerHTML="",le.option=!!xe.lastChild;var ke={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function Se(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&fe(e,t)?ce.merge([e],n):n}function Ee(e,t){for(var n=0,r=e.length;n",""]);var je=/<|&#?\w+;/;function Ae(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function Re(e,t){return fe(e,"table")&&fe(11!==t.nodeType?t:t.firstChild,"tr")&&ce(e).children("tbody")[0]||e}function Ie(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function We(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Fe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(_.hasData(e)&&(s=_.get(e).events))for(i in _.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),C.head.appendChild(r[0])},abort:function(){i&&i()}}});var Jt,Kt=[],Zt=/(=)\?(?=&|$)|\?\?/;ce.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Kt.pop()||ce.expando+"_"+jt.guid++;return this[e]=!0,e}}),ce.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Zt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Zt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=v(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Zt,"$1"+r):!1!==e.jsonp&&(e.url+=(At.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||ce.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=ie[r],ie[r]=function(){o=arguments},n.always(function(){void 0===i?ce(ie).removeProp(r):ie[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Kt.push(r)),o&&v(i)&&i(o[0]),o=i=void 0}),"script"}),le.createHTMLDocument=((Jt=C.implementation.createHTMLDocument("").body).innerHTML="
",2===Jt.childNodes.length),ce.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(le.createHTMLDocument?((r=(t=C.implementation.createHTMLDocument("")).createElement("base")).href=C.location.href,t.head.appendChild(r)):t=C),o=!n&&[],(i=w.exec(e))?[t.createElement(i[1])]:(i=Ae([e],t,o),o&&o.length&&ce(o).remove(),ce.merge([],i.childNodes)));var r,i,o},ce.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(ce.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},ce.expr.pseudos.animated=function(t){return ce.grep(ce.timers,function(e){return t===e.elem}).length},ce.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=ce.css(e,"position"),c=ce(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=ce.css(e,"top"),u=ce.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),v(t)&&(t=t.call(e,n,ce.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},ce.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){ce.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===ce.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===ce.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=ce(e).offset()).top+=ce.css(e,"borderTopWidth",!0),i.left+=ce.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-ce.css(r,"marginTop",!0),left:t.left-i.left-ce.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===ce.css(e,"position"))e=e.offsetParent;return e||J})}}),ce.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;ce.fn[t]=function(e){return M(this,function(e,t,n){var r;if(y(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),ce.each(["top","left"],function(e,n){ce.cssHooks[n]=Ye(le.pixelPosition,function(e,t){if(t)return t=Ge(e,n),_e.test(t)?ce(e).position()[n]+"px":t})}),ce.each({Height:"height",Width:"width"},function(a,s){ce.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){ce.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return M(this,function(e,t,n){var r;return y(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?ce.css(e,t,i):ce.style(e,t,n,i)},s,n?e:void 0,n)}})}),ce.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){ce.fn[t]=function(e){return this.on(t,e)}}),ce.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.on("mouseenter",e).on("mouseleave",t||e)}}),ce.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){ce.fn[n]=function(e,t){return 00){var c=e.utils.clone(r)||{};c.position=[a,l],c.index=s.length,s.push(new e.Token(i.slice(a,o),c))}a=o+1}}return s},e.tokenizer.separator=/[\s\-]+/,e.Pipeline=function(){this._stack=[]},e.Pipeline.registeredFunctions=Object.create(null),e.Pipeline.registerFunction=function(t,r){r in this.registeredFunctions&&e.utils.warn("Overwriting existing registered function: "+r),t.label=r,e.Pipeline.registeredFunctions[t.label]=t},e.Pipeline.warnIfFunctionNotRegistered=function(t){var r=t.label&&t.label in this.registeredFunctions;r||e.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",t)},e.Pipeline.load=function(t){var r=new e.Pipeline;return t.forEach(function(t){var i=e.Pipeline.registeredFunctions[t];if(!i)throw new Error("Cannot load unregistered function: "+t);r.add(i)}),r},e.Pipeline.prototype.add=function(){var t=Array.prototype.slice.call(arguments);t.forEach(function(t){e.Pipeline.warnIfFunctionNotRegistered(t),this._stack.push(t)},this)},e.Pipeline.prototype.after=function(t,r){e.Pipeline.warnIfFunctionNotRegistered(r);var i=this._stack.indexOf(t);if(i==-1)throw new Error("Cannot find existingFn");i+=1,this._stack.splice(i,0,r)},e.Pipeline.prototype.before=function(t,r){e.Pipeline.warnIfFunctionNotRegistered(r);var i=this._stack.indexOf(t);if(i==-1)throw new Error("Cannot find existingFn");this._stack.splice(i,0,r)},e.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);t!=-1&&this._stack.splice(t,1)},e.Pipeline.prototype.run=function(e){for(var t=this._stack.length,r=0;r1&&(se&&(r=n),s!=e);)i=r-t,n=t+Math.floor(i/2),s=this.elements[2*n];return s==e?2*n:s>e?2*n:sa?l+=2:o==a&&(t+=r[u+1]*i[l+1],u+=2,l+=2);return t},e.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},e.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),t=1,r=0;t0){var o,a=s.str.charAt(0);a in s.node.edges?o=s.node.edges[a]:(o=new e.TokenSet,s.node.edges[a]=o),1==s.str.length&&(o["final"]=!0),n.push({node:o,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(0!=s.editsRemaining){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new e.TokenSet;s.node.edges["*"]=u}if(0==s.str.length&&(u["final"]=!0),n.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&n.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),1==s.str.length&&(s.node["final"]=!0),s.str.length>=1){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new e.TokenSet;s.node.edges["*"]=l}1==s.str.length&&(l["final"]=!0),n.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var c,h=s.str.charAt(0),d=s.str.charAt(1);d in s.node.edges?c=s.node.edges[d]:(c=new e.TokenSet,s.node.edges[d]=c),1==s.str.length&&(c["final"]=!0),n.push({node:c,editsRemaining:s.editsRemaining-1,str:h+s.str.slice(2)})}}}return i},e.TokenSet.fromString=function(t){for(var r=new e.TokenSet,i=r,n=0,s=t.length;n=e;t--){var r=this.uncheckedNodes[t],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r["char"]]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}},e.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},e.Index.prototype.search=function(t){return this.query(function(r){var i=new e.QueryParser(t,r);i.parse()})},e.Index.prototype.query=function(t){for(var r=new e.Query(this.fields),i=Object.create(null),n=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),u=0;u1?this._b=1:this._b=e},e.Builder.prototype.k1=function(e){this._k1=e},e.Builder.prototype.add=function(t,r){var i=t[this._ref],n=Object.keys(this._fields);this._documents[i]=r||{},this.documentCount+=1;for(var s=0;s=this.length)return e.QueryLexer.EOS;var t=this.str.charAt(this.pos);return this.pos+=1,t},e.QueryLexer.prototype.width=function(){return this.pos-this.start},e.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},e.QueryLexer.prototype.backup=function(){this.pos-=1},e.QueryLexer.prototype.acceptDigitRun=function(){var t,r;do t=this.next(),r=t.charCodeAt(0);while(r>47&&r<58);t!=e.QueryLexer.EOS&&this.backup()},e.QueryLexer.prototype.more=function(){return this.pos1&&(t.backup(),t.emit(e.QueryLexer.TERM)),t.ignore(),t.more())return e.QueryLexer.lexText},e.QueryLexer.lexEditDistance=function(t){return t.ignore(),t.acceptDigitRun(),t.emit(e.QueryLexer.EDIT_DISTANCE),e.QueryLexer.lexText},e.QueryLexer.lexBoost=function(t){return t.ignore(),t.acceptDigitRun(),t.emit(e.QueryLexer.BOOST),e.QueryLexer.lexText},e.QueryLexer.lexEOS=function(t){t.width()>0&&t.emit(e.QueryLexer.TERM)},e.QueryLexer.termSeparator=e.tokenizer.separator,e.QueryLexer.lexText=function(t){for(;;){var r=t.next();if(r==e.QueryLexer.EOS)return e.QueryLexer.lexEOS;if(92!=r.charCodeAt(0)){if(":"==r)return e.QueryLexer.lexField;if("~"==r)return t.backup(),t.width()>0&&t.emit(e.QueryLexer.TERM),e.QueryLexer.lexEditDistance;if("^"==r)return t.backup(),t.width()>0&&t.emit(e.QueryLexer.TERM),e.QueryLexer.lexBoost;if("+"==r&&1===t.width())return t.emit(e.QueryLexer.PRESENCE),e.QueryLexer.lexText;if("-"==r&&1===t.width())return t.emit(e.QueryLexer.PRESENCE),e.QueryLexer.lexText;if(r.match(e.QueryLexer.termSeparator))return e.QueryLexer.lexTerm}else t.escapeCharacter()}},e.QueryParser=function(t,r){this.lexer=new e.QueryLexer(t),this.query=r,this.currentClause={},this.lexemeIdx=0},e.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var t=e.QueryParser.parseClause;t;)t=t(this);return this.query},e.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},e.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},e.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},e.QueryParser.parseClause=function(t){var r=t.peekLexeme();if(void 0!=r)switch(r.type){case e.QueryLexer.PRESENCE:return e.QueryParser.parsePresence;case e.QueryLexer.FIELD:return e.QueryParser.parseField;case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var i="expected either a field or a term, found "+r.type;throw r.str.length>=1&&(i+=" with value '"+r.str+"'"),new e.QueryParseError(i,r.start,r.end)}},e.QueryParser.parsePresence=function(t){var r=t.consumeLexeme();if(void 0!=r){switch(r.str){case"-":t.currentClause.presence=e.Query.presence.PROHIBITED;break;case"+":t.currentClause.presence=e.Query.presence.REQUIRED;break;default:var i="unrecognised presence operator'"+r.str+"'";throw new e.QueryParseError(i,r.start,r.end)}var n=t.peekLexeme();if(void 0==n){var i="expecting term or field, found nothing";throw new e.QueryParseError(i,r.start,r.end)}switch(n.type){case e.QueryLexer.FIELD:return e.QueryParser.parseField;case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var i="expecting term or field, found '"+n.type+"'";throw new e.QueryParseError(i,n.start,n.end)}}},e.QueryParser.parseField=function(t){var r=t.consumeLexeme();if(void 0!=r){if(t.query.allFields.indexOf(r.str)==-1){var i=t.query.allFields.map(function(e){return"'"+e+"'"}).join(", "),n="unrecognised field '"+r.str+"', possible fields: "+i;throw new e.QueryParseError(n,r.start,r.end)}t.currentClause.fields=[r.str];var s=t.peekLexeme();if(void 0==s){var n="expecting term, found nothing";throw new e.QueryParseError(n,r.start,r.end)}switch(s.type){case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var n="expecting term, found '"+s.type+"'";throw new e.QueryParseError(n,s.start,s.end)}}},e.QueryParser.parseTerm=function(t){var r=t.consumeLexeme();if(void 0!=r){t.currentClause.term=r.str.toLowerCase(),r.str.indexOf("*")!=-1&&(t.currentClause.usePipeline=!1);var i=t.peekLexeme();if(void 0==i)return void t.nextClause();switch(i.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;case e.QueryLexer.PRESENCE:return t.nextClause(),e.QueryParser.parsePresence;default:var n="Unexpected lexeme type '"+i.type+"'";throw new e.QueryParseError(n,i.start,i.end)}}},e.QueryParser.parseEditDistance=function(t){var r=t.consumeLexeme();if(void 0!=r){var i=parseInt(r.str,10);if(isNaN(i)){var n="edit distance must be numeric";throw new e.QueryParseError(n,r.start,r.end)}t.currentClause.editDistance=i;var s=t.peekLexeme();if(void 0==s)return void t.nextClause();switch(s.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;case e.QueryLexer.PRESENCE:return t.nextClause(),e.QueryParser.parsePresence;default:var n="Unexpected lexeme type '"+s.type+"'";throw new e.QueryParseError(n,s.start,s.end)}}},e.QueryParser.parseBoost=function(t){var r=t.consumeLexeme();if(void 0!=r){var i=parseInt(r.str,10);if(isNaN(i)){var n="boost must be numeric";throw new e.QueryParseError(n,r.start,r.end)}t.currentClause.boost=i;var s=t.peekLexeme();if(void 0==s)return void t.nextClause();switch(s.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;case e.QueryLexer.PRESENCE:return t.nextClause(),e.QueryParser.parsePresence;default:var n="Unexpected lexeme type '"+s.type+"'";throw new e.QueryParseError(n,s.start,s.end)}}},function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.lunr=t()}(this,function(){return e})}(); diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/js/typeahead.jquery.js b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/js/typeahead.jquery.js new file mode 100644 index 000000000..bcb734bef --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/js/typeahead.jquery.js @@ -0,0 +1,1695 @@ +/*! + * typeahead.js 1.3.3 + * https://github.com/corejavascript/typeahead.js + * Copyright 2013-2024 Twitter, Inc. and other contributors; Licensed MIT + */ + + +(function(root, factory) { + if (typeof define === "function" && define.amd) { + define([ "jquery" ], function(a0) { + return factory(a0); + }); + } else if (typeof module === "object" && module.exports) { + module.exports = factory(require("jquery")); + } else { + factory(root["jQuery"]); + } +})(this, function($) { + var _ = function() { + "use strict"; + return { + isMsie: function() { + return /(msie|trident)/i.test(navigator.userAgent) ? navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2] : false; + }, + isBlankString: function(str) { + return !str || /^\s*$/.test(str); + }, + escapeRegExChars: function(str) { + return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); + }, + isString: function(obj) { + return typeof obj === "string"; + }, + isNumber: function(obj) { + return typeof obj === "number"; + }, + isArray: $.isArray, + isFunction: $.isFunction, + isObject: $.isPlainObject, + isUndefined: function(obj) { + return typeof obj === "undefined"; + }, + isElement: function(obj) { + return !!(obj && obj.nodeType === 1); + }, + isJQuery: function(obj) { + return obj instanceof $; + }, + toStr: function toStr(s) { + return _.isUndefined(s) || s === null ? "" : s + ""; + }, + bind: $.proxy, + each: function(collection, cb) { + $.each(collection, reverseArgs); + function reverseArgs(index, value) { + return cb(value, index); + } + }, + map: $.map, + filter: $.grep, + every: function(obj, test) { + var result = true; + if (!obj) { + return result; + } + $.each(obj, function(key, val) { + if (!(result = test.call(null, val, key, obj))) { + return false; + } + }); + return !!result; + }, + some: function(obj, test) { + var result = false; + if (!obj) { + return result; + } + $.each(obj, function(key, val) { + if (result = test.call(null, val, key, obj)) { + return false; + } + }); + return !!result; + }, + mixin: $.extend, + identity: function(x) { + return x; + }, + clone: function(obj) { + return $.extend(true, {}, obj); + }, + getIdGenerator: function() { + var counter = 0; + return function() { + return counter++; + }; + }, + templatify: function templatify(obj) { + return $.isFunction(obj) ? obj : template; + function template() { + return String(obj); + } + }, + defer: function(fn) { + setTimeout(fn, 0); + }, + debounce: function(func, wait, immediate) { + var timeout, result; + return function() { + var context = this, args = arguments, later, callNow; + later = function() { + timeout = null; + if (!immediate) { + result = func.apply(context, args); + } + }; + callNow = immediate && !timeout; + clearTimeout(timeout); + timeout = setTimeout(later, wait); + if (callNow) { + result = func.apply(context, args); + } + return result; + }; + }, + throttle: function(func, wait) { + var context, args, timeout, result, previous, later; + previous = 0; + later = function() { + previous = new Date(); + timeout = null; + result = func.apply(context, args); + }; + return function() { + var now = new Date(), remaining = wait - (now - previous); + context = this; + args = arguments; + if (remaining <= 0) { + clearTimeout(timeout); + timeout = null; + previous = now; + result = func.apply(context, args); + } else if (!timeout) { + timeout = setTimeout(later, remaining); + } + return result; + }; + }, + stringify: function(val) { + return _.isString(val) ? val : JSON.stringify(val); + }, + guid: function() { + function _p8(s) { + var p = (Math.random().toString(16) + "000000000").substr(2, 8); + return s ? "-" + p.substr(0, 4) + "-" + p.substr(4, 4) : p; + } + return "tt-" + _p8() + _p8(true) + _p8(true) + _p8(); + }, + noop: function() {} + }; + }(); + var WWW = function() { + "use strict"; + var defaultClassNames = { + wrapper: "twitter-typeahead", + input: "tt-input", + hint: "tt-hint", + menu: "tt-menu", + dataset: "tt-dataset", + suggestion: "tt-suggestion", + selectable: "tt-selectable", + empty: "tt-empty", + open: "tt-open", + cursor: "tt-cursor", + highlight: "tt-highlight" + }; + return build; + function build(o) { + var www, classes; + classes = _.mixin({}, defaultClassNames, o); + www = { + css: buildCss(), + classes: classes, + html: buildHtml(classes), + selectors: buildSelectors(classes) + }; + return { + css: www.css, + html: www.html, + classes: www.classes, + selectors: www.selectors, + mixin: function(o) { + _.mixin(o, www); + } + }; + } + function buildHtml(c) { + return { + wrapper: '', + menu: '
' + }; + } + function buildSelectors(classes) { + var selectors = {}; + _.each(classes, function(v, k) { + selectors[k] = "." + v; + }); + return selectors; + } + function buildCss() { + var css = { + wrapper: { + position: "relative", + display: "inline-block" + }, + hint: { + position: "absolute", + top: "0", + left: "0", + borderColor: "transparent", + boxShadow: "none", + opacity: "1" + }, + input: { + position: "relative", + verticalAlign: "top", + backgroundColor: "transparent" + }, + inputWithNoHint: { + position: "relative", + verticalAlign: "top" + }, + menu: { + position: "absolute", + top: "100%", + left: "0", + zIndex: "100", + display: "none" + }, + ltr: { + left: "0", + right: "auto" + }, + rtl: { + left: "auto", + right: " 0" + } + }; + if (_.isMsie()) { + _.mixin(css.input, { + backgroundImage: "url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)" + }); + } + return css; + } + }(); + var EventBus = function() { + "use strict"; + var namespace, deprecationMap; + namespace = "typeahead:"; + deprecationMap = { + render: "rendered", + cursorchange: "cursorchanged", + select: "selected", + autocomplete: "autocompleted" + }; + function EventBus(o) { + if (!o || !o.el) { + $.error("EventBus initialized without el"); + } + this.$el = $(o.el); + } + _.mixin(EventBus.prototype, { + _trigger: function(type, args) { + var $e = $.Event(namespace + type); + this.$el.trigger.call(this.$el, $e, args || []); + return $e; + }, + before: function(type) { + var args, $e; + args = [].slice.call(arguments, 1); + $e = this._trigger("before" + type, args); + return $e.isDefaultPrevented(); + }, + trigger: function(type) { + var deprecatedType; + this._trigger(type, [].slice.call(arguments, 1)); + if (deprecatedType = deprecationMap[type]) { + this._trigger(deprecatedType, [].slice.call(arguments, 1)); + } + } + }); + return EventBus; + }(); + var EventEmitter = function() { + "use strict"; + var splitter = /\s+/, nextTick = getNextTick(); + return { + onSync: onSync, + onAsync: onAsync, + off: off, + trigger: trigger + }; + function on(method, types, cb, context) { + var type; + if (!cb) { + return this; + } + types = types.split(splitter); + cb = context ? bindContext(cb, context) : cb; + this._callbacks = this._callbacks || {}; + while (type = types.shift()) { + this._callbacks[type] = this._callbacks[type] || { + sync: [], + async: [] + }; + this._callbacks[type][method].push(cb); + } + return this; + } + function onAsync(types, cb, context) { + return on.call(this, "async", types, cb, context); + } + function onSync(types, cb, context) { + return on.call(this, "sync", types, cb, context); + } + function off(types) { + var type; + if (!this._callbacks) { + return this; + } + types = types.split(splitter); + while (type = types.shift()) { + delete this._callbacks[type]; + } + return this; + } + function trigger(types) { + var type, callbacks, args, syncFlush, asyncFlush; + if (!this._callbacks) { + return this; + } + types = types.split(splitter); + args = [].slice.call(arguments, 1); + while ((type = types.shift()) && (callbacks = this._callbacks[type])) { + syncFlush = getFlush(callbacks.sync, this, [ type ].concat(args)); + asyncFlush = getFlush(callbacks.async, this, [ type ].concat(args)); + syncFlush() && nextTick(asyncFlush); + } + return this; + } + function getFlush(callbacks, context, args) { + return flush; + function flush() { + var cancelled; + for (var i = 0, len = callbacks.length; !cancelled && i < len; i += 1) { + cancelled = callbacks[i].apply(context, args) === false; + } + return !cancelled; + } + } + function getNextTick() { + var nextTickFn; + if (window.setImmediate) { + nextTickFn = function nextTickSetImmediate(fn) { + setImmediate(function() { + fn(); + }); + }; + } else { + nextTickFn = function nextTickSetTimeout(fn) { + setTimeout(function() { + fn(); + }, 0); + }; + } + return nextTickFn; + } + function bindContext(fn, context) { + return fn.bind ? fn.bind(context) : function() { + fn.apply(context, [].slice.call(arguments, 0)); + }; + } + }(); + var highlight = function(doc) { + "use strict"; + var defaults = { + node: null, + pattern: null, + tagName: "strong", + className: null, + wordsOnly: false, + caseSensitive: false, + diacriticInsensitive: false + }; + var accented = { + A: "[AaªÀ-Åà-åĀ-ąǍǎȀ-ȃȦȧᴬᵃḀḁẚẠ-ảₐ℀℁℻⒜Ⓐⓐ㍱-㍴㎀-㎄㎈㎉㎩-㎯㏂㏊㏟㏿Aa]", + B: "[BbᴮᵇḂ-ḇℬ⒝Ⓑⓑ㍴㎅-㎇㏃㏈㏔㏝Bb]", + C: "[CcÇçĆ-čᶜ℀ℂ℃℅℆ℭⅭⅽ⒞Ⓒⓒ㍶㎈㎉㎝㎠㎤㏄-㏇Cc]", + D: "[DdĎďDŽ-džDZ-dzᴰᵈḊ-ḓⅅⅆⅮⅾ⒟Ⓓⓓ㋏㍲㍷-㍹㎗㎭-㎯㏅㏈Dd]", + E: "[EeÈ-Ëè-ëĒ-ěȄ-ȇȨȩᴱᵉḘ-ḛẸ-ẽₑ℡ℯℰⅇ⒠Ⓔⓔ㉐㋍㋎Ee]", + F: "[FfᶠḞḟ℉ℱ℻⒡Ⓕⓕ㎊-㎌㎙ff-fflFf]", + G: "[GgĜ-ģǦǧǴǵᴳᵍḠḡℊ⒢Ⓖⓖ㋌㋍㎇㎍-㎏㎓㎬㏆㏉㏒㏿Gg]", + H: "[HhĤĥȞȟʰᴴḢ-ḫẖℋ-ℎ⒣Ⓗⓗ㋌㍱㎐-㎔㏊㏋㏗Hh]", + I: "[IiÌ-Ïì-ïĨ-İIJijǏǐȈ-ȋᴵᵢḬḭỈ-ịⁱℐℑℹⅈⅠ-ⅣⅥ-ⅨⅪⅫⅰ-ⅳⅵ-ⅸⅺⅻ⒤Ⓘⓘ㍺㏌㏕fiffiIi]", + J: "[JjIJ-ĵLJ-njǰʲᴶⅉ⒥ⒿⓙⱼJj]", + K: "[KkĶķǨǩᴷᵏḰ-ḵK⒦Ⓚⓚ㎄㎅㎉㎏㎑㎘㎞㎢㎦㎪㎸㎾㏀㏆㏍-㏏Kk]", + L: "[LlĹ-ŀLJ-ljˡᴸḶḷḺ-ḽℒℓ℡Ⅼⅼ⒧Ⓛⓛ㋏㎈㎉㏐-㏓㏕㏖㏿flfflLl]", + M: "[MmᴹᵐḾ-ṃ℠™ℳⅯⅿ⒨Ⓜⓜ㍷-㍹㎃㎆㎎㎒㎖㎙-㎨㎫㎳㎷㎹㎽㎿㏁㏂㏎㏐㏔-㏖㏘㏙㏞㏟Mm]", + N: "[NnÑñŃ-ʼnNJ-njǸǹᴺṄ-ṋⁿℕ№⒩Ⓝⓝ㎁㎋㎚㎱㎵㎻㏌㏑Nn]", + O: "[OoºÒ-Öò-öŌ-őƠơǑǒǪǫȌ-ȏȮȯᴼᵒỌ-ỏₒ℅№ℴ⒪Ⓞⓞ㍵㏇㏒㏖Oo]", + P: "[PpᴾᵖṔ-ṗℙ⒫Ⓟⓟ㉐㍱㍶㎀㎊㎩-㎬㎰㎴㎺㏋㏗-㏚Pp]", + Q: "[Qqℚ⒬Ⓠⓠ㏃Qq]", + R: "[RrŔ-řȐ-ȓʳᴿᵣṘ-ṛṞṟ₨ℛ-ℝ⒭Ⓡⓡ㋍㍴㎭-㎯㏚㏛Rr]", + S: "[SsŚ-šſȘșˢṠ-ṣ₨℁℠⒮Ⓢⓢ㎧㎨㎮-㎳㏛㏜stSs]", + T: "[TtŢ-ťȚțᵀᵗṪ-ṱẗ℡™⒯Ⓣⓣ㉐㋏㎔㏏ſtstTt]", + U: "[UuÙ-Üù-üŨ-ųƯưǓǔȔ-ȗᵁᵘᵤṲ-ṷỤ-ủ℆⒰Ⓤⓤ㍳㍺Uu]", + V: "[VvᵛᵥṼ-ṿⅣ-Ⅷⅳ-ⅷ⒱Ⓥⓥⱽ㋎㍵㎴-㎹㏜㏞Vv]", + W: "[WwŴŵʷᵂẀ-ẉẘ⒲Ⓦⓦ㎺-㎿㏝Ww]", + X: "[XxˣẊ-ẍₓ℻Ⅸ-Ⅻⅸ-ⅻ⒳Ⓧⓧ㏓Xx]", + Y: "[YyÝýÿŶ-ŸȲȳʸẎẏẙỲ-ỹ⒴Ⓨⓨ㏉Yy]", + Z: "[ZzŹ-žDZ-dzᶻẐ-ẕℤℨ⒵Ⓩⓩ㎐-㎔Zz]" + }; + return function hightlight(o) { + var regex; + o = _.mixin({}, defaults, o); + if (!o.node || !o.pattern) { + return; + } + o.pattern = _.isArray(o.pattern) ? o.pattern : [ o.pattern ]; + regex = getRegex(o.pattern, o.caseSensitive, o.wordsOnly, o.diacriticInsensitive); + traverse(o.node, hightlightTextNode); + function hightlightTextNode(textNode) { + var match, patternNode, wrapperNode; + if (match = regex.exec(textNode.data)) { + wrapperNode = doc.createElement(o.tagName); + o.className && (wrapperNode.className = o.className); + patternNode = textNode.splitText(match.index); + patternNode.splitText(match[0].length); + wrapperNode.appendChild(patternNode.cloneNode(true)); + textNode.parentNode.replaceChild(wrapperNode, patternNode); + } + return !!match; + } + function traverse(el, hightlightTextNode) { + var childNode, TEXT_NODE_TYPE = 3; + for (var i = 0; i < el.childNodes.length; i++) { + childNode = el.childNodes[i]; + if (childNode.nodeType === TEXT_NODE_TYPE) { + i += hightlightTextNode(childNode) ? 1 : 0; + } else { + traverse(childNode, hightlightTextNode); + } + } + } + }; + function accent_replacer(chr) { + return accented[chr.toUpperCase()] || chr; + } + function getRegex(patterns, caseSensitive, wordsOnly, diacriticInsensitive) { + var escapedPatterns = [], regexStr; + for (var i = 0, len = patterns.length; i < len; i++) { + var escapedWord = _.escapeRegExChars(patterns[i]); + if (diacriticInsensitive) { + escapedWord = escapedWord.replace(/\S/g, accent_replacer); + } + escapedPatterns.push(escapedWord); + } + regexStr = wordsOnly ? "\\b(" + escapedPatterns.join("|") + ")\\b" : "(" + escapedPatterns.join("|") + ")"; + return caseSensitive ? new RegExp(regexStr) : new RegExp(regexStr, "i"); + } + }(window.document); + var Input = function() { + "use strict"; + var specialKeyCodeMap; + specialKeyCodeMap = { + 9: "tab", + 27: "esc", + 37: "left", + 39: "right", + 13: "enter", + 38: "up", + 40: "down" + }; + function Input(o, www) { + var id; + o = o || {}; + if (!o.input) { + $.error("input is missing"); + } + www.mixin(this); + this.$hint = $(o.hint); + this.$input = $(o.input); + this.$menu = $(o.menu); + id = this.$input.attr("id") || _.guid(); + this.$menu.attr("id", id + "_listbox"); + this.$hint.attr({ + "aria-hidden": true + }); + this.$input.attr({ + "aria-owns": id + "_listbox", + "aria-controls": id + "_listbox", + role: "combobox", + "aria-autocomplete": "list", + "aria-expanded": false + }); + this.query = this.$input.val(); + this.queryWhenFocused = this.hasFocus() ? this.query : null; + this.$overflowHelper = buildOverflowHelper(this.$input); + this._checkLanguageDirection(); + if (this.$hint.length === 0) { + this.setHint = this.getHint = this.clearHint = this.clearHintIfInvalid = _.noop; + } + this.onSync("cursorchange", this._updateDescendent); + } + Input.normalizeQuery = function(str) { + return _.toStr(str).replace(/^\s*/g, "").replace(/\s{2,}/g, " "); + }; + _.mixin(Input.prototype, EventEmitter, { + _onBlur: function onBlur() { + this.resetInputValue(); + this.trigger("blurred"); + }, + _onFocus: function onFocus() { + this.queryWhenFocused = this.query; + this.trigger("focused"); + }, + _onKeydown: function onKeydown($e) { + var keyName = specialKeyCodeMap[$e.which || $e.keyCode]; + this._managePreventDefault(keyName, $e); + if (keyName && this._shouldTrigger(keyName, $e)) { + this.trigger(keyName + "Keyed", $e); + } + }, + _onInput: function onInput() { + this._setQuery(this.getInputValue()); + this.clearHintIfInvalid(); + this._checkLanguageDirection(); + }, + _managePreventDefault: function managePreventDefault(keyName, $e) { + var preventDefault; + switch (keyName) { + case "up": + case "down": + preventDefault = !withModifier($e); + break; + + default: + preventDefault = false; + } + preventDefault && $e.preventDefault(); + }, + _shouldTrigger: function shouldTrigger(keyName, $e) { + var trigger; + switch (keyName) { + case "tab": + trigger = !withModifier($e); + break; + + default: + trigger = true; + } + return trigger; + }, + _checkLanguageDirection: function checkLanguageDirection() { + var dir = (this.$input.css("direction") || "ltr").toLowerCase(); + if (this.dir !== dir) { + this.dir = dir; + this.$hint.attr("dir", dir); + this.trigger("langDirChanged", dir); + } + }, + _setQuery: function setQuery(val, silent) { + var areEquivalent, hasDifferentWhitespace; + areEquivalent = areQueriesEquivalent(val, this.query); + hasDifferentWhitespace = areEquivalent ? this.query.length !== val.length : false; + this.query = val; + if (!silent && !areEquivalent) { + this.trigger("queryChanged", this.query); + } else if (!silent && hasDifferentWhitespace) { + this.trigger("whitespaceChanged", this.query); + } + }, + _updateDescendent: function updateDescendent(event, id) { + this.$input.attr("aria-activedescendant", id); + }, + bind: function() { + var that = this, onBlur, onFocus, onKeydown, onInput; + onBlur = _.bind(this._onBlur, this); + onFocus = _.bind(this._onFocus, this); + onKeydown = _.bind(this._onKeydown, this); + onInput = _.bind(this._onInput, this); + this.$input.on("blur.tt", onBlur).on("focus.tt", onFocus).on("keydown.tt", onKeydown); + if (!_.isMsie() || _.isMsie() > 9) { + this.$input.on("input.tt", onInput); + } else { + this.$input.on("keydown.tt keypress.tt cut.tt paste.tt", function($e) { + if (specialKeyCodeMap[$e.which || $e.keyCode]) { + return; + } + _.defer(_.bind(that._onInput, that, $e)); + }); + } + return this; + }, + focus: function focus() { + this.$input.focus(); + }, + blur: function blur() { + this.$input.blur(); + }, + getLangDir: function getLangDir() { + return this.dir; + }, + getQuery: function getQuery() { + return this.query || ""; + }, + setQuery: function setQuery(val, silent) { + this.setInputValue(val); + this._setQuery(val, silent); + }, + hasQueryChangedSinceLastFocus: function hasQueryChangedSinceLastFocus() { + return this.query !== this.queryWhenFocused; + }, + getInputValue: function getInputValue() { + return this.$input.val(); + }, + setInputValue: function setInputValue(value) { + this.$input.val(value); + this.clearHintIfInvalid(); + this._checkLanguageDirection(); + }, + resetInputValue: function resetInputValue() { + this.setInputValue(this.query); + }, + getHint: function getHint() { + return this.$hint.val(); + }, + setHint: function setHint(value) { + this.$hint.val(value); + }, + clearHint: function clearHint() { + this.setHint(""); + }, + clearHintIfInvalid: function clearHintIfInvalid() { + var val, hint, valIsPrefixOfHint, isValid; + val = this.getInputValue(); + hint = this.getHint(); + valIsPrefixOfHint = val !== hint && hint.indexOf(val) === 0; + isValid = val !== "" && valIsPrefixOfHint && !this.hasOverflow(); + !isValid && this.clearHint(); + }, + hasFocus: function hasFocus() { + return this.$input.is(":focus"); + }, + hasOverflow: function hasOverflow() { + var constraint = this.$input.width() - 2; + this.$overflowHelper.text(this.getInputValue()); + return this.$overflowHelper.width() >= constraint; + }, + isCursorAtEnd: function() { + var valueLength, selectionStart, range; + valueLength = this.$input.val().length; + selectionStart = this.$input[0].selectionStart; + if (_.isNumber(selectionStart)) { + return selectionStart === valueLength; + } else if (document.selection) { + range = document.selection.createRange(); + range.moveStart("character", -valueLength); + return valueLength === range.text.length; + } + return true; + }, + destroy: function destroy() { + this.$hint.off(".tt"); + this.$input.off(".tt"); + this.$overflowHelper.remove(); + this.$hint = this.$input = this.$overflowHelper = $("
"); + }, + setAriaExpanded: function setAriaExpanded(value) { + this.$input.attr("aria-expanded", value); + } + }); + return Input; + function buildOverflowHelper($input) { + return $('').css({ + position: "absolute", + visibility: "hidden", + whiteSpace: "pre", + fontFamily: $input.css("font-family"), + fontSize: $input.css("font-size"), + fontStyle: $input.css("font-style"), + fontVariant: $input.css("font-variant"), + fontWeight: $input.css("font-weight"), + wordSpacing: $input.css("word-spacing"), + letterSpacing: $input.css("letter-spacing"), + textIndent: $input.css("text-indent"), + textRendering: $input.css("text-rendering"), + textTransform: $input.css("text-transform") + }).insertAfter($input); + } + function areQueriesEquivalent(a, b) { + return Input.normalizeQuery(a) === Input.normalizeQuery(b); + } + function withModifier($e) { + return $e.altKey || $e.ctrlKey || $e.metaKey || $e.shiftKey; + } + }(); + var Dataset = function() { + "use strict"; + var keys, nameGenerator; + keys = { + dataset: "tt-selectable-dataset", + val: "tt-selectable-display", + obj: "tt-selectable-object" + }; + nameGenerator = _.getIdGenerator(); + function Dataset(o, www) { + o = o || {}; + o.templates = o.templates || {}; + o.templates.notFound = o.templates.notFound || o.templates.empty; + if (!o.source) { + $.error("missing source"); + } + if (!o.node) { + $.error("missing node"); + } + if (o.name && !isValidName(o.name)) { + $.error("invalid dataset name: " + o.name); + } + www.mixin(this); + this.highlight = !!o.highlight; + this.name = _.toStr(o.name || nameGenerator()); + this.limit = o.limit || 5; + this.displayFn = getDisplayFn(o.display || o.displayKey); + this.templates = getTemplates(o.templates, this.displayFn); + this.source = o.source.__ttAdapter ? o.source.__ttAdapter() : o.source; + this.async = _.isUndefined(o.async) ? this.source.length > 2 : !!o.async; + this._resetLastSuggestion(); + this.$el = $(o.node).attr("role", "presentation").addClass(this.classes.dataset).addClass(this.classes.dataset + "-" + this.name); + } + Dataset.extractData = function extractData(el) { + var $el = $(el); + if ($el.data(keys.obj)) { + return { + dataset: $el.data(keys.dataset) || "", + val: $el.data(keys.val) || "", + obj: $el.data(keys.obj) || null + }; + } + return null; + }; + _.mixin(Dataset.prototype, EventEmitter, { + _overwrite: function overwrite(query, suggestions) { + suggestions = suggestions || []; + if (suggestions.length) { + this._renderSuggestions(query, suggestions); + } else if (this.async && this.templates.pending) { + this._renderPending(query); + } else if (!this.async && this.templates.notFound) { + this._renderNotFound(query); + } else { + this._empty(); + } + this.trigger("rendered", suggestions, false, this.name); + }, + _append: function append(query, suggestions) { + suggestions = suggestions || []; + if (suggestions.length && this.$lastSuggestion.length) { + this._appendSuggestions(query, suggestions); + } else if (suggestions.length) { + this._renderSuggestions(query, suggestions); + } else if (!this.$lastSuggestion.length && this.templates.notFound) { + this._renderNotFound(query); + } + this.trigger("rendered", suggestions, true, this.name); + }, + _renderSuggestions: function renderSuggestions(query, suggestions) { + var $fragment; + $fragment = this._getSuggestionsFragment(query, suggestions); + this.$lastSuggestion = $fragment.children().last(); + this.$el.html($fragment).prepend(this._getHeader(query, suggestions)).append(this._getFooter(query, suggestions)); + }, + _appendSuggestions: function appendSuggestions(query, suggestions) { + var $fragment, $lastSuggestion; + $fragment = this._getSuggestionsFragment(query, suggestions); + $lastSuggestion = $fragment.children().last(); + this.$lastSuggestion.after($fragment); + this.$lastSuggestion = $lastSuggestion; + }, + _renderPending: function renderPending(query) { + var template = this.templates.pending; + this._resetLastSuggestion(); + template && this.$el.html(template({ + query: query, + dataset: this.name + })); + }, + _renderNotFound: function renderNotFound(query) { + var template = this.templates.notFound; + this._resetLastSuggestion(); + template && this.$el.html(template({ + query: query, + dataset: this.name + })); + }, + _empty: function empty() { + this.$el.empty(); + this._resetLastSuggestion(); + }, + _getSuggestionsFragment: function getSuggestionsFragment(query, suggestions) { + var that = this, fragment; + fragment = document.createDocumentFragment(); + _.each(suggestions, function getSuggestionNode(suggestion) { + var $el, context; + context = that._injectQuery(query, suggestion); + $el = $(that.templates.suggestion(context)).data(keys.dataset, that.name).data(keys.obj, suggestion).data(keys.val, that.displayFn(suggestion)).addClass(that.classes.suggestion + " " + that.classes.selectable); + fragment.appendChild($el[0]); + }); + this.highlight && highlight({ + className: this.classes.highlight, + node: fragment, + pattern: query + }); + return $(fragment); + }, + _getFooter: function getFooter(query, suggestions) { + return this.templates.footer ? this.templates.footer({ + query: query, + suggestions: suggestions, + dataset: this.name + }) : null; + }, + _getHeader: function getHeader(query, suggestions) { + return this.templates.header ? this.templates.header({ + query: query, + suggestions: suggestions, + dataset: this.name + }) : null; + }, + _resetLastSuggestion: function resetLastSuggestion() { + this.$lastSuggestion = $(); + }, + _injectQuery: function injectQuery(query, obj) { + return _.isObject(obj) ? _.mixin({ + _query: query + }, obj) : obj; + }, + update: function update(query) { + var that = this, canceled = false, syncCalled = false, rendered = 0; + this.cancel(); + this.cancel = function cancel() { + canceled = true; + that.cancel = $.noop; + that.async && that.trigger("asyncCanceled", query, that.name); + }; + this.source(query, sync, async); + !syncCalled && sync([]); + function sync(suggestions) { + if (syncCalled) { + return; + } + syncCalled = true; + suggestions = (suggestions || []).slice(0, that.limit); + rendered = suggestions.length; + that._overwrite(query, suggestions); + if (rendered < that.limit && that.async) { + that.trigger("asyncRequested", query, that.name); + } + } + function async(suggestions) { + suggestions = suggestions || []; + if (!canceled && rendered < that.limit) { + that.cancel = $.noop; + var idx = Math.abs(rendered - that.limit); + rendered += idx; + that._append(query, suggestions.slice(0, idx)); + that.async && that.trigger("asyncReceived", query, that.name); + } + } + }, + cancel: $.noop, + clear: function clear() { + this._empty(); + this.cancel(); + this.trigger("cleared"); + }, + isEmpty: function isEmpty() { + return this.$el.is(":empty"); + }, + destroy: function destroy() { + this.$el = $("
"); + } + }); + return Dataset; + function getDisplayFn(display) { + display = display || _.stringify; + return _.isFunction(display) ? display : displayFn; + function displayFn(obj) { + return obj[display]; + } + } + function getTemplates(templates, displayFn) { + return { + notFound: templates.notFound && _.templatify(templates.notFound), + pending: templates.pending && _.templatify(templates.pending), + header: templates.header && _.templatify(templates.header), + footer: templates.footer && _.templatify(templates.footer), + suggestion: templates.suggestion ? userSuggestionTemplate : suggestionTemplate + }; + function userSuggestionTemplate(context) { + var template = templates.suggestion; + return $(template(context)).attr("id", _.guid()); + } + function suggestionTemplate(context) { + return $('
').attr("id", _.guid()).text(displayFn(context)); + } + } + function isValidName(str) { + return /^[_a-zA-Z0-9-]+$/.test(str); + } + }(); + var Menu = function() { + "use strict"; + function Menu(o, www) { + var that = this; + o = o || {}; + if (!o.node) { + $.error("node is required"); + } + www.mixin(this); + this.$node = $(o.node); + this.query = null; + this.datasets = _.map(o.datasets, initializeDataset); + function initializeDataset(oDataset) { + var node = that.$node.find(oDataset.node).first(); + oDataset.node = node.length ? node : $("
").appendTo(that.$node); + return new Dataset(oDataset, www); + } + } + _.mixin(Menu.prototype, EventEmitter, { + _onSelectableClick: function onSelectableClick($e) { + this.trigger("selectableClicked", $($e.currentTarget)); + }, + _onRendered: function onRendered(type, dataset, suggestions, async) { + this.$node.toggleClass(this.classes.empty, this._allDatasetsEmpty()); + this.trigger("datasetRendered", dataset, suggestions, async); + }, + _onCleared: function onCleared() { + this.$node.toggleClass(this.classes.empty, this._allDatasetsEmpty()); + this.trigger("datasetCleared"); + }, + _propagate: function propagate() { + this.trigger.apply(this, arguments); + }, + _allDatasetsEmpty: function allDatasetsEmpty() { + return _.every(this.datasets, _.bind(function isDatasetEmpty(dataset) { + var isEmpty = dataset.isEmpty(); + this.$node.attr("aria-expanded", !isEmpty); + return isEmpty; + }, this)); + }, + _getSelectables: function getSelectables() { + return this.$node.find(this.selectors.selectable); + }, + _removeCursor: function _removeCursor() { + var $selectable = this.getActiveSelectable(); + $selectable && $selectable.removeClass(this.classes.cursor); + }, + _ensureVisible: function ensureVisible($el) { + var elTop, elBottom, nodeScrollTop, nodeHeight; + elTop = $el.position().top; + elBottom = elTop + $el.outerHeight(true); + nodeScrollTop = this.$node.scrollTop(); + nodeHeight = this.$node.height() + parseInt(this.$node.css("paddingTop"), 10) + parseInt(this.$node.css("paddingBottom"), 10); + if (elTop < 0) { + this.$node.scrollTop(nodeScrollTop + elTop); + } else if (nodeHeight < elBottom) { + this.$node.scrollTop(nodeScrollTop + (elBottom - nodeHeight)); + } + }, + bind: function() { + var that = this, onSelectableClick; + onSelectableClick = _.bind(this._onSelectableClick, this); + this.$node.on("click.tt", this.selectors.selectable, onSelectableClick); + this.$node.on("mouseover", this.selectors.selectable, function() { + that.setCursor($(this)); + }); + this.$node.on("mouseleave", function() { + that._removeCursor(); + }); + _.each(this.datasets, function(dataset) { + dataset.onSync("asyncRequested", that._propagate, that).onSync("asyncCanceled", that._propagate, that).onSync("asyncReceived", that._propagate, that).onSync("rendered", that._onRendered, that).onSync("cleared", that._onCleared, that); + }); + return this; + }, + isOpen: function isOpen() { + return this.$node.hasClass(this.classes.open); + }, + open: function open() { + this.$node.scrollTop(0); + this.$node.addClass(this.classes.open); + }, + close: function close() { + this.$node.attr("aria-expanded", false); + this.$node.removeClass(this.classes.open); + this._removeCursor(); + }, + setLanguageDirection: function setLanguageDirection(dir) { + this.$node.attr("dir", dir); + }, + selectableRelativeToCursor: function selectableRelativeToCursor(delta) { + var $selectables, $oldCursor, oldIndex, newIndex; + $oldCursor = this.getActiveSelectable(); + $selectables = this._getSelectables(); + oldIndex = $oldCursor ? $selectables.index($oldCursor) : -1; + newIndex = oldIndex + delta; + newIndex = (newIndex + 1) % ($selectables.length + 1) - 1; + newIndex = newIndex < -1 ? $selectables.length - 1 : newIndex; + return newIndex === -1 ? null : $selectables.eq(newIndex); + }, + setCursor: function setCursor($selectable) { + this._removeCursor(); + if ($selectable = $selectable && $selectable.first()) { + $selectable.addClass(this.classes.cursor); + this._ensureVisible($selectable); + } + }, + getSelectableData: function getSelectableData($el) { + return $el && $el.length ? Dataset.extractData($el) : null; + }, + getActiveSelectable: function getActiveSelectable() { + var $selectable = this._getSelectables().filter(this.selectors.cursor).first(); + return $selectable.length ? $selectable : null; + }, + getTopSelectable: function getTopSelectable() { + var $selectable = this._getSelectables().first(); + return $selectable.length ? $selectable : null; + }, + update: function update(query) { + var isValidUpdate = query !== this.query; + if (isValidUpdate) { + this.query = query; + _.each(this.datasets, updateDataset); + } + return isValidUpdate; + function updateDataset(dataset) { + dataset.update(query); + } + }, + empty: function empty() { + _.each(this.datasets, clearDataset); + this.query = null; + this.$node.addClass(this.classes.empty); + function clearDataset(dataset) { + dataset.clear(); + } + }, + destroy: function destroy() { + this.$node.off(".tt"); + this.$node = $("
"); + _.each(this.datasets, destroyDataset); + function destroyDataset(dataset) { + dataset.destroy(); + } + } + }); + return Menu; + }(); + var Status = function() { + "use strict"; + function Status(options) { + this.$el = $("", { + role: "status", + "aria-live": "polite" + }).css({ + position: "absolute", + padding: "0", + border: "0", + height: "1px", + width: "1px", + "margin-bottom": "-1px", + "margin-right": "-1px", + overflow: "hidden", + clip: "rect(0 0 0 0)", + "white-space": "nowrap" + }); + options.$input.after(this.$el); + _.each(options.menu.datasets, _.bind(function(dataset) { + if (dataset.onSync) { + dataset.onSync("rendered", _.bind(this.update, this)); + dataset.onSync("cleared", _.bind(this.cleared, this)); + } + }, this)); + } + _.mixin(Status.prototype, { + update: function update(event, suggestions) { + var length = suggestions.length; + var words; + if (length === 1) { + words = { + result: "result", + is: "is" + }; + } else { + words = { + result: "results", + is: "are" + }; + } + this.$el.text(length + " " + words.result + " " + words.is + " available, use up and down arrow keys to navigate."); + }, + cleared: function() { + this.$el.text(""); + } + }); + return Status; + }(); + var DefaultMenu = function() { + "use strict"; + var s = Menu.prototype; + function DefaultMenu() { + Menu.apply(this, [].slice.call(arguments, 0)); + } + _.mixin(DefaultMenu.prototype, Menu.prototype, { + open: function open() { + !this._allDatasetsEmpty() && this._show(); + return s.open.apply(this, [].slice.call(arguments, 0)); + }, + close: function close() { + this._hide(); + return s.close.apply(this, [].slice.call(arguments, 0)); + }, + _onRendered: function onRendered() { + if (this._allDatasetsEmpty()) { + this._hide(); + } else { + this.isOpen() && this._show(); + } + return s._onRendered.apply(this, [].slice.call(arguments, 0)); + }, + _onCleared: function onCleared() { + if (this._allDatasetsEmpty()) { + this._hide(); + } else { + this.isOpen() && this._show(); + } + return s._onCleared.apply(this, [].slice.call(arguments, 0)); + }, + setLanguageDirection: function setLanguageDirection(dir) { + this.$node.css(dir === "ltr" ? this.css.ltr : this.css.rtl); + return s.setLanguageDirection.apply(this, [].slice.call(arguments, 0)); + }, + _hide: function hide() { + this.$node.hide(); + }, + _show: function show() { + this.$node.css("display", "block"); + } + }); + return DefaultMenu; + }(); + var Typeahead = function() { + "use strict"; + function Typeahead(o, www) { + var onFocused, onBlurred, onEnterKeyed, onTabKeyed, onEscKeyed, onUpKeyed, onDownKeyed, onLeftKeyed, onRightKeyed, onQueryChanged, onWhitespaceChanged; + o = o || {}; + if (!o.input) { + $.error("missing input"); + } + if (!o.menu) { + $.error("missing menu"); + } + if (!o.eventBus) { + $.error("missing event bus"); + } + www.mixin(this); + this.eventBus = o.eventBus; + this.minLength = _.isNumber(o.minLength) ? o.minLength : 1; + this.input = o.input; + this.menu = o.menu; + this.enabled = true; + this.autoselect = !!o.autoselect; + this.active = false; + this.input.hasFocus() && this.activate(); + this.dir = this.input.getLangDir(); + this._hacks(); + this.menu.bind().onSync("selectableClicked", this._onSelectableClicked, this).onSync("asyncRequested", this._onAsyncRequested, this).onSync("asyncCanceled", this._onAsyncCanceled, this).onSync("asyncReceived", this._onAsyncReceived, this).onSync("datasetRendered", this._onDatasetRendered, this).onSync("datasetCleared", this._onDatasetCleared, this); + onFocused = c(this, "activate", "open", "_onFocused"); + onBlurred = c(this, "deactivate", "_onBlurred"); + onEnterKeyed = c(this, "isActive", "isOpen", "_onEnterKeyed"); + onTabKeyed = c(this, "isActive", "isOpen", "_onTabKeyed"); + onEscKeyed = c(this, "isActive", "_onEscKeyed"); + onUpKeyed = c(this, "isActive", "open", "_onUpKeyed"); + onDownKeyed = c(this, "isActive", "open", "_onDownKeyed"); + onLeftKeyed = c(this, "isActive", "isOpen", "_onLeftKeyed"); + onRightKeyed = c(this, "isActive", "isOpen", "_onRightKeyed"); + onQueryChanged = c(this, "_openIfActive", "_onQueryChanged"); + onWhitespaceChanged = c(this, "_openIfActive", "_onWhitespaceChanged"); + this.input.bind().onSync("focused", onFocused, this).onSync("blurred", onBlurred, this).onSync("enterKeyed", onEnterKeyed, this).onSync("tabKeyed", onTabKeyed, this).onSync("escKeyed", onEscKeyed, this).onSync("upKeyed", onUpKeyed, this).onSync("downKeyed", onDownKeyed, this).onSync("leftKeyed", onLeftKeyed, this).onSync("rightKeyed", onRightKeyed, this).onSync("queryChanged", onQueryChanged, this).onSync("whitespaceChanged", onWhitespaceChanged, this).onSync("langDirChanged", this._onLangDirChanged, this); + } + _.mixin(Typeahead.prototype, { + _hacks: function hacks() { + var $input, $menu; + $input = this.input.$input || $("
"); + $menu = this.menu.$node || $("
"); + $input.on("blur.tt", function($e) { + var active, isActive, hasActive; + active = document.activeElement; + isActive = $menu.is(active); + hasActive = $menu.has(active).length > 0; + if (_.isMsie() && (isActive || hasActive)) { + $e.preventDefault(); + $e.stopImmediatePropagation(); + _.defer(function() { + $input.focus(); + }); + } + }); + $menu.on("mousedown.tt", function($e) { + $e.preventDefault(); + }); + }, + _onSelectableClicked: function onSelectableClicked(type, $el) { + this.select($el); + }, + _onDatasetCleared: function onDatasetCleared() { + this._updateHint(); + }, + _onDatasetRendered: function onDatasetRendered(type, suggestions, async, dataset) { + this._updateHint(); + if (this.autoselect) { + var cursorClass = this.selectors.cursor.substr(1); + this.menu.$node.find(this.selectors.suggestion).first().addClass(cursorClass); + } + this.eventBus.trigger("render", suggestions, async, dataset); + }, + _onAsyncRequested: function onAsyncRequested(type, dataset, query) { + this.eventBus.trigger("asyncrequest", query, dataset); + }, + _onAsyncCanceled: function onAsyncCanceled(type, dataset, query) { + this.eventBus.trigger("asynccancel", query, dataset); + }, + _onAsyncReceived: function onAsyncReceived(type, dataset, query) { + this.eventBus.trigger("asyncreceive", query, dataset); + }, + _onFocused: function onFocused() { + this._minLengthMet() && this.menu.update(this.input.getQuery()); + }, + _onBlurred: function onBlurred() { + if (this.input.hasQueryChangedSinceLastFocus()) { + this.eventBus.trigger("change", this.input.getQuery()); + } + }, + _onEnterKeyed: function onEnterKeyed(type, $e) { + var $selectable; + if ($selectable = this.menu.getActiveSelectable()) { + if (this.select($selectable)) { + $e.preventDefault(); + $e.stopPropagation(); + } + } else if (this.autoselect) { + if (this.select(this.menu.getTopSelectable())) { + $e.preventDefault(); + $e.stopPropagation(); + } + } + }, + _onTabKeyed: function onTabKeyed(type, $e) { + var $selectable; + if ($selectable = this.menu.getActiveSelectable()) { + this.select($selectable) && $e.preventDefault(); + } else if (this.autoselect) { + if ($selectable = this.menu.getTopSelectable()) { + this.autocomplete($selectable) && $e.preventDefault(); + } + } + }, + _onEscKeyed: function onEscKeyed() { + this.close(); + }, + _onUpKeyed: function onUpKeyed() { + this.moveCursor(-1); + }, + _onDownKeyed: function onDownKeyed() { + this.moveCursor(+1); + }, + _onLeftKeyed: function onLeftKeyed() { + if (this.dir === "rtl" && this.input.isCursorAtEnd()) { + this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable()); + } + }, + _onRightKeyed: function onRightKeyed() { + if (this.dir === "ltr" && this.input.isCursorAtEnd()) { + this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable()); + } + }, + _onQueryChanged: function onQueryChanged(e, query) { + this._minLengthMet(query) ? this.menu.update(query) : this.menu.empty(); + }, + _onWhitespaceChanged: function onWhitespaceChanged() { + this._updateHint(); + }, + _onLangDirChanged: function onLangDirChanged(e, dir) { + if (this.dir !== dir) { + this.dir = dir; + this.menu.setLanguageDirection(dir); + } + }, + _openIfActive: function openIfActive() { + this.isActive() && this.open(); + }, + _minLengthMet: function minLengthMet(query) { + query = _.isString(query) ? query : this.input.getQuery() || ""; + return query.length >= this.minLength; + }, + _updateHint: function updateHint() { + var $selectable, data, val, query, escapedQuery, frontMatchRegEx, match; + $selectable = this.menu.getTopSelectable(); + data = this.menu.getSelectableData($selectable); + val = this.input.getInputValue(); + if (data && !_.isBlankString(val) && !this.input.hasOverflow()) { + query = Input.normalizeQuery(val); + escapedQuery = _.escapeRegExChars(query); + frontMatchRegEx = new RegExp("^(?:" + escapedQuery + ")(.+$)", "i"); + match = frontMatchRegEx.exec(data.val); + match && this.input.setHint(val + match[1]); + } else { + this.input.clearHint(); + } + }, + isEnabled: function isEnabled() { + return this.enabled; + }, + enable: function enable() { + this.enabled = true; + }, + disable: function disable() { + this.enabled = false; + }, + isActive: function isActive() { + return this.active; + }, + activate: function activate() { + if (this.isActive()) { + return true; + } else if (!this.isEnabled() || this.eventBus.before("active")) { + return false; + } else { + this.active = true; + this.eventBus.trigger("active"); + return true; + } + }, + deactivate: function deactivate() { + if (!this.isActive()) { + return true; + } else if (this.eventBus.before("idle")) { + return false; + } else { + this.active = false; + this.close(); + this.eventBus.trigger("idle"); + return true; + } + }, + isOpen: function isOpen() { + return this.menu.isOpen(); + }, + open: function open() { + if (!this.isOpen() && !this.eventBus.before("open")) { + this.input.setAriaExpanded(true); + this.menu.open(); + this._updateHint(); + this.eventBus.trigger("open"); + } + return this.isOpen(); + }, + close: function close() { + if (this.isOpen() && !this.eventBus.before("close")) { + this.input.setAriaExpanded(false); + this.menu.close(); + this.input.clearHint(); + this.input.resetInputValue(); + this.eventBus.trigger("close"); + } + return !this.isOpen(); + }, + setVal: function setVal(val) { + this.input.setQuery(_.toStr(val)); + }, + getVal: function getVal() { + return this.input.getQuery(); + }, + select: function select($selectable) { + var data = this.menu.getSelectableData($selectable); + if (data && !this.eventBus.before("select", data.obj, data.dataset)) { + this.input.setQuery(data.val, true); + this.eventBus.trigger("select", data.obj, data.dataset); + this.close(); + return true; + } + return false; + }, + autocomplete: function autocomplete($selectable) { + var query, data, isValid; + query = this.input.getQuery(); + data = this.menu.getSelectableData($selectable); + isValid = data && query !== data.val; + if (isValid && !this.eventBus.before("autocomplete", data.obj, data.dataset)) { + this.input.setQuery(data.val); + this.eventBus.trigger("autocomplete", data.obj, data.dataset); + return true; + } + return false; + }, + moveCursor: function moveCursor(delta) { + var query, $candidate, data, suggestion, datasetName, cancelMove, id; + query = this.input.getQuery(); + $candidate = this.menu.selectableRelativeToCursor(delta); + data = this.menu.getSelectableData($candidate); + suggestion = data ? data.obj : null; + datasetName = data ? data.dataset : null; + id = $candidate ? $candidate.attr("id") : null; + this.input.trigger("cursorchange", id); + cancelMove = this._minLengthMet() && this.menu.update(query); + if (!cancelMove && !this.eventBus.before("cursorchange", suggestion, datasetName)) { + this.menu.setCursor($candidate); + if (data) { + if (typeof data.val === "string") { + this.input.setInputValue(data.val); + } + } else { + this.input.resetInputValue(); + this._updateHint(); + } + this.eventBus.trigger("cursorchange", suggestion, datasetName); + return true; + } + return false; + }, + destroy: function destroy() { + this.input.destroy(); + this.menu.destroy(); + } + }); + return Typeahead; + function c(ctx) { + var methods = [].slice.call(arguments, 1); + return function() { + var args = [].slice.call(arguments); + _.each(methods, function(method) { + return ctx[method].apply(ctx, args); + }); + }; + } + }(); + (function() { + "use strict"; + var old, keys, methods; + old = $.fn.typeahead; + keys = { + www: "tt-www", + attrs: "tt-attrs", + typeahead: "tt-typeahead" + }; + methods = { + initialize: function initialize(o, datasets) { + var www; + datasets = _.isArray(datasets) ? datasets : [].slice.call(arguments, 1); + o = o || {}; + www = WWW(o.classNames); + return this.each(attach); + function attach() { + var $input, $wrapper, $hint, $menu, defaultHint, defaultMenu, eventBus, input, menu, status, typeahead, MenuConstructor; + _.each(datasets, function(d) { + d.highlight = !!o.highlight; + }); + $input = $(this); + $wrapper = $(www.html.wrapper); + $hint = $elOrNull(o.hint); + $menu = $elOrNull(o.menu); + defaultHint = o.hint !== false && !$hint; + defaultMenu = o.menu !== false && !$menu; + defaultHint && ($hint = buildHintFromInput($input, www)); + defaultMenu && ($menu = $(www.html.menu).css(www.css.menu)); + $hint && $hint.val(""); + $input = prepInput($input, www); + if (defaultHint || defaultMenu) { + $wrapper.css(www.css.wrapper); + $input.css(defaultHint ? www.css.input : www.css.inputWithNoHint); + $input.wrap($wrapper).parent().prepend(defaultHint ? $hint : null).append(defaultMenu ? $menu : null); + } + MenuConstructor = defaultMenu ? DefaultMenu : Menu; + eventBus = new EventBus({ + el: $input + }); + input = new Input({ + hint: $hint, + input: $input, + menu: $menu + }, www); + menu = new MenuConstructor({ + node: $menu, + datasets: datasets + }, www); + status = new Status({ + $input: $input, + menu: menu + }); + typeahead = new Typeahead({ + input: input, + menu: menu, + eventBus: eventBus, + minLength: o.minLength, + autoselect: o.autoselect + }, www); + $input.data(keys.www, www); + $input.data(keys.typeahead, typeahead); + } + }, + isEnabled: function isEnabled() { + var enabled; + ttEach(this.first(), function(t) { + enabled = t.isEnabled(); + }); + return enabled; + }, + enable: function enable() { + ttEach(this, function(t) { + t.enable(); + }); + return this; + }, + disable: function disable() { + ttEach(this, function(t) { + t.disable(); + }); + return this; + }, + isActive: function isActive() { + var active; + ttEach(this.first(), function(t) { + active = t.isActive(); + }); + return active; + }, + activate: function activate() { + ttEach(this, function(t) { + t.activate(); + }); + return this; + }, + deactivate: function deactivate() { + ttEach(this, function(t) { + t.deactivate(); + }); + return this; + }, + isOpen: function isOpen() { + var open; + ttEach(this.first(), function(t) { + open = t.isOpen(); + }); + return open; + }, + open: function open() { + ttEach(this, function(t) { + t.open(); + }); + return this; + }, + close: function close() { + ttEach(this, function(t) { + t.close(); + }); + return this; + }, + select: function select(el) { + var success = false, $el = $(el); + ttEach(this.first(), function(t) { + success = t.select($el); + }); + return success; + }, + autocomplete: function autocomplete(el) { + var success = false, $el = $(el); + ttEach(this.first(), function(t) { + success = t.autocomplete($el); + }); + return success; + }, + moveCursor: function moveCursoe(delta) { + var success = false; + ttEach(this.first(), function(t) { + success = t.moveCursor(delta); + }); + return success; + }, + val: function val(newVal) { + var query; + if (!arguments.length) { + ttEach(this.first(), function(t) { + query = t.getVal(); + }); + return query; + } else { + ttEach(this, function(t) { + t.setVal(_.toStr(newVal)); + }); + return this; + } + }, + destroy: function destroy() { + ttEach(this, function(typeahead, $input) { + revert($input); + typeahead.destroy(); + }); + return this; + } + }; + $.fn.typeahead = function(method) { + if (methods[method]) { + return methods[method].apply(this, [].slice.call(arguments, 1)); + } else { + return methods.initialize.apply(this, arguments); + } + }; + $.fn.typeahead.noConflict = function noConflict() { + $.fn.typeahead = old; + return this; + }; + function ttEach($els, fn) { + $els.each(function() { + var $input = $(this), typeahead; + (typeahead = $input.data(keys.typeahead)) && fn(typeahead, $input); + }); + } + function buildHintFromInput($input, www) { + return $input.clone().addClass(www.classes.hint).removeData().css(www.css.hint).css(getBackgroundStyles($input)).prop({ + readonly: true, + required: false + }).removeAttr("id name placeholder").removeClass("required").attr({ + spellcheck: "false", + tabindex: -1 + }); + } + function prepInput($input, www) { + $input.data(keys.attrs, { + dir: $input.attr("dir"), + autocomplete: $input.attr("autocomplete"), + spellcheck: $input.attr("spellcheck"), + style: $input.attr("style") + }); + $input.addClass(www.classes.input).attr({ + spellcheck: false + }); + try { + !$input.attr("dir") && $input.attr("dir", "auto"); + } catch (e) {} + return $input; + } + function getBackgroundStyles($el) { + return { + backgroundAttachment: $el.css("background-attachment"), + backgroundClip: $el.css("background-clip"), + backgroundColor: $el.css("background-color"), + backgroundImage: $el.css("background-image"), + backgroundOrigin: $el.css("background-origin"), + backgroundPosition: $el.css("background-position"), + backgroundRepeat: $el.css("background-repeat"), + backgroundSize: $el.css("background-size") + }; + } + function revert($input) { + var www, $wrapper; + www = $input.data(keys.www); + $wrapper = $input.parent().filter(www.selectors.wrapper); + _.each($input.data(keys.attrs), function(val, key) { + _.isUndefined(val) ? $input.removeAttr(key) : $input.attr(key, val); + }); + $input.removeData(keys.typeahead).removeData(keys.www).removeData(keys.attr).removeClass(www.classes.input); + if ($wrapper.length) { + $input.detach().insertAfter($wrapper); + $wrapper.remove(); + } + } + function $elOrNull(obj) { + var isValid, $el; + isValid = _.isJQuery(obj) || _.isElement(obj); + $el = isValid ? $(obj).first() : []; + return $el.length ? $el : null; + } + })(); +}); \ No newline at end of file diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/large_tuple.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/large_tuple.html new file mode 100644 index 000000000..87649cf27 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/large_tuple.html @@ -0,0 +1,478 @@ + + + + large_tuple Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Large Tuple

+ +

Tuples shouldn’t have too many members. Create a custom type instead.

+ +
    +
  • Identifier: large_tuple
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: metrics
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +warning + +2 +
    +error + +3 +
  • +
+

Non Triggering Examples

+
let foo: (Int, Int)
+
+
let foo: (start: Int, end: Int)
+
+
let foo: (Int, (Int, String))
+
+
func foo() -> (Int, Int)
+
+
func foo() -> (Int, Int) {}
+
+
func foo(bar: String) -> (Int, Int)
+
+
func foo(bar: String) -> (Int, Int) {}
+
+
func foo() throws -> (Int, Int)
+
+
func foo() throws -> (Int, Int) {}
+
+
let foo: (Int, Int, Int) -> Void
+
+
let foo: (Int, Int, Int) throws -> Void
+
+
func foo(bar: (Int, String, Float) -> Void)
+
+
func foo(bar: (Int, String, Float) throws -> Void)
+
+
var completionHandler: ((_ data: Data?, _ resp: URLResponse?, _ e: NSError?) -> Void)!
+
+
func getDictionaryAndInt() -> (Dictionary<Int, String>, Int)?
+
+
func getGenericTypeAndInt() -> (Type<Int, String, Float>, Int)?
+
+
func foo() async -> (Int, Int)
+
+
func foo() async -> (Int, Int) {}
+
+
func foo(bar: String) async -> (Int, Int)
+
+
func foo(bar: String) async -> (Int, Int) {}
+
+
func foo() async throws -> (Int, Int)
+
+
func foo() async throws -> (Int, Int) {}
+
+
let foo: (Int, Int, Int) async -> Void
+
+
let foo: (Int, Int, Int) async throws -> Void
+
+
func foo(bar: (Int, String, Float) async -> Void)
+
+
func foo(bar: (Int, String, Float) async throws -> Void)
+
+
func getDictionaryAndInt() async -> (Dictionary<Int, String>, Int)?
+
+
func getGenericTypeAndInt() async -> (Type<Int, String, Float>, Int)?
+
+

Triggering Examples

+
let foo: ↓(Int, Int, Int)
+
+
let foo: ↓(start: Int, end: Int, value: String)
+
+
let foo: (Int, ↓(Int, Int, Int))
+
+
func foo(bar: ↓(Int, Int, Int))
+
+
func foo() -> ↓(Int, Int, Int)
+
+
func foo() -> ↓(Int, Int, Int) {}
+
+
func foo(bar: String) -> ↓(Int, Int, Int)
+
+
func foo(bar: String) -> ↓(Int, Int, Int) {}
+
+
func foo() throws -> ↓(Int, Int, Int)
+
+
func foo() throws -> ↓(Int, Int, Int) {}
+
+
func foo() throws -> ↓(Int, ↓(String, String, String), Int) {}
+
+
func getDictionaryAndInt() -> (Dictionary<Int, ↓(String, String, String)>, Int)?
+
+
func foo(bar: ↓(Int, Int, Int)) async
+
+
func foo() async -> ↓(Int, Int, Int)
+
+
func foo() async -> ↓(Int, Int, Int) {}
+
+
func foo(bar: String) async -> ↓(Int, Int, Int)
+
+
func foo(bar: String) async -> ↓(Int, Int, Int) {}
+
+
func foo() async throws -> ↓(Int, Int, Int)
+
+
func foo() async throws -> ↓(Int, Int, Int) {}
+
+
func foo() async throws -> ↓(Int, ↓(String, String, String), Int) {}
+
+
func getDictionaryAndInt() async -> (Dictionary<Int, ↓(String, String, String)>, Int)?
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/last_where.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/last_where.html new file mode 100644 index 000000000..24cffff1a --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/last_where.html @@ -0,0 +1,397 @@ + + + + last_where Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Last Where

+ +

Prefer using .last(where:) over .filter { }.last in collections

+ +
    +
  • Identifier: last_where
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
kinds.filter(excludingKinds.contains).isEmpty && kinds.last == .identifier
+
+
myList.last(where: { $0 % 2 == 0 })
+
+
match(pattern: pattern).filter { $0.last == .identifier }
+
+
(myList.filter { $0 == 1 }.suffix(2)).last
+
+
collection.filter("stringCol = '3'").last
+
+

Triggering Examples

+
↓myList.filter { $0 % 2 == 0 }.last
+
+
↓myList.filter({ $0 % 2 == 0 }).last
+
+
↓myList.map { $0 + 1 }.filter({ $0 % 2 == 0 }).last
+
+
↓myList.map { $0 + 1 }.filter({ $0 % 2 == 0 }).last?.something()
+
+
↓myList.filter(someFunction).last
+
+
↓myList.filter({ $0 % 2 == 0 })
+.last
+
+
(↓myList.filter { $0 == 1 }).last
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/leading_whitespace.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/leading_whitespace.html new file mode 100644 index 000000000..2e2bf0a11 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/leading_whitespace.html @@ -0,0 +1,379 @@ + + + + leading_whitespace Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Leading Whitespace

+ +

Files should not contain leading whitespace

+ +
    +
  • Identifier: leading_whitespace
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
//
+
+

Triggering Examples

+

+//
+
+
 //
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/legacy_cggeometry_functions.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/legacy_cggeometry_functions.html new file mode 100644 index 000000000..5420f794c --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/legacy_cggeometry_functions.html @@ -0,0 +1,452 @@ + + + + legacy_cggeometry_functions Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Legacy CGGeometry Functions

+ +

Struct extension properties and methods are preferred over legacy functions

+ +
    +
  • Identifier: legacy_cggeometry_functions
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
rect.width
+
+
rect.height
+
+
rect.minX
+
+
rect.midX
+
+
rect.maxX
+
+
rect.minY
+
+
rect.midY
+
+
rect.maxY
+
+
rect.isNull
+
+
rect.isEmpty
+
+
rect.isInfinite
+
+
rect.standardized
+
+
rect.integral
+
+
rect.insetBy(dx: 5.0, dy: -7.0)
+
+
rect.offsetBy(dx: 5.0, dy: -7.0)
+
+
rect1.union(rect2)
+
+
rect1.intersect(rect2)
+
+
rect1.contains(rect2)
+
+
rect.contains(point)
+
+
rect1.intersects(rect2)
+
+

Triggering Examples

+
↓CGRectGetWidth(rect)
+
+
↓CGRectGetHeight(rect)
+
+
↓CGRectGetMinX(rect)
+
+
↓CGRectGetMidX(rect)
+
+
↓CGRectGetMaxX(rect)
+
+
↓CGRectGetMinY(rect)
+
+
↓CGRectGetMidY(rect)
+
+
↓CGRectGetMaxY(rect)
+
+
↓CGRectIsNull(rect)
+
+
↓CGRectIsEmpty(rect)
+
+
↓CGRectIsInfinite(rect)
+
+
↓CGRectStandardize(rect)
+
+
↓CGRectIntegral(rect)
+
+
↓CGRectInset(rect, 10, 5)
+
+
↓CGRectOffset(rect, -2, 8.3)
+
+
↓CGRectUnion(rect1, rect2)
+
+
↓CGRectIntersection(rect1, rect2)
+
+
↓CGRectContainsRect(rect1, rect2)
+
+
↓CGRectContainsPoint(rect, point)
+
+
↓CGRectIntersectsRect(rect1, rect2)
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/legacy_constant.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/legacy_constant.html new file mode 100644 index 000000000..25403214e --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/legacy_constant.html @@ -0,0 +1,412 @@ + + + + legacy_constant Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Legacy Constant

+ +

Struct-scoped constants are preferred over legacy global constants

+ +
    +
  • Identifier: legacy_constant
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
CGRect.infinite
+
+
CGPoint.zero
+
+
CGRect.zero
+
+
CGSize.zero
+
+
NSPoint.zero
+
+
NSRect.zero
+
+
NSSize.zero
+
+
CGRect.null
+
+
CGFloat.pi
+
+
Float.pi
+
+

Triggering Examples

+
↓CGRectInfinite
+
+
↓CGPointZero
+
+
↓CGRectZero
+
+
↓CGSizeZero
+
+
↓NSZeroPoint
+
+
↓NSZeroRect
+
+
↓NSZeroSize
+
+
↓CGRectNull
+
+
↓CGFloat(M_PI)
+
+
↓Float(M_PI)
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/legacy_constructor.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/legacy_constructor.html new file mode 100644 index 000000000..cf1036757 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/legacy_constructor.html @@ -0,0 +1,465 @@ + + + + legacy_constructor Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Legacy Constructor

+ +

Swift constructors are preferred over legacy convenience functions

+ +
    +
  • Identifier: legacy_constructor
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
CGPoint(x: 10, y: 10)
+
+
CGPoint(x: xValue, y: yValue)
+
+
CGSize(width: 10, height: 10)
+
+
CGSize(width: aWidth, height: aHeight)
+
+
CGRect(x: 0, y: 0, width: 10, height: 10)
+
+
CGRect(x: xVal, y: yVal, width: aWidth, height: aHeight)
+
+
CGVector(dx: 10, dy: 10)
+
+
CGVector(dx: deltaX, dy: deltaY)
+
+
NSPoint(x: 10, y: 10)
+
+
NSPoint(x: xValue, y: yValue)
+
+
NSSize(width: 10, height: 10)
+
+
NSSize(width: aWidth, height: aHeight)
+
+
NSRect(x: 0, y: 0, width: 10, height: 10)
+
+
NSRect(x: xVal, y: yVal, width: aWidth, height: aHeight)
+
+
NSRange(location: 10, length: 1)
+
+
NSRange(location: loc, length: len)
+
+
UIEdgeInsets(top: 0, left: 0, bottom: 10, right: 10)
+
+
UIEdgeInsets(top: aTop, left: aLeft, bottom: aBottom, right: aRight)
+
+
NSEdgeInsets(top: 0, left: 0, bottom: 10, right: 10)
+
+
NSEdgeInsets(top: aTop, left: aLeft, bottom: aBottom, right: aRight)
+
+
UIOffset(horizontal: 0, vertical: 10)
+
+
UIOffset(horizontal: horizontal, vertical: vertical)
+
+

Triggering Examples

+
↓CGPointMake(10, 10)
+
+
↓CGPointMake(xVal, yVal)
+
+
↓CGPointMake(calculateX(), 10)
+
+
↓CGSizeMake(10, 10)
+
+
↓CGSizeMake(aWidth, aHeight)
+
+
↓CGRectMake(0, 0, 10, 10)
+
+
↓CGRectMake(xVal, yVal, width, height)
+
+
↓CGVectorMake(10, 10)
+
+
↓CGVectorMake(deltaX, deltaY)
+
+
↓NSMakePoint(10, 10)
+
+
↓NSMakePoint(xVal, yVal)
+
+
↓NSMakeSize(10, 10)
+
+
↓NSMakeSize(aWidth, aHeight)
+
+
↓NSMakeRect(0, 0, 10, 10)
+
+
↓NSMakeRect(xVal, yVal, width, height)
+
+
↓NSMakeRange(10, 1)
+
+
↓NSMakeRange(loc, len)
+
+
↓UIEdgeInsetsMake(0, 0, 10, 10)
+
+
↓UIEdgeInsetsMake(top, left, bottom, right)
+
+
↓NSEdgeInsetsMake(0, 0, 10, 10)
+
+
↓NSEdgeInsetsMake(top, left, bottom, right)
+
+
↓CGVectorMake(10, 10)
+↓NSMakeRange(10, 1)
+
+
↓UIOffsetMake(0, 10)
+
+
↓UIOffsetMake(horizontal, vertical)
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/legacy_hashing.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/legacy_hashing.html new file mode 100644 index 000000000..b536cc40b --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/legacy_hashing.html @@ -0,0 +1,425 @@ + + + + legacy_hashing Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Legacy Hashing

+ +

Prefer using the hash(into:) function instead of overriding hashValue

+ +
    +
  • Identifier: legacy_hashing
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
struct Foo: Hashable {
+  let bar: Int = 10
+
+  func hash(into hasher: inout Hasher) {
+    hasher.combine(bar)
+  }
+}
+
+
class Foo: Hashable {
+  let bar: Int = 10
+
+  func hash(into hasher: inout Hasher) {
+    hasher.combine(bar)
+  }
+}
+
+
var hashValue: Int { return 1 }
+class Foo: Hashable { 
+ }
+
+
class Foo: Hashable {
+  let bar: String = "Foo"
+
+  public var hashValue: String {
+    return bar
+  }
+}
+
+
class Foo: Hashable {
+  let bar: String = "Foo"
+
+  public var hashValue: String {
+    get { return bar }
+    set { bar = newValue }
+  }
+}
+
+

Triggering Examples

+
struct Foo: Hashable {
+    let bar: Int = 10
+
+    public ↓var hashValue: Int {
+        return bar
+    }
+}
+
+
class Foo: Hashable {
+    let bar: Int = 10
+
+    public ↓var hashValue: Int {
+        return bar
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/legacy_multiple.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/legacy_multiple.html new file mode 100644 index 000000000..922add409 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/legacy_multiple.html @@ -0,0 +1,403 @@ + + + + legacy_multiple Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Legacy Multiple

+ +

Prefer using the isMultiple(of:) function instead of using the remainder operator (%)

+ +
    +
  • Identifier: legacy_multiple
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
cell.contentView.backgroundColor = indexPath.row.isMultiple(of: 2) ? .gray : .white
+
+
guard count.isMultiple(of: 2) else { throw DecodingError.dataCorrupted(...) }
+
+
sanityCheck(bytes > 0 && bytes.isMultiple(of: 4), "capacity must be multiple of 4 bytes")
+
+
guard let i = reversedNumbers.firstIndex(where: { $0.isMultiple(of: 2) }) else { return }
+
+
let constant = 56
+let isMultiple = value.isMultiple(of: constant)
+
+
let constant = 56
+let secret = value % constant == 5
+
+
let secretValue = (value % 3) + 2
+
+

Triggering Examples

+
cell.contentView.backgroundColor = indexPath.row ↓% 2 == 0 ? .gray : .white
+
+
cell.contentView.backgroundColor = 0 == indexPath.row ↓% 2 ? .gray : .white
+
+
cell.contentView.backgroundColor = indexPath.row ↓% 2 != 0 ? .gray : .white
+
+
guard count ↓% 2 == 0 else { throw DecodingError.dataCorrupted(...) }
+
+
sanityCheck(bytes > 0 && bytes ↓% 4 == 0, "capacity must be multiple of 4 bytes")
+
+
guard let i = reversedNumbers.firstIndex(where: { $0 ↓% 2 == 0 }) else { return }
+
+
let constant = 56
+let isMultiple = value ↓% constant == 0
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/legacy_nsgeometry_functions.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/legacy_nsgeometry_functions.html new file mode 100644 index 000000000..383fe1a31 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/legacy_nsgeometry_functions.html @@ -0,0 +1,448 @@ + + + + legacy_nsgeometry_functions Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Legacy NSGeometry Functions

+ +

Struct extension properties and methods are preferred over legacy functions

+ +
    +
  • Identifier: legacy_nsgeometry_functions
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
rect.width
+
+
rect.height
+
+
rect.minX
+
+
rect.midX
+
+
rect.maxX
+
+
rect.minY
+
+
rect.midY
+
+
rect.maxY
+
+
rect.isEmpty
+
+
rect.integral
+
+
rect.insetBy(dx: 5.0, dy: -7.0)
+
+
rect.offsetBy(dx: 5.0, dy: -7.0)
+
+
rect1.union(rect2)
+
+
rect1.intersection(rect2)
+
+
rect1.contains(rect2)
+
+
rect.contains(point)
+
+
rect1.intersects(rect2)
+
+

Triggering Examples

+
↓NSWidth(rect)
+
+
↓NSHeight(rect)
+
+
↓NSMinX(rect)
+
+
↓NSMidX(rect)
+
+
↓NSMaxX(rect)
+
+
↓NSMinY(rect)
+
+
↓NSMidY(rect)
+
+
↓NSMaxY(rect)
+
+
↓NSEqualRects(rect1, rect2)
+
+
↓NSEqualSizes(size1, size2)
+
+
↓NSEqualPoints(point1, point2)
+
+
↓NSEdgeInsetsEqual(insets2, insets2)
+
+
↓NSIsEmptyRect(rect)
+
+
↓NSIntegralRect(rect)
+
+
↓NSInsetRect(rect, 10, 5)
+
+
↓NSOffsetRect(rect, -2, 8.3)
+
+
↓NSUnionRect(rect1, rect2)
+
+
↓NSIntersectionRect(rect1, rect2)
+
+
↓NSContainsRect(rect1, rect2)
+
+
↓NSPointInRect(rect, point)
+
+
↓NSIntersectsRect(rect1, rect2)
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/legacy_objc_type.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/legacy_objc_type.html new file mode 100644 index 000000000..10a45ee54 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/legacy_objc_type.html @@ -0,0 +1,404 @@ + + + + legacy_objc_type Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Legacy Objective-C Reference Type

+ +

Prefer Swift value types to bridged Objective-C reference types

+ +
    +
  • Identifier: legacy_objc_type
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
var array = Array<Int>()
+
+
var calendar: Calendar? = nil
+
+
var formatter: NSDataDetector
+
+
var className: String = NSStringFromClass(MyClass.self)
+
+
_ = URLRequest.CachePolicy.reloadIgnoringLocalCacheData
+
+
_ = Notification.Name("com.apple.Music.playerInfo")
+
+

Triggering Examples

+
var array = ↓NSArray()
+
+
var calendar: ↓NSCalendar? = nil
+
+
_ = ↓NSURLRequest.CachePolicy.reloadIgnoringLocalCacheData
+
+
_ = ↓NSNotification.Name("com.apple.Music.playerInfo")
+
+
let keyValuePair: (Int) -> (↓NSString, ↓NSString) = {
+  let n = "\($0)" as ↓NSString; return (n, n)
+}
+dictionary = [↓NSString: ↓NSString](uniqueKeysWithValues:
+  (1...10_000).lazy.map(keyValuePair))
+
+
extension Foundation.Notification.Name {
+    static var reachabilityChanged: Foundation.↓NSNotification.Name {
+        return Foundation.Notification.Name("org.wordpress.reachability.changed")
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/legacy_random.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/legacy_random.html new file mode 100644 index 000000000..b57389384 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/legacy_random.html @@ -0,0 +1,384 @@ + + + + legacy_random Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Legacy Random

+ +

Prefer using type.random(in:) over legacy functions

+ +
    +
  • Identifier: legacy_random
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
Int.random(in: 0..<10)
+
+
Double.random(in: 8.6...111.34)
+
+
Float.random(in: 0 ..< 1)
+
+

Triggering Examples

+
↓arc4random()
+
+
↓arc4random_uniform(83)
+
+
↓drand48()
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/let_var_whitespace.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/let_var_whitespace.html new file mode 100644 index 000000000..09ffdfebf --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/let_var_whitespace.html @@ -0,0 +1,547 @@ + + + + let_var_whitespace Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Variable Declaration Whitespace

+ +

Variable declarations should be separated from other statements by a blank line

+ +
    +
  • Identifier: let_var_whitespace
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class C {
+let a = 0
+var x = 1
+
+var y = 2
+}
+
+
class C {
+let a = 5
+
+var x = 1
+}
+
+
class C {
+var a = 0
+}
+
+
class C {
+let a = 1 +
+    2
+let b = 5
+}
+
+
class C {
+var x: Int {
+    return 0
+}
+}
+
+
class C {
+var x: Int {
+    let a = 0
+
+    return a
+}
+}
+
+
class C {
+#if os(macOS)
+let a = 0
+
+func f() {}
+#endif
+}
+
+
class C {
+#warning("TODO: remove it")
+let a = 0
+#warning("TODO: remove it")
+let b = 0
+}
+
+
class C {
+#error("TODO: remove it")
+let a = 0
+}
+
+
class C {
+@available(swift 4)
+let a = 0
+}
+
+
class C {
+@objc
+var s: String = ""
+}
+
+
class C {
+@objc
+func a() {}
+}
+
+
class C {
+var x = 0
+lazy
+var y = 0
+}
+
+
class C {
+@available(OSX, introduced: 10.6)
+@available(*, deprecated)
+var x = 0
+}
+
+
class C {
+// swiftlint:disable superfluous_disable_command
+// swiftlint:disable force_cast
+
+let x = bar as! Bar
+}
+
+
class C {
+@available(swift 4)
+@UserDefault("param", defaultValue: true)
+var isEnabled = true
+
+@Attribute
+func f() {}
+}
+
+
class C {
+var x: Int {
+    let a = 0
+    return a
+}
+}
+
+
a = 2
+
+
a = 2
+
+var b = 3
+
+
#warning("message")
+let a = 2
+
+
#if os(macOS)
+let a = 2
+#endif
+
+
f {
+    let a = 1
+    return a
+}
+
+
func f() {
+    #if os(macOS)
+    let a = 2
+    return a
+    #else
+    return 1
+    #endif
+}
+
+

Triggering Examples

+
class C {
+let a
+↓func x() {}
+}
+
+
class C {
+var x = 0
+↓@objc func f() {}
+}
+
+
class C {
+var x = 0
+↓@objc
+func f() {}
+}
+
+
class C {
+@objc func f() {
+}
+↓var x = 0
+}
+
+
class C {
+func f() {}
+↓@Wapper
+let isNumber = false
+@Wapper
+var isEnabled = true
+↓func g() {}
+}
+
+
class C {
+#if os(macOS)
+let a = 0
+↓func f() {}
+#endif
+}
+
+
let a = 2
+↓b = 1
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/line_length.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/line_length.html new file mode 100644 index 000000000..745a7ab26 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/line_length.html @@ -0,0 +1,432 @@ + + + + line_length Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Line Length

+ +

Lines should not span too many characters.

+ +
    +
  • Identifier: line_length
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: metrics
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +warning + +120 +
    +error + +200 +
    +ignores_urls + +false +
    +ignores_function_declarations + +false +
    +ignores_comments + +false +
    +ignores_interpolated_strings + +false +
    +excluded_lines_patterns + +[] +
  • +
+

Non Triggering Examples

+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)
+
+
#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")
+
+

Triggering Examples

+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)
+
+
#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/literal_expression_end_indentation.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/literal_expression_end_indentation.html new file mode 100644 index 000000000..e6ddf7251 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/literal_expression_end_indentation.html @@ -0,0 +1,417 @@ + + + + literal_expression_end_indentation Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Literal Expression End Indentation

+ +

Array and dictionary literal end should have the same indentation as the line that started it

+ +
    +
  • Identifier: literal_expression_end_indentation
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
[1, 2, 3]
+
+
[1,
+ 2
+]
+
+
[
+   1,
+   2
+]
+
+
[
+   1,
+   2]
+
+
   let x = [
+       1,
+       2
+   ]
+
+
[key: 2, key2: 3]
+
+
[key: 1,
+ key2: 2
+]
+
+
[
+   key: 0,
+   key2: 20
+]
+
+

Triggering Examples

+
let x = [
+   1,
+   2
+   ↓]
+
+
   let x = [
+       1,
+       2
+↓]
+
+
let x = [
+   key: value
+   ↓]
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/local_doc_comment.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/local_doc_comment.html new file mode 100644 index 000000000..e4be0b998 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/local_doc_comment.html @@ -0,0 +1,392 @@ + + + + local_doc_comment Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Local Doc Comment

+ +

Prefer regular comments over doc comments in local scopes

+ +
    +
  • Identifier: local_doc_comment
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func foo() {
+  // Local scope documentation should use normal comments.
+  print("foo")
+}
+
+
/// My great property
+var myGreatProperty: String!
+
+
/// Look here for more info: https://github.com.
+var myGreatProperty: String!
+
+
/// Look here for more info:
+/// https://github.com.
+var myGreatProperty: String!
+
+

Triggering Examples

+
func foo() {
+  ↓/// Docstring inside a function declaration
+  print("foo")
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/lower_acl_than_parent.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/lower_acl_than_parent.html new file mode 100644 index 000000000..552121ade --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/lower_acl_than_parent.html @@ -0,0 +1,444 @@ + + + + lower_acl_than_parent Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Lower ACL than Parent

+ +

Ensure declarations have a lower access control level than their enclosing parent

+ +
    +
  • Identifier: lower_acl_than_parent
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
public struct Foo { public func bar() {} }
+
+
internal struct Foo { func bar() {} }
+
+
struct Foo { func bar() {} }
+
+
struct Foo { internal func bar() {} }
+
+
open class Foo { public func bar() {} }
+
+
open class Foo { open func bar() {} }
+
+
fileprivate struct Foo { private func bar() {} }
+
+
private struct Foo { private func bar(id: String) }
+
+
extension Foo { public func bar() {} }
+
+
private struct Foo { fileprivate func bar() {} }
+
+
private func foo(id: String) {}
+
+
private class Foo { func bar() {} }
+
+
public extension Foo { struct Bar { public func baz() {} }}
+
+
public extension Foo { struct Bar { internal func baz() {} }}
+
+
internal extension Foo { struct Bar { internal func baz() {} }}
+
+
extension Foo { struct Bar { internal func baz() {} }}
+
+

Triggering Examples

+
struct Foo { ↓public func bar() {} }
+
+
enum Foo { ↓public func bar() {} }
+
+
public class Foo { ↓open func bar() }
+
+
class Foo { ↓public private(set) var bar: String? }
+
+
private struct Foo { ↓public func bar() {} }
+
+
private class Foo { ↓public func bar() {} }
+
+
private actor Foo { ↓public func bar() {} }
+
+
fileprivate struct Foo { ↓public func bar() {} }
+
+
class Foo { ↓public func bar() {} }
+
+
actor Foo { ↓public func bar() {} }
+
+
private struct Foo { ↓internal func bar() {} }
+
+
fileprivate struct Foo { ↓internal func bar() {} }
+
+
extension Foo { struct Bar { ↓public func baz() {} }}
+
+
internal extension Foo { struct Bar { ↓public func baz() {} }}
+
+
private extension Foo { struct Bar { ↓public func baz() {} }}
+
+
fileprivate extension Foo { struct Bar { ↓public func baz() {} }}
+
+
private extension Foo { struct Bar { ↓internal func baz() {} }}
+
+
fileprivate extension Foo { struct Bar { ↓internal func baz() {} }}
+
+
public extension Foo { struct Bar { struct Baz { ↓public func qux() {} }}}
+
+
final class Foo { ↓public func bar() {} }
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/mark.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/mark.html new file mode 100644 index 000000000..1af002091 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/mark.html @@ -0,0 +1,470 @@ + + + + mark Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Mark

+ +

MARK comment should be in valid format. e.g. ‘// MARK: …’ or ‘// MARK: - …’

+ +
    +
  • Identifier: mark
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
// MARK: good
+
+
// MARK: - good
+
+
// MARK: -
+
+
// MARK: - 
+
+
// BOOKMARK
+
+
//BOOKMARK
+
+
// BOOKMARKS
+
+
// MARK: This is good.
+
+
// MARK: - This is good.
+
+
// MARK: --- This is good. ---
+
+
// MARK: – This is dash separator
+
+
// Mark text
+
+
//  MarkdownText.swift
+
+
// MARK: good
+func foo() {
+    let bar = 0
+      // MARK: good
+}
+
+
/*
+func test1() {
+}
+//MARK: mark
+func test2() {
+}
+*/
+
+

Triggering Examples

+
↓//MARK: bad
+
+
↓// MARK:bad
+
+
↓//MARK:bad
+
+
↓//  MARK: bad
+
+
↓// MARK:  bad
+
+
↓// MARK: -bad
+
+
↓// MARK:- bad
+
+
↓// MARK:-bad
+
+
↓//MARK: - bad
+
+
↓//MARK:- bad
+
+
↓//MARK: -bad
+
+
↓//MARK:-bad
+
+
↓//Mark: bad
+
+
↓// Mark: bad
+
+
↓// MARK bad
+
+
↓//MARK bad
+
+
↓// MARK - bad
+
+
↓//MARK : bad
+
+
↓// MARKL:
+
+
↓// MARKR 
+
+
↓// MARKK -
+
+
↓/// MARK:
+
+
↓/// MARK bad
+
+
// MARK: good
+func foo() {
+    let bar = 0
+      ↓//MARK: bad
+}
+
+
↓//MARK:- Top-Level bad mark
+↓//MARK:- Another bad mark
+struct MarkTest {}
+↓// MARK:- Bad mark
+extension MarkTest {}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/missing_docs.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/missing_docs.html new file mode 100644 index 000000000..4ef595208 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/missing_docs.html @@ -0,0 +1,581 @@ + + + + missing_docs Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Missing Docs

+ +

Declarations should be documented.

+ +
    +
  • Identifier: missing_docs
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +warning + +[open, public] +
    +excludes_extensions + +true +
    +excludes_inherited_types + +true +
    +excludes_trivial_init + +false +
    +evaluate_effective_access_control_level + +false +
  • +
+

Non Triggering Examples

+
/// docs
+public class A {
+/// docs
+public func b() {}
+}
+// no docs
+public class B: A { override public func b() {} }
+
+
import Foundation
+// no docs
+public class B: NSObject {
+// no docs
+override public var description: String { fatalError() } }
+
+
/// docs
+public class A {
+    var j = 1
+    var i: Int { 1 }
+    func f() {}
+    deinit {}
+}
+
+
public extension A {}
+
+
enum E {
+    case A
+}
+
+
//
+// excludes_trivial_init: true
+//
+
+/// docs
+public class A {
+    public init() {}
+}
+
+
+
//
+// evaluate_effective_access_control_level: true
+//
+
+class C {
+    public func f() {}
+}
+
+
+
public struct S: ~Copyable, P {
+    public init() {}
+}
+
+

Triggering Examples

+
public ↓func a() {}
+
+
// regular comment
+public ↓func a() {}
+
+
/* regular comment */
+public ↓func a() {}
+
+
/// docs
+public protocol A {
+    // no docs
+    ↓var b: Int { get }
+}
+/// docs
+public struct C: A {
+    public let b: Int
+}
+
+
/// a doc
+public class C {
+    public static ↓let i = 1
+}
+
+
public extension A {
+    public ↓func f() {}
+    static ↓var i: Int { 1 }
+    ↓struct S {
+        func f() {}
+    }
+    ↓class C {
+        func f() {}
+    }
+    ↓actor A {
+        func f() {}
+    }
+    ↓enum E {
+        ↓case a
+        func f() {}
+    }
+}
+
+
public extension A {
+    ↓enum E {
+        enum Inner {
+            case a
+        }
+    }
+}
+
+
extension E {
+    public ↓struct S {
+        public static ↓let i = 1
+    }
+}
+
+
extension E {
+    public ↓func f() {}
+}
+
+
//
+// excludes_trivial_init: true
+//
+
+/// docs
+public class A {
+    public ↓init(argument: String) {}
+}
+
+
+
//
+// excludes_inherited_types: false
+//
+
+public ↓struct C: A {
+    public ↓let b: Int
+}
+
+
+
//
+// excludes_extensions: false
+//
+
+public ↓extension A {
+    public ↓func f() {}
+}
+
+
+
public extension E {
+    ↓var i: Int {
+        let j = 1
+        func f() {}
+        return j
+    }
+}
+
+
#if os(macOS)
+public ↓func f() {}
+#endif
+
+
public ↓enum E {
+    ↓case A, B
+    func f() {}
+    init(_ i: Int) { self = .A }
+}
+
+
/// a doc
+public struct S {}
+public extension S {
+    ↓enum E {
+        ↓case A
+    }
+}
+
+
//
+// evaluate_effective_access_control_level: false
+//
+
+class C {
+    public ↓func f() {}
+}
+
+
+
public ↓struct S: ~Copyable, ~Escapable {
+    public ↓init() {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/modifier_order.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/modifier_order.html new file mode 100644 index 000000000..af9a56594 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/modifier_order.html @@ -0,0 +1,567 @@ + + + + modifier_order Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Modifier Order

+ +

Modifier order should be consistent.

+ +
    +
  • Identifier: modifier_order
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +preferred_modifier_order + +[override, acl, setterACL, dynamic, mutators, lazy, final, required, convenience, typeMethods, owned] +
  • +
+

Non Triggering Examples

+
public class Foo {
+   public required convenience init() {}
+}
+
+
public class Foo {
+   public static let bar = 42
+}
+
+
public class Foo {
+   public static var bar: Int {
+       return
+   }
+}
+
+
public class Foo {
+   public class var bar: Int {
+       return 42
+   }
+}
+
+
public class Bar {
+   public class var foo: String {
+       return "foo"
+   }
+}
+public class Foo: Bar {
+   override public final class var foo: String {
+       return "bar"
+   }
+}
+
+
open class Bar {
+   public var foo: Int? {
+       return 42
+   }
+}
+open class Foo: Bar {
+   override public var foo: Int? {
+       return 43
+   }
+}
+
+
open class Bar {
+   open class func foo() -> Int {
+       return 42
+   }
+}
+class Foo: Bar {
+   override open class func foo() -> Int {
+       return 43
+   }
+}
+
+
protocol Foo: class {}
+class Bar {
+    public private(set) weak var foo: Foo?
+}
+
+
@objc
+public final class Foo: NSObject {}
+
+
@objcMembers
+public final class Foo: NSObject {}
+
+
@objc
+override public private(set) weak var foo: Bar?
+
+
@objc
+public final class Foo: NSObject {}
+
+
@objc
+open final class Foo: NSObject {
+   open weak var weakBar: NSString? = nil
+}
+
+
public final class Foo {}
+
+
class Bar {
+   func bar() {}
+}
+
+
internal class Foo: Bar {
+   override internal func bar() {}
+}
+
+
public struct Foo {
+   internal weak var weakBar: NSObject? = nil
+}
+
+
class Foo {
+   internal lazy var bar: String = "foo"
+}
+
+

Triggering Examples

+
class Foo {
+   convenience required public init() {}
+}
+
+
public class Foo {
+   static public let bar = 42
+}
+
+
public class Foo {
+   static public var bar: Int {
+       return 42
+   }
+}
+
+
public class Foo {
+   class public var bar: Int {
+       return 42
+   }
+}
+
+
public class RootFoo {
+   class public var foo: String {
+       return "foo"
+   }
+}
+public class Foo: RootFoo {
+   override final class public var foo: String
+       return "bar"
+   }
+}
+
+
open class Bar {
+   public var foo: Int? {
+       return 42
+   }
+}
+open class Foo: Bar {
+    public override var foo: Int? {
+       return 43
+   }
+}
+
+
protocol Foo: class {}
+    class Bar {
+        private(set) public weak var foo: Foo?
+}
+
+
open class Bar {
+   open class func foo() -> Int {
+       return 42
+   }
+}
+class Foo: Bar {
+   class open override func foo() -> Int {
+       return 43
+   }
+}
+
+
open class Bar {
+   open class func foo() -> Int {
+       return 42
+   }
+}
+class Foo: Bar {
+   open override class func foo() -> Int {
+       return 43
+   }
+}
+
+
@objc
+final public class Foo: NSObject {}
+
+
@objcMembers
+final public class Foo: NSObject {}
+
+
@objc
+final open class Foo: NSObject {
+   weak open var weakBar: NSString? = nil
+}
+
+
final public class Foo {}
+
+
internal class Foo: Bar {
+   internal override func bar() {}
+}
+
+
public struct Foo {
+   weak internal var weakBar: NSObjetc? = nil
+}
+
+
class Foo {
+   lazy internal var bar: String = "foo"
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/multiline_arguments.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/multiline_arguments.html new file mode 100644 index 000000000..727a2675b --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/multiline_arguments.html @@ -0,0 +1,473 @@ + + + + multiline_arguments Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Multiline Arguments

+ +

Arguments should be either on the same line, or one per line

+ +
    +
  • Identifier: multiline_arguments
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +first_argument_location + +any_line +
    +only_enforce_after_first_closure_on_first_line + +false +
  • +
+

Non Triggering Examples

+
foo()
+
+
foo(
+)
+
+
foo { }
+
+
foo {
+
+}
+
+
foo(0)
+
+
foo(0, 1)
+
+
foo(0, 1) { }
+
+
foo(0, param1: 1)
+
+
foo(0, param1: 1) { }
+
+
foo(param1: 1)
+
+
foo(param1: 1) { }
+
+
foo(param1: 1, param2: true) { }
+
+
foo(param1: 1, param2: true, param3: [3]) { }
+
+
foo(param1: 1, param2: true, param3: [3]) {
+    bar()
+}
+
+
foo(param1: 1,
+    param2: true,
+    param3: [3])
+
+
foo(
+    param1: 1, param2: true, param3: [3]
+)
+
+
foo(
+    param1: 1,
+    param2: true,
+    param3: [3]
+)
+
+
Picker(selection: viewStore.binding(\.$someProperty)) {
+   ForEach(SomeEnum.allCases, id: \.rawValue) { someCase in
+      Text(someCase.rawValue)
+         .tag(someCase)
+   }
+} label: {
+   EmptyView()
+}
+
+
UIView.animate(withDuration: 1,
+               delay: 0) {
+    // sample
+    print("a")
+} completion: { _ in
+    // sample
+    print("b")
+}
+
+
UIView.animate(withDuration: 1, delay: 0) {
+    print("a")
+} completion: { _ in
+    print("b")
+}
+
+

Triggering Examples

+
foo(0,
+    param1: 1, ↓param2: true, ↓param3: [3])
+
+
foo(0, ↓param1: 1,
+    param2: true, ↓param3: [3])
+
+
foo(0, ↓param1: 1, ↓param2: true,
+    param3: [3])
+
+
foo(
+    0, ↓param1: 1,
+    param2: true, ↓param3: [3]
+)
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/multiline_arguments_brackets.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/multiline_arguments_brackets.html new file mode 100644 index 000000000..18152081c --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/multiline_arguments_brackets.html @@ -0,0 +1,480 @@ + + + + multiline_arguments_brackets Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Multiline Arguments Brackets

+ +

Multiline arguments should have their surrounding brackets in a new line

+ +
    +
  • Identifier: multiline_arguments_brackets
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
foo(param1: "Param1", param2: "Param2", param3: "Param3")
+
+
foo(
+    param1: "Param1", param2: "Param2", param3: "Param3"
+)
+
+
func foo(
+    param1: "Param1",
+    param2: "Param2",
+    param3: "Param3"
+)
+
+
foo { param1, param2 in
+    print("hello world")
+}
+
+
foo(
+    bar(
+        x: 5,
+        y: 7
+    )
+)
+
+
AlertViewModel.AlertAction(title: "some title", style: .default) {
+    AlertManager.shared.presentNextDebugAlert()
+}
+
+
public final class Logger {
+    public static let shared = Logger(outputs: [
+        OSLoggerOutput(),
+        ErrorLoggerOutput()
+    ])
+}
+
+
let errors = try self.download([
+    (description: description, priority: priority),
+])
+
+
return SignalProducer({ observer, _ in
+    observer.sendCompleted()
+}).onMainQueue()
+
+
SomeType(a: [
+    1, 2, 3
+], b: [1, 2])
+
+
SomeType(
+  a: 1
+) { print("completion") }
+
+
SomeType(
+  a: 1
+) {
+  print("completion")
+}
+
+
SomeType(
+  a: .init() { print("completion") }
+)
+
+
SomeType(
+  a: .init() {
+    print("completion")
+  }
+)
+
+
SomeType(
+  a: 1
+) {} onError: {}
+
+

Triggering Examples

+
foo(↓param1: "Param1", param2: "Param2",
+         param3: "Param3"
+)
+
+
foo(
+    param1: "Param1",
+    param2: "Param2",
+    param3: "Param3"↓)
+
+
foo(↓param1: "Param1",
+    param2: "Param2",
+    param3: "Param3"↓)
+
+
foo(↓bar(
+    x: 5,
+    y: 7
+)
+)
+
+
foo(
+    bar(
+        x: 5,
+        y: 7
+)↓)
+
+
SomeOtherType(↓a: [
+        1, 2, 3
+    ],
+    b: "two"↓)
+
+
SomeOtherType(
+  a: 1↓) {}
+
+
SomeOtherType(
+  a: 1↓) {
+  print("completion")
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/multiline_function_chains.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/multiline_function_chains.html new file mode 100644 index 000000000..7d61faf26 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/multiline_function_chains.html @@ -0,0 +1,439 @@ + + + + multiline_function_chains Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Multiline Function Chains

+ +

Chained function calls should be either on the same line, or one per line

+ +
    +
  • Identifier: multiline_function_chains
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let evenSquaresSum = [20, 17, 35, 4].filter { $0 % 2 == 0 }.map { $0 * $0 }.reduce(0, +)
+
+
let evenSquaresSum = [20, 17, 35, 4]
+    .filter { $0 % 2 == 0 }.map { $0 * $0 }.reduce(0, +)",
+
+
let chain = a
+    .b(1, 2, 3)
+    .c { blah in
+        print(blah)
+    }
+    .d()
+
+
let chain = a.b(1, 2, 3)
+    .c { blah in
+        print(blah)
+    }
+    .d()
+
+
let chain = a.b(1, 2, 3)
+    .c { blah in print(blah) }
+    .d()
+
+
let chain = a.b(1, 2, 3)
+    .c(.init(
+        a: 1,
+        b, 2,
+        c, 3))
+    .d()
+
+
self.viewModel.outputs.postContextualNotification
+  .observeForUI()
+  .observeValues {
+    NotificationCenter.default.post(
+      Notification(
+        name: .ksr_showNotificationsDialog,
+        userInfo: [UserInfoKeys.context: PushNotificationDialog.Context.pledge,
+                   UserInfoKeys.viewController: self]
+     )
+    )
+  }
+
+
let remainingIDs = Array(Set(self.currentIDs).subtracting(Set(response.ids)))
+
+
self.happeningNewsletterOn = self.updateCurrentUser
+    .map { $0.newsletters.happening }.skipNil().skipRepeats()
+
+

Triggering Examples

+
let evenSquaresSum = [20, 17, 35, 4]
+    .filter { $0 % 2 == 0 }↓.map { $0 * $0 }
+    .reduce(0, +)
+
+
let evenSquaresSum = a.b(1, 2, 3)
+    .c { blah in
+        print(blah)
+    }↓.d()
+
+
let evenSquaresSum = a.b(1, 2, 3)
+    .c(2, 3, 4)↓.d()
+
+
let evenSquaresSum = a.b(1, 2, 3)↓.c { blah in
+        print(blah)
+    }
+    .d()
+
+
a.b {
+//  ““
+}↓.e()
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/multiline_literal_brackets.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/multiline_literal_brackets.html new file mode 100644 index 000000000..cfef25a0b --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/multiline_literal_brackets.html @@ -0,0 +1,454 @@ + + + + multiline_literal_brackets Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Multiline Literal Brackets

+ +

Multiline literals should have their surrounding brackets in a new line

+ +
    +
  • Identifier: multiline_literal_brackets
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let trio = ["harry", "ronald", "hermione"]
+let houseCup = ["gryffindor": 460, "hufflepuff": 370, "ravenclaw": 410, "slytherin": 450]
+
+
let trio = [
+    "harry",
+    "ronald",
+    "hermione"
+]
+let houseCup = [
+    "gryffindor": 460,
+    "hufflepuff": 370,
+    "ravenclaw": 410,
+    "slytherin": 450
+]
+
+
let trio = [
+    "harry", "ronald", "hermione"
+]
+let houseCup = [
+    "gryffindor": 460, "hufflepuff": 370,
+    "ravenclaw": 410, "slytherin": 450
+]
+
+
_ = [
+    1,
+    2,
+    3,
+    4,
+    5, 6,
+    7, 8, 9
+]
+
+

Triggering Examples

+
let trio = [↓"harry",
+            "ronald",
+            "hermione"
+]
+
+
let houseCup = [↓"gryffindor": 460, "hufflepuff": 370,
+                "ravenclaw": 410, "slytherin": 450
+]
+
+
let houseCup = [↓"gryffindor": 460,
+                "hufflepuff": 370,
+                "ravenclaw": 410,
+                "slytherin": 450↓]
+
+
let trio = [
+    "harry",
+    "ronald",
+    "hermione"↓]
+
+
let houseCup = [
+    "gryffindor": 460, "hufflepuff": 370,
+    "ravenclaw": 410, "slytherin": 450↓]
+
+
class Hogwarts {
+    let houseCup = [
+        "gryffindor": 460, "hufflepuff": 370,
+        "ravenclaw": 410, "slytherin": 450↓]
+}
+
+
_ = [
+    1,
+    2,
+    3,
+    4,
+    5, 6,
+    7, 8, 9↓]
+
+
_ = [↓1, 2, 3,
+     4, 5, 6,
+     7, 8, 9
+]
+
+
class Hogwarts {
+    let houseCup = [
+        "gryffindor": 460, "hufflepuff": 370,
+        "ravenclaw": 410, "slytherin": slytherinPoints.filter {
+            $0.isValid
+        }.sum()↓]
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/multiline_parameters.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/multiline_parameters.html new file mode 100644 index 000000000..e92bd7b41 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/multiline_parameters.html @@ -0,0 +1,804 @@ + + + + multiline_parameters Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Multiline Parameters

+ +

Functions and methods parameters should be either on the same line, or one per line

+ +
    +
  • Identifier: multiline_parameters
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +allows_single_line + +true +
  • +
+

Non Triggering Examples

+
func foo() { }
+
+
func foo(param1: Int) { }
+
+
func foo(param1: Int, param2: Bool) { }
+
+
func foo(param1: Int, param2: Bool, param3: [String]) { }
+
+
func foo(param1: Int,
+         param2: Bool,
+         param3: [String]) { }
+
+
func foo(_ param1: Int, param2: Int, param3: Int) -> (Int) -> Int {
+   return { x in x + param1 + param2 + param3 }
+}
+
+
static func foo() { }
+
+
static func foo(param1: Int) { }
+
+
static func foo(param1: Int, param2: Bool) { }
+
+
static func foo(param1: Int, param2: Bool, param3: [String]) { }
+
+
static func foo(param1: Int,
+                param2: Bool,
+                param3: [String]) { }
+
+
protocol Foo {
+    func foo() { }
+}
+
+
protocol Foo {
+    func foo(param1: Int) { }
+}
+
+
protocol Foo {
+    func foo(param1: Int, param2: Bool) { }
+}
+
+
protocol Foo {
+    func foo(param1: Int, param2: Bool, param3: [String]) { }
+}
+
+
protocol Foo {
+   func foo(param1: Int,
+            param2: Bool,
+            param3: [String]) { }
+}
+
+
protocol Foo {
+    static func foo(param1: Int, param2: Bool, param3: [String]) { }
+}
+
+
protocol Foo {
+   static func foo(param1: Int,
+                   param2: Bool,
+                   param3: [String]) { }
+}
+
+
protocol Foo {
+    class func foo(param1: Int, param2: Bool, param3: [String]) { }
+}
+
+
protocol Foo {
+   class func foo(param1: Int,
+                  param2: Bool,
+                  param3: [String]) { }
+}
+
+
enum Foo {
+    func foo() { }
+}
+
+
enum Foo {
+    func foo(param1: Int) { }
+}
+
+
enum Foo {
+    func foo(param1: Int, param2: Bool) { }
+}
+
+
enum Foo {
+    func foo(param1: Int, param2: Bool, param3: [String]) { }
+}
+
+
enum Foo {
+   func foo(param1: Int,
+            param2: Bool,
+            param3: [String]) { }
+}
+
+
enum Foo {
+    static func foo(param1: Int, param2: Bool, param3: [String]) { }
+}
+
+
enum Foo {
+   static func foo(param1: Int,
+                   param2: Bool,
+                   param3: [String]) { }
+}
+
+
struct Foo {
+    func foo() { }
+}
+
+
struct Foo {
+    func foo(param1: Int) { }
+}
+
+
struct Foo {
+    func foo(param1: Int, param2: Bool) { }
+}
+
+
struct Foo {
+    func foo(param1: Int, param2: Bool, param3: [String]) { }
+}
+
+
struct Foo {
+   func foo(param1: Int,
+            param2: Bool,
+            param3: [String]) { }
+}
+
+
struct Foo {
+    static func foo(param1: Int, param2: Bool, param3: [String]) { }
+}
+
+
struct Foo {
+   static func foo(param1: Int,
+                   param2: Bool,
+                   param3: [String]) { }
+}
+
+
class Foo {
+    func foo() { }
+}
+
+
class Foo {
+    func foo(param1: Int) { }
+}
+
+
class Foo {
+    func foo(param1: Int, param2: Bool) { }
+}
+
+
class Foo {
+    func foo(param1: Int, param2: Bool, param3: [String]) { }
+    }
+
+
class Foo {
+   func foo(param1: Int,
+            param2: Bool,
+            param3: [String]) { }
+}
+
+
class Foo {
+    class func foo(param1: Int, param2: Bool, param3: [String]) { }
+}
+
+
class Foo {
+   class func foo(param1: Int,
+                  param2: Bool,
+                  param3: [String]) { }
+}
+
+
class Foo {
+   class func foo(param1: Int,
+                  param2: Bool,
+                  param3: @escaping (Int, Int) -> Void = { _, _ in }) { }
+}
+
+
class Foo {
+   class func foo(param1: Int,
+                  param2: Bool,
+                  param3: @escaping (Int) -> Void = { _ in }) { }
+}
+
+
class Foo {
+   class func foo(param1: Int,
+                  param2: Bool,
+                  param3: @escaping ((Int) -> Void)? = nil) { }
+}
+
+
class Foo {
+   class func foo(param1: Int,
+                  param2: Bool,
+                  param3: @escaping ((Int) -> Void)? = { _ in }) { }
+}
+
+
class Foo {
+   class func foo(param1: Int,
+                  param2: @escaping ((Int) -> Void)? = { _ in },
+                  param3: Bool) { }
+}
+
+
class Foo {
+   class func foo(param1: Int,
+                  param2: @escaping ((Int) -> Void)? = { _ in },
+                  param3: @escaping (Int, Int) -> Void = { _, _ in }) { }
+}
+
+
class Foo {
+   class func foo(param1: Int,
+                  param2: Bool,
+                  param3: @escaping (Int) -> Void = { (x: Int) in }) { }
+}
+
+
class Foo {
+   class func foo(param1: Int,
+                  param2: Bool,
+                  param3: @escaping (Int, (Int) -> Void) -> Void = { (x: Int, f: (Int) -> Void) in }) { }
+}
+
+
class Foo {
+   init(param1: Int,
+        param2: Bool,
+        param3: @escaping ((Int) -> Void)? = { _ in }) { }
+}
+
+
//
+// allows_single_line: false
+//
+
+func foo() { }
+
+
+
//
+// allows_single_line: false
+//
+
+func foo(param1: Int) { }
+
+
+
//
+// allows_single_line: false
+//
+
+protocol Foo {
+    func foo(param1: Int,
+             param2: Bool,
+             param3: [String]) { }
+}
+
+
+
//
+// allows_single_line: false
+//
+
+protocol Foo {
+    func foo(
+        param1: Int
+    ) { }
+}
+
+
+
//
+// allows_single_line: false
+//
+
+protocol Foo {
+    func foo(
+        param1: Int,
+        param2: Bool,
+        param3: [String]
+    ) { }
+}
+
+
+
//
+// max_number_of_single_line_parameters: 3
+//
+
+func foo(param1: Int, param2: Bool, param3: [String]) { }
+
+
+
//
+// max_number_of_single_line_parameters: 3
+//
+
+func foo(param1: Int,
+         param2: Bool,
+         param3: [String]) { }
+
+
+

Triggering Examples

+
func ↓foo(_ param1: Int,
+          param2: Int, param3: Int) -> (Int) -> Int {
+   return { x in x + param1 + param2 + param3 }
+}
+
+
protocol Foo {
+   func ↓foo(param1: Int,
+             param2: Bool, param3: [String]) { }
+}
+
+
protocol Foo {
+   func ↓foo(param1: Int, param2: Bool,
+             param3: [String]) { }
+}
+
+
protocol Foo {
+   static func ↓foo(param1: Int,
+                    param2: Bool, param3: [String]) { }
+}
+
+
protocol Foo {
+   static func ↓foo(param1: Int, param2: Bool,
+                    param3: [String]) { }
+}
+
+
protocol Foo {
+   class func ↓foo(param1: Int,
+                   param2: Bool, param3: [String]) { }
+}
+
+
protocol Foo {
+   class func ↓foo(param1: Int, param2: Bool,
+                   param3: [String]) { }
+}
+
+
enum Foo {
+   func ↓foo(param1: Int,
+             param2: Bool, param3: [String]) { }
+}
+
+
enum Foo {
+   func ↓foo(param1: Int, param2: Bool,
+             param3: [String]) { }
+}
+
+
enum Foo {
+   static func ↓foo(param1: Int,
+                    param2: Bool, param3: [String]) { }
+}
+
+
enum Foo {
+   static func ↓foo(param1: Int, param2: Bool,
+                    param3: [String]) { }
+}
+
+
struct Foo {
+   func ↓foo(param1: Int,
+             param2: Bool, param3: [String]) { }
+}
+
+
struct Foo {
+   func ↓foo(param1: Int, param2: Bool,
+             param3: [String]) { }
+}
+
+
struct Foo {
+   static func ↓foo(param1: Int,
+                    param2: Bool, param3: [String]) { }
+}
+
+
struct Foo {
+   static func ↓foo(param1: Int, param2: Bool,
+                    param3: [String]) { }
+}
+
+
class Foo {
+   func ↓foo(param1: Int,
+             param2: Bool, param3: [String]) { }
+}
+
+
class Foo {
+   func ↓foo(param1: Int, param2: Bool,
+             param3: [String]) { }
+}
+
+
class Foo {
+   class func ↓foo(param1: Int,
+                   param2: Bool, param3: [String]) { }
+}
+
+
class Foo {
+   class func ↓foo(param1: Int, param2: Bool,
+                   param3: [String]) { }
+}
+
+
class Foo {
+   class func ↓foo(param1: Int,
+                  param2: Bool, param3: @escaping (Int, Int) -> Void = { _, _ in }) { }
+}
+
+
class Foo {
+   class func ↓foo(param1: Int,
+                  param2: Bool, param3: @escaping (Int) -> Void = { (x: Int) in }) { }
+}
+
+
class Foo {
+  ↓init(param1: Int, param2: Bool,
+        param3: @escaping ((Int) -> Void)? = { _ in }) { }
+}
+
+
//
+// allows_single_line: false
+//
+
+func ↓foo(param1: Int, param2: Bool) { }
+
+
+
//
+// allows_single_line: false
+//
+
+func ↓foo(param1: Int, param2: Bool, param3: [String]) { }
+
+
+
//
+// max_number_of_single_line_parameters: 2
+//
+
+func ↓foo(param1: Int, param2: Bool, param3: [String]) { }
+
+
+
//
+// max_number_of_single_line_parameters: 3
+//
+
+func ↓foo(param1: Int,
+          param2: Bool, param3: [String]) { }
+
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/multiline_parameters_brackets.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/multiline_parameters_brackets.html new file mode 100644 index 000000000..c24d978ec --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/multiline_parameters_brackets.html @@ -0,0 +1,434 @@ + + + + multiline_parameters_brackets Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Multiline Parameters Brackets

+ +

Multiline parameters should have their surrounding brackets in a new line

+ +
    +
  • Identifier: multiline_parameters_brackets
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func foo(param1: String, param2: String, param3: String)
+
+
func foo(
+    param1: String, param2: String, param3: String
+)
+
+
func foo(
+    param1: String,
+    param2: String,
+    param3: String
+)
+
+
class SomeType {
+    func foo(param1: String, param2: String, param3: String)
+}
+
+
class SomeType {
+    func foo(
+        param1: String, param2: String, param3: String
+    )
+}
+
+
class SomeType {
+    func foo(
+        param1: String,
+        param2: String,
+        param3: String
+    )
+}
+
+
func foo<T>(param1: T, param2: String, param3: String) -> T { /* some code */ }
+
+
    func foo(a: [Int] = [
+        1
+    ])
+
+

Triggering Examples

+
func foo(↓param1: String, param2: String,
+         param3: String
+)
+
+
func foo(
+    param1: String,
+    param2: String,
+    param3: String↓)
+
+
class SomeType {
+    func foo(↓param1: String, param2: String,
+             param3: String
+    )
+}
+
+
class SomeType {
+    func foo(
+        param1: String,
+        param2: String,
+        param3: String↓)
+}
+
+
func foo<T>(↓param1: T, param2: String,
+         param3: String
+) -> T
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/multiple_closures_with_trailing_closure.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/multiple_closures_with_trailing_closure.html new file mode 100644 index 000000000..099132987 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/multiple_closures_with_trailing_closure.html @@ -0,0 +1,402 @@ + + + + multiple_closures_with_trailing_closure Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Multiple Closures with Trailing Closure

+ +

Trailing closure syntax should not be used when passing more than one closure argument

+ +
    +
  • Identifier: multiple_closures_with_trailing_closure
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
foo.map { $0 + 1 }
+
+
foo.reduce(0) { $0 + $1 }
+
+
if let foo = bar.map({ $0 + 1 }) {
+
+}
+
+
foo.something(param1: { $0 }, param2: { $0 + 1 })
+
+
UIView.animate(withDuration: 1.0) {
+    someView.alpha = 0.0
+}
+
+
foo.method { print(0) } arg2: { print(1) }
+
+
foo.methodWithParenArgs((0, 1), arg2: (0, 1, 2)) { $0 } arg4: { $0 }
+
+

Triggering Examples

+
foo.something(param1: { $0 }) ↓{ $0 + 1 }
+
+
UIView.animate(withDuration: 1.0, animations: {
+    someView.alpha = 0.0
+}) ↓{ _ in
+    someView.removeFromSuperview()
+}
+
+
foo.multipleTrailing(arg1: { $0 }) { $0 } arg3: { $0 }
+
+
foo.methodWithParenArgs(param1: { $0 }, param2: (0, 1), (0, 1)) { $0 }
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/nesting.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/nesting.html new file mode 100644 index 000000000..9e95d371e --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/nesting.html @@ -0,0 +1,1566 @@ + + + + nesting Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Nesting

+ +

Types should be nested at most 1 level deep, and functions should be nested at most 2 levels deep.

+ +
    +
  • Identifier: nesting
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: metrics
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +type_level + + + + + + + + + + + +
    KeyValue
    +warning + +1 +
    +
    +function_level + + + + + + + + + + + +
    KeyValue
    +warning + +2 +
    +
    +check_nesting_in_closures_and_statements + +true +
    +always_allow_one_type_in_functions + +false +
    +ignore_typealiases_and_associatedtypes + +false +
  • +
+

Non Triggering Examples

+
actor Example_0 {
+    actor Example_1 {}
+}
+
+
var example: Int {
+    actor Example_0 {
+        actor Example_1 {}
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        actor Example_0 {
+            actor Example_1 {}
+        }
+    }
+}
+
+
extension Example_0 {
+    actor Example_1 {}
+}
+
+
class Example_0 {
+    class Example_1 {}
+}
+
+
var example: Int {
+    class Example_0 {
+        class Example_1 {}
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        class Example_0 {
+            class Example_1 {}
+        }
+    }
+}
+
+
extension Example_0 {
+    class Example_1 {}
+}
+
+
struct Example_0 {
+    struct Example_1 {}
+}
+
+
var example: Int {
+    struct Example_0 {
+        struct Example_1 {}
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        struct Example_0 {
+            struct Example_1 {}
+        }
+    }
+}
+
+
extension Example_0 {
+    struct Example_1 {}
+}
+
+
enum Example_0 {
+    enum Example_1 {}
+}
+
+
var example: Int {
+    enum Example_0 {
+        enum Example_1 {}
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        enum Example_0 {
+            enum Example_1 {}
+        }
+    }
+}
+
+
extension Example_0 {
+    enum Example_1 {}
+}
+
+
func f_0() {
+    func f_1() {
+        func f_2() {}
+    }
+}
+
+
var example: Int {
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        func f_0() {
+            func f_1() {
+                func f_2() {}
+            }
+        }
+    }
+}
+
+
extension Example_0 {
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+}
+
+
switch example {
+case .exampleCase:
+    actor Example_0 {
+        actor Example_1 {}
+    }
+default:
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+}
+
+
var exampleClosure: () -> Void = {
+    actor Example_0 {
+        actor Example_1 {}
+    }
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+}
+
+
exampleFunc(closure: {
+    actor Example_0 {
+        actor Example_1 {}
+    }
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+})
+
+
switch example {
+case .exampleCase:
+    class Example_0 {
+        class Example_1 {}
+    }
+default:
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+}
+
+
var exampleClosure: () -> Void = {
+    class Example_0 {
+        class Example_1 {}
+    }
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+}
+
+
exampleFunc(closure: {
+    class Example_0 {
+        class Example_1 {}
+    }
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+})
+
+
switch example {
+case .exampleCase:
+    struct Example_0 {
+        struct Example_1 {}
+    }
+default:
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+}
+
+
var exampleClosure: () -> Void = {
+    struct Example_0 {
+        struct Example_1 {}
+    }
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+}
+
+
exampleFunc(closure: {
+    struct Example_0 {
+        struct Example_1 {}
+    }
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+})
+
+
switch example {
+case .exampleCase:
+    enum Example_0 {
+        enum Example_1 {}
+    }
+default:
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+}
+
+
var exampleClosure: () -> Void = {
+    enum Example_0 {
+        enum Example_1 {}
+    }
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+}
+
+
exampleFunc(closure: {
+    enum Example_0 {
+        enum Example_1 {}
+    }
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+})
+
+
actor Example_0 {
+    protocol Example_1 {}
+}
+
+
var example: Int {
+    actor Example_0 {
+        protocol Example_1 {}
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        actor Example_0 {
+            protocol Example_1 {}
+        }
+    }
+}
+
+
extension Example_0 {
+    protocol Example_1 {}
+}
+
+
class Example_0 {
+    protocol Example_1 {}
+}
+
+
var example: Int {
+    class Example_0 {
+        protocol Example_1 {}
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        class Example_0 {
+            protocol Example_1 {}
+        }
+    }
+}
+
+
extension Example_0 {
+    protocol Example_1 {}
+}
+
+
struct Example_0 {
+    protocol Example_1 {}
+}
+
+
var example: Int {
+    struct Example_0 {
+        protocol Example_1 {}
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        struct Example_0 {
+            protocol Example_1 {}
+        }
+    }
+}
+
+
extension Example_0 {
+    protocol Example_1 {}
+}
+
+
enum Example_0 {
+    protocol Example_1 {}
+}
+
+
var example: Int {
+    enum Example_0 {
+        protocol Example_1 {}
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        enum Example_0 {
+            protocol Example_1 {}
+        }
+    }
+}
+
+
extension Example_0 {
+    protocol Example_1 {}
+}
+
+
actor Example_0 {
+    func f_0() {
+        actor Example_1 {
+            func f_1() {
+                func f_2() {}
+            }
+        }
+        protocol P {}
+    }
+}
+
+
actor Example_0 {
+    func f_0() {
+        switch example {
+        case .exampleCase:
+            actor Example_1 {
+                func f_1() {
+                    func f_2() {}
+                }
+            }
+            protocol P {}
+        default:
+            exampleFunc(closure: {
+                actor Example_1 {
+                    func f_1() {
+                        func f_2() {}
+                    }
+                }
+                protocol P {}
+            })
+        }
+    }
+}
+
+
class Example_0 {
+    func f_0() {
+        class Example_1 {
+            func f_1() {
+                func f_2() {}
+            }
+        }
+        protocol P {}
+    }
+}
+
+
class Example_0 {
+    func f_0() {
+        switch example {
+        case .exampleCase:
+            class Example_1 {
+                func f_1() {
+                    func f_2() {}
+                }
+            }
+            protocol P {}
+        default:
+            exampleFunc(closure: {
+                class Example_1 {
+                    func f_1() {
+                        func f_2() {}
+                    }
+                }
+                protocol P {}
+            })
+        }
+    }
+}
+
+
struct Example_0 {
+    func f_0() {
+        struct Example_1 {
+            func f_1() {
+                func f_2() {}
+            }
+        }
+        protocol P {}
+    }
+}
+
+
struct Example_0 {
+    func f_0() {
+        switch example {
+        case .exampleCase:
+            struct Example_1 {
+                func f_1() {
+                    func f_2() {}
+                }
+            }
+            protocol P {}
+        default:
+            exampleFunc(closure: {
+                struct Example_1 {
+                    func f_1() {
+                        func f_2() {}
+                    }
+                }
+                protocol P {}
+            })
+        }
+    }
+}
+
+
enum Example_0 {
+    func f_0() {
+        enum Example_1 {
+            func f_1() {
+                func f_2() {}
+            }
+        }
+        protocol P {}
+    }
+}
+
+
enum Example_0 {
+    func f_0() {
+        switch example {
+        case .exampleCase:
+            enum Example_1 {
+                func f_1() {
+                    func f_2() {}
+                }
+            }
+            protocol P {}
+        default:
+            exampleFunc(closure: {
+                enum Example_1 {
+                    func f_1() {
+                        func f_2() {}
+                    }
+                }
+                protocol P {}
+            })
+        }
+    }
+}
+
+

Triggering Examples

+
actor Example_0 {
+    actor Example_1 {
+        ↓actor Example_2 {}
+    }
+}
+
+
var example: Int {
+    actor Example_0 {
+        actor Example_1 {
+            ↓actor Example_2 {}
+        }
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        actor Example_0 {
+            actor Example_1 {
+                ↓actor Example_2 {}
+            }
+        }
+    }
+}
+
+
extension Example_0 {
+    actor Example_1 {
+        ↓actor Example_2 {}
+    }
+}
+
+
class Example_0 {
+    class Example_1 {
+        ↓class Example_2 {}
+    }
+}
+
+
var example: Int {
+    class Example_0 {
+        class Example_1 {
+            ↓class Example_2 {}
+        }
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        class Example_0 {
+            class Example_1 {
+                ↓class Example_2 {}
+            }
+        }
+    }
+}
+
+
extension Example_0 {
+    class Example_1 {
+        ↓class Example_2 {}
+    }
+}
+
+
struct Example_0 {
+    struct Example_1 {
+        ↓struct Example_2 {}
+    }
+}
+
+
var example: Int {
+    struct Example_0 {
+        struct Example_1 {
+            ↓struct Example_2 {}
+        }
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        struct Example_0 {
+            struct Example_1 {
+                ↓struct Example_2 {}
+            }
+        }
+    }
+}
+
+
extension Example_0 {
+    struct Example_1 {
+        ↓struct Example_2 {}
+    }
+}
+
+
enum Example_0 {
+    enum Example_1 {
+        ↓enum Example_2 {}
+    }
+}
+
+
var example: Int {
+    enum Example_0 {
+        enum Example_1 {
+            ↓enum Example_2 {}
+        }
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        enum Example_0 {
+            enum Example_1 {
+                ↓enum Example_2 {}
+            }
+        }
+    }
+}
+
+
extension Example_0 {
+    enum Example_1 {
+        ↓enum Example_2 {}
+    }
+}
+
+
func f_0() {
+    func f_1() {
+        func f_2() {
+            ↓func f_3() {}
+        }
+    }
+}
+
+
var example: Int {
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        func f_0() {
+            func f_1() {
+                func f_2() {
+                    ↓func f_3() {}
+                }
+            }
+        }
+    }
+}
+
+
extension Example_0 {
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+}
+
+
switch example {
+case .exampleCase:
+    actor Example_0 {
+        actor Example_1 {
+            ↓actor Example_2 {}
+        }
+    }
+default:
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+}
+
+
var exampleClosure: () -> Void = {
+    actor Example_0 {
+        actor Example_1 {
+            ↓actor Example_2 {}
+        }
+        }
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+}
+
+
exampleFunc(closure: {
+    actor Example_0 {
+        actor Example_1 {}
+    }
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+})
+
+
switch example {
+case .exampleCase:
+    class Example_0 {
+        class Example_1 {
+            ↓class Example_2 {}
+        }
+    }
+default:
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+}
+
+
var exampleClosure: () -> Void = {
+    class Example_0 {
+        class Example_1 {
+            ↓class Example_2 {}
+        }
+        }
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+}
+
+
exampleFunc(closure: {
+    class Example_0 {
+        class Example_1 {}
+    }
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+})
+
+
switch example {
+case .exampleCase:
+    struct Example_0 {
+        struct Example_1 {
+            ↓struct Example_2 {}
+        }
+    }
+default:
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+}
+
+
var exampleClosure: () -> Void = {
+    struct Example_0 {
+        struct Example_1 {
+            ↓struct Example_2 {}
+        }
+        }
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+}
+
+
exampleFunc(closure: {
+    struct Example_0 {
+        struct Example_1 {}
+    }
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+})
+
+
switch example {
+case .exampleCase:
+    enum Example_0 {
+        enum Example_1 {
+            ↓enum Example_2 {}
+        }
+    }
+default:
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+}
+
+
var exampleClosure: () -> Void = {
+    enum Example_0 {
+        enum Example_1 {
+            ↓enum Example_2 {}
+        }
+        }
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+}
+
+
exampleFunc(closure: {
+    enum Example_0 {
+        enum Example_1 {}
+    }
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+})
+
+
actor Example_0 {
+    actor Example_1 {
+        ↓protocol Example_2 {}
+    }
+}
+
+
var example: Int {
+    actor Example_0 {
+        actor Example_1 {
+            ↓protocol Example_2 {}
+        }
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        actor Example_0 {
+            actor Example_1 {
+                ↓protocol Example_2 {}
+            }
+        }
+    }
+}
+
+
extension Example_0 {
+    actor Example_1 {
+        ↓protocol Example_2 {}
+    }
+}
+
+
class Example_0 {
+    class Example_1 {
+        ↓protocol Example_2 {}
+    }
+}
+
+
var example: Int {
+    class Example_0 {
+        class Example_1 {
+            ↓protocol Example_2 {}
+        }
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        class Example_0 {
+            class Example_1 {
+                ↓protocol Example_2 {}
+            }
+        }
+    }
+}
+
+
extension Example_0 {
+    class Example_1 {
+        ↓protocol Example_2 {}
+    }
+}
+
+
struct Example_0 {
+    struct Example_1 {
+        ↓protocol Example_2 {}
+    }
+}
+
+
var example: Int {
+    struct Example_0 {
+        struct Example_1 {
+            ↓protocol Example_2 {}
+        }
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        struct Example_0 {
+            struct Example_1 {
+                ↓protocol Example_2 {}
+            }
+        }
+    }
+}
+
+
extension Example_0 {
+    struct Example_1 {
+        ↓protocol Example_2 {}
+    }
+}
+
+
enum Example_0 {
+    enum Example_1 {
+        ↓protocol Example_2 {}
+    }
+}
+
+
var example: Int {
+    enum Example_0 {
+        enum Example_1 {
+            ↓protocol Example_2 {}
+        }
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        enum Example_0 {
+            enum Example_1 {
+                ↓protocol Example_2 {}
+            }
+        }
+    }
+}
+
+
extension Example_0 {
+    enum Example_1 {
+        ↓protocol Example_2 {}
+    }
+}
+
+
actor Example_0 {
+    func f_0() {
+        actor Example_1 {
+            func f_1() {
+                func f_2() {
+                    ↓actor Example_2 {}
+                    ↓func f_3() {}
+                    ↓protocol P {}
+                }
+            }
+        }
+    }
+}
+
+
actor Example_0 {
+    func f_0() {
+        switch example {
+        case .exampleCase:
+            actor Example_1 {
+                func f_1() {
+                    func f_2() {
+                        ↓actor Example_2 {}
+                        ↓func f_3() {}
+                        ↓protocol P {}
+                    }
+                }
+            }
+        default:
+            exampleFunc(closure: {
+                actor Example_1 {
+                    func f_1() {
+                        func f_2() {
+                            ↓actor Example_2 {}
+                            ↓func f_3() {}
+                            ↓protocol P {}
+                        }
+                    }
+                }
+            })
+        }
+    }
+}
+
+
class Example_0 {
+    func f_0() {
+        class Example_1 {
+            func f_1() {
+                func f_2() {
+                    ↓class Example_2 {}
+                    ↓func f_3() {}
+                    ↓protocol P {}
+                }
+            }
+        }
+    }
+}
+
+
class Example_0 {
+    func f_0() {
+        switch example {
+        case .exampleCase:
+            class Example_1 {
+                func f_1() {
+                    func f_2() {
+                        ↓class Example_2 {}
+                        ↓func f_3() {}
+                        ↓protocol P {}
+                    }
+                }
+            }
+        default:
+            exampleFunc(closure: {
+                class Example_1 {
+                    func f_1() {
+                        func f_2() {
+                            ↓class Example_2 {}
+                            ↓func f_3() {}
+                            ↓protocol P {}
+                        }
+                    }
+                }
+            })
+        }
+    }
+}
+
+
struct Example_0 {
+    func f_0() {
+        struct Example_1 {
+            func f_1() {
+                func f_2() {
+                    ↓struct Example_2 {}
+                    ↓func f_3() {}
+                    ↓protocol P {}
+                }
+            }
+        }
+    }
+}
+
+
struct Example_0 {
+    func f_0() {
+        switch example {
+        case .exampleCase:
+            struct Example_1 {
+                func f_1() {
+                    func f_2() {
+                        ↓struct Example_2 {}
+                        ↓func f_3() {}
+                        ↓protocol P {}
+                    }
+                }
+            }
+        default:
+            exampleFunc(closure: {
+                struct Example_1 {
+                    func f_1() {
+                        func f_2() {
+                            ↓struct Example_2 {}
+                            ↓func f_3() {}
+                            ↓protocol P {}
+                        }
+                    }
+                }
+            })
+        }
+    }
+}
+
+
enum Example_0 {
+    func f_0() {
+        enum Example_1 {
+            func f_1() {
+                func f_2() {
+                    ↓enum Example_2 {}
+                    ↓func f_3() {}
+                    ↓protocol P {}
+                }
+            }
+        }
+    }
+}
+
+
enum Example_0 {
+    func f_0() {
+        switch example {
+        case .exampleCase:
+            enum Example_1 {
+                func f_1() {
+                    func f_2() {
+                        ↓enum Example_2 {}
+                        ↓func f_3() {}
+                        ↓protocol P {}
+                    }
+                }
+            }
+        default:
+            exampleFunc(closure: {
+                enum Example_1 {
+                    func f_1() {
+                        func f_2() {
+                            ↓enum Example_2 {}
+                            ↓func f_3() {}
+                            ↓protocol P {}
+                        }
+                    }
+                }
+            })
+        }
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/nimble_operator.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/nimble_operator.html new file mode 100644 index 000000000..be3145aed --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/nimble_operator.html @@ -0,0 +1,432 @@ + + + + nimble_operator Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Nimble Operator

+ +

Prefer Nimble operator overloads over free matcher functions

+ +
    +
  • Identifier: nimble_operator
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
expect(seagull.squawk) != "Hi!"
+
+
expect("Hi!") == "Hi!"
+
+
expect(10) > 2
+
+
expect(10) >= 10
+
+
expect(10) < 11
+
+
expect(10) <= 10
+
+
expect(x) === x
+
+
expect(10) == 10
+
+
expect(success) == true
+
+
expect(value) == nil
+
+
expect(value) != nil
+
+
expect(object.asyncFunction()).toEventually(equal(1))
+
+
expect(actual).to(haveCount(expected))
+
+
foo.method {
+    expect(value).to(equal(expectedValue), description: "Failed")
+    return Bar(value: ())
+}
+
+

Triggering Examples

+
↓expect(seagull.squawk).toNot(equal("Hi"))
+
+
↓expect(12).toNot(equal(10))
+
+
↓expect(10).to(equal(10))
+
+
↓expect(10, line: 1).to(equal(10))
+
+
↓expect(10).to(beGreaterThan(8))
+
+
↓expect(10).to(beGreaterThanOrEqualTo(10))
+
+
↓expect(10).to(beLessThan(11))
+
+
↓expect(10).to(beLessThanOrEqualTo(10))
+
+
↓expect(x).to(beIdenticalTo(x))
+
+
↓expect(success).to(beTrue())
+
+
↓expect(success).to(beFalse())
+
+
↓expect(value).to(beNil())
+
+
↓expect(value).toNot(beNil())
+
+
expect(10) > 2
+ ↓expect(10).to(beGreaterThan(2))
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/no_empty_block.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/no_empty_block.html new file mode 100644 index 000000000..51a521915 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/no_empty_block.html @@ -0,0 +1,515 @@ + + + + no_empty_block Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

No Empty Block

+ +

Code blocks should contain at least one statement or comment

+ +
    +
  • Identifier: no_empty_block
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +disabled_block_types + +[] +
  • +
+

Non Triggering Examples

+
func f() {
+    /* do something */
+}
+
+var flag = true {
+    willSet { /* do something */ }
+}
+
+
class Apple {
+    init() { /* do something */ }
+
+    deinit { /* do something */ }
+}
+
+
for _ in 0..<10 { /* do something */ }
+
+do {
+    /* do something */
+} catch {
+    /* do something */
+}
+
+func f() {
+    defer {
+        /* do something */
+    }
+    print("other code")
+}
+
+if flag {
+    /* do something */
+} else {
+    /* do something */
+}
+
+repeat { /* do something */ } while (flag)
+
+while i < 10 { /* do something */ }
+
+
//
+// disabled_block_types: [function_bodies]
+//
+
+func f() {}
+
+var flag = true {
+    willSet {}
+}
+
+
+
//
+// disabled_block_types: [initializer_bodies]
+//
+
+class Apple {
+    init() {}
+
+    deinit {}
+}
+
+
+
//
+// disabled_block_types: [statement_blocks]
+//
+
+for _ in 0..<10 {}
+
+do {
+} catch {
+}
+
+func f() {
+    defer {}
+    print("other code")
+}
+
+if flag {
+} else {
+}
+
+repeat {} while (flag)
+
+while i < 10 {}
+
+
+
f { _ in /* comment */ }
+f { _ in // comment
+}
+f { _ in
+    // comment
+}
+
+
//
+// disabled_block_types: [closure_blocks]
+//
+
+f {}
+{}()
+
+
+

Triggering Examples

+
func f() ↓{}
+
+var flag = true {
+    willSet ↓{}
+}
+
+
class Apple {
+    init() ↓{}
+
+    deinit ↓{}
+}
+
+
for _ in 0..<10 ↓{}
+
+do ↓{
+} catch ↓{
+}
+
+func f() {
+    defer ↓{}
+    print("other code")
+}
+
+if flag ↓{
+} else ↓{
+}
+
+repeat ↓{} while (flag)
+
+while i < 10 ↓{}
+
+
f ↓{}
+
+
Button ↓{} label: ↓{}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/no_extension_access_modifier.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/no_extension_access_modifier.html new file mode 100644 index 000000000..c05c9c2a0 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/no_extension_access_modifier.html @@ -0,0 +1,389 @@ + + + + no_extension_access_modifier Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

No Extension Access Modifier

+ +

Prefer not to use extension access modifiers

+ +
    +
  • Identifier: no_extension_access_modifier
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +error +
  • +
+

Non Triggering Examples

+
extension String {}
+
+

+
+ extension String {}
+
+

Triggering Examples

+
↓private extension String {}
+
+
↓public 
+ extension String {}
+
+
↓open extension String {}
+
+
↓internal extension String {}
+
+
↓fileprivate extension String {}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/no_fallthrough_only.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/no_fallthrough_only.html new file mode 100644 index 000000000..66831469e --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/no_fallthrough_only.html @@ -0,0 +1,508 @@ + + + + no_fallthrough_only Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

No Fallthrough only

+ +

Fallthroughs can only be used if the case contains at least one other statement

+ +
    +
  • Identifier: no_fallthrough_only
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
switch myvar {
+case 1:
+    var a = 1
+    fallthrough
+case 2:
+    var a = 2
+}
+
+
switch myvar {
+case "a":
+    var one = 1
+    var two = 2
+    fallthrough
+case "b": /* comment */
+    var three = 3
+}
+
+
switch myvar {
+case 1:
+    let one = 1
+case 2:
+    // comment
+    var two = 2
+}
+
+
switch myvar {
+case MyFunc(x: [1, 2, YourFunc(a: 23)], y: 2):
+    var three = 3
+    fallthrough
+default:
+    var three = 4
+}
+
+
switch myvar {
+case .alpha:
+    var one = 1
+case .beta:
+    var three = 3
+    fallthrough
+default:
+    var four = 4
+}
+
+
let aPoint = (1, -1)
+switch aPoint {
+case let (x, y) where x == y:
+    let A = "A"
+case let (x, y) where x == -y:
+    let B = "B"
+    fallthrough
+default:
+    let C = "C"
+}
+
+
switch myvar {
+case MyFun(with: { $1 }):
+    let one = 1
+    fallthrough
+case "abc":
+    let two = 2
+}
+
+
switch enumInstance {
+case .caseA:
+    print("it's a")
+case .caseB:
+    fallthrough
+@unknown default:
+    print("it's not a")
+}
+
+

Triggering Examples

+
switch myvar {
+case 1:
+    ↓fallthrough
+case 2:
+    var a = 1
+}
+
+
switch myvar {
+case 1:
+    var a = 2
+case 2:
+    ↓fallthrough
+case 3:
+    var a = 3
+}
+
+
switch myvar {
+case 1: // comment
+    ↓fallthrough
+}
+
+
switch myvar {
+case 1: /* multi
+    line
+    comment */
+    ↓fallthrough
+case 2:
+    var a = 2
+}
+
+
switch myvar {
+case MyFunc(x: [1, 2, YourFunc(a: 23)], y: 2):
+    ↓fallthrough
+default:
+    var three = 4
+}
+
+
switch myvar {
+case .alpha:
+    var one = 1
+case .beta:
+    ↓fallthrough
+case .gamma:
+    var three = 3
+default:
+    var four = 4
+}
+
+
let aPoint = (1, -1)
+switch aPoint {
+case let (x, y) where x == y:
+    let A = "A"
+case let (x, y) where x == -y:
+    ↓fallthrough
+default:
+    let B = "B"
+}
+
+
switch myvar {
+case MyFun(with: { $1 }):
+    ↓fallthrough
+case "abc":
+    let two = 2
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/no_grouping_extension.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/no_grouping_extension.html new file mode 100644 index 000000000..3a80cc28f --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/no_grouping_extension.html @@ -0,0 +1,393 @@ + + + + no_grouping_extension Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

No Grouping Extension

+ +

Extensions shouldn’t be used to group code within the same source file

+ +
    +
  • Identifier: no_grouping_extension
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
protocol Food {}
+extension Food {}
+
+
class Apples {}
+extension Oranges {}
+
+
class Box<T> {}
+extension Box where T: Vegetable {}
+
+

Triggering Examples

+
enum Fruit {}
+↓extension Fruit {}
+
+
↓extension Tea: Error {}
+struct Tea {}
+
+
class Ham { class Spam {}}
+↓extension Ham.Spam {}
+
+
extension External { struct Gotcha {}}
+↓extension External.Gotcha {}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/no_magic_numbers.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/no_magic_numbers.html new file mode 100644 index 000000000..32fa035d1 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/no_magic_numbers.html @@ -0,0 +1,504 @@ + + + + no_magic_numbers Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

No Magic Numbers

+ +

Magic numbers should be replaced by named constants

+ +
    +
  • Identifier: no_magic_numbers
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +test_parent_classes + +[“QuickSpec”, “XCTestCase”] +
  • +
+

Non Triggering Examples

+
var foo = 123
+
+
static let bar: Double = 0.123
+
+
let a = b + 1.0
+
+
array[0] + array[1] 
+
+
let foo = 1_000.000_01
+
+
// array[1337]
+
+
baz("9999")
+
+
func foo() {
+    let x: Int = 2
+    let y = 3
+    let vector = [x, y, -1]
+}
+
+
class A {
+    var foo: Double = 132
+    static let bar: Double = 0.98
+}
+
+
@available(iOS 13, *)
+func version() {
+    if #available(iOS 13, OSX 10.10, *) {
+        return
+    }
+}
+
+
enum Example: Int {
+    case positive = 2
+    case negative = -2
+}
+
+
class FooTests: XCTestCase {
+    let array: [Int] = []
+    let bar = array[42]
+}
+
+
class FooTests: XCTestCase {
+    class Bar {
+        let array: [Int] = []
+        let bar = array[42]
+    }
+}
+
+
class MyTest: XCTestCase {}
+extension MyTest {
+    let a = Int(3)
+}
+
+
extension MyTest {
+    let a = Int(3)
+}
+class MyTest: XCTestCase {}
+
+
let foo = 1 << 2
+
+
let foo = 1 >> 2
+
+
let foo = 2 >> 2
+
+
let foo = 2 << 2
+
+
let a = b / 100.0
+
+
let range = 2 ..< 12
+
+
let range = ...12
+
+
let range = 12...
+
+
let (lowerBound, upperBound) = (400, 599)
+
+
let a = (5, 10)
+
+
let notFound = (statusCode: 404, description: "Not Found", isError: true)
+
+
#Preview {
+    ContentView(value: 5)
+}
+
+

Triggering Examples

+
foo(↓321)
+
+
bar(↓1_000.005_01)
+
+
array[↓42]
+
+
let box = array[↓12 + ↓14]
+
+
let a = b + ↓2.0
+
+
let range = 2 ... ↓12 + 1
+
+
let range = ↓2*↓6...
+
+
let slice = array[↓2...↓4]
+
+
for i in ↓3 ..< ↓8 {}
+
+
let n: Int = Int(r * ↓255) << ↓16 | Int(g * ↓255) << ↓8
+
+
Color.primary.opacity(isAnimate ? ↓0.1 : ↓1.5)
+
+
        class MyTest: XCTestCase {}
+        extension NSObject {
+            let a = Int(↓3)
+        }
+
+
if (fileSize > ↓1000000) {
+    return
+}
+
+
let imageHeight = (width - ↓24)
+
+
return (↓5, ↓10, ↓15)
+
+
#ExampleMacro {
+    ContentView(value: ↓5)
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/no_space_in_method_call.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/no_space_in_method_call.html new file mode 100644 index 000000000..4bed73f84 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/no_space_in_method_call.html @@ -0,0 +1,406 @@ + + + + no_space_in_method_call Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

No Space in Method Call

+ +

Don’t add a space between the method name and the parentheses

+ +
    +
  • Identifier: no_space_in_method_call
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
foo()
+
+
object.foo()
+
+
object.foo(1)
+
+
object.foo(value: 1)
+
+
object.foo { print($0 }
+
+
list.sorted { $0.0 < $1.0 }.map { $0.value }
+
+
self.init(rgb: (Int) (colorInt))
+
+
Button {
+    print("Button tapped")
+} label: {
+    Text("Button")
+}
+
+

Triggering Examples

+
foo↓ ()
+
+
object.foo↓ ()
+
+
object.foo↓ (1)
+
+
object.foo↓ (value: 1)
+
+
object.foo↓ () {}
+
+
object.foo↓     ()
+
+
object.foo↓     (value: 1) { x in print(x) }
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/non_optional_string_data_conversion.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/non_optional_string_data_conversion.html new file mode 100644 index 000000000..057dfcdde --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/non_optional_string_data_conversion.html @@ -0,0 +1,376 @@ + + + + non_optional_string_data_conversion Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Non-optional String -> Data Conversion

+ +

Prefer non-optional Data(_:) initializer when converting String to Data

+ +
    +
  • Identifier: non_optional_string_data_conversion
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
Data("foo".utf8)
+
+

Triggering Examples

+
"foo".data(using: .utf8)
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/non_overridable_class_declaration.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/non_overridable_class_declaration.html new file mode 100644 index 000000000..90972c995 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/non_overridable_class_declaration.html @@ -0,0 +1,430 @@ + + + + non_overridable_class_declaration Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Class Declaration in Final Class

+ +

Class methods and properties in final classes should themselves be final, just as if the declarations +are private. In both cases, they cannot be overridden. Using final class or static makes this explicit.

+ +
    +
  • Identifier: non_overridable_class_declaration
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +final_class_modifier + +final class +
  • +
+

Non Triggering Examples

+
final class C {
+    final class var b: Bool { true }
+    final class func f() {}
+}
+
+
class C {
+    final class var b: Bool { true }
+    final class func f() {}
+}
+
+
class C {
+    class var b: Bool { true }
+    class func f() {}
+}
+
+
class C {
+    static var b: Bool { true }
+    static func f() {}
+}
+
+
final class C {
+    static var b: Bool { true }
+    static func f() {}
+}
+
+
final class C {
+    class D {
+        class var b: Bool { true }
+        class func f() {}
+    }
+}
+
+

Triggering Examples

+
final class C {
+    ↓class var b: Bool { true }
+    ↓class func f() {}
+}
+
+
class C {
+    final class D {
+        ↓class var b: Bool { true }
+        ↓class func f() {}
+    }
+}
+
+
class C {
+    private ↓class var b: Bool { true }
+    private ↓class func f() {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/notification_center_detachment.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/notification_center_detachment.html new file mode 100644 index 000000000..265930662 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/notification_center_detachment.html @@ -0,0 +1,390 @@ + + + + notification_center_detachment Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Notification Center Detachment

+ +

An object should only remove itself as an observer in deinit

+ +
    +
  • Identifier: notification_center_detachment
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class Foo {
+   deinit {
+       NotificationCenter.default.removeObserver(self)
+   }
+}
+
+
class Foo {
+   func bar() {
+       NotificationCenter.default.removeObserver(otherObject)
+   }
+}
+
+

Triggering Examples

+
class Foo {
+   func bar() {
+       ↓NotificationCenter.default.removeObserver(self)
+   }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/ns_number_init_as_function_reference.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/ns_number_init_as_function_reference.html new file mode 100644 index 000000000..2ed8f01f7 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/ns_number_init_as_function_reference.html @@ -0,0 +1,386 @@ + + + + ns_number_init_as_function_reference Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

NSNumber Init as Function Reference

+ +

Passing NSNumber.init or NSDecimalNumber.init as a function reference is dangerous as it can cause the wrong initializer to be used, causing crashes; use .init(value:) instead

+ +
    +
  • Identifier: ns_number_init_as_function_reference
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
[0, 0.2].map(NSNumber.init(value:))
+
+
let value = NSNumber.init(value: 0.0)
+
+
[0, 0.2].map { NSNumber(value: $0) }
+
+
[0, 0.2].map(NSDecimalNumber.init(value:))
+
+
[0, 0.2].map { NSDecimalNumber(value: $0) }
+
+

Triggering Examples

+
[0, 0.2].map(↓NSNumber.init)
+
+
[0, 0.2].map(↓NSDecimalNumber.init)
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/nslocalizedstring_key.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/nslocalizedstring_key.html new file mode 100644 index 000000000..8d435bc9b --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/nslocalizedstring_key.html @@ -0,0 +1,393 @@ + + + + nslocalizedstring_key Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

NSLocalizedString Key

+ +

Static strings should be used as key/comment in NSLocalizedString in order for genstrings to work

+ +
    +
  • Identifier: nslocalizedstring_key
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
NSLocalizedString("key", comment: "")
+
+
NSLocalizedString("key" + "2", comment: "")
+
+
NSLocalizedString("key", comment: "comment")
+
+
NSLocalizedString("This is a multi-" +
+    "line string", comment: "")
+
+
let format = NSLocalizedString("%@, %@.", comment: "Accessibility label for a post in the post list." +
+" The parameters are the title, and date respectively." +
+" For example, "Let it Go, 1 hour ago."")
+
+

Triggering Examples

+
NSLocalizedString(↓method(), comment: "")
+
+
NSLocalizedString(↓"key_\(param)", comment: "")
+
+
NSLocalizedString("key", comment: ↓"comment with \(param)")
+
+
NSLocalizedString(↓"key_\(param)", comment: ↓method())
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/nslocalizedstring_require_bundle.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/nslocalizedstring_require_bundle.html new file mode 100644 index 000000000..45b45cfd0 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/nslocalizedstring_require_bundle.html @@ -0,0 +1,391 @@ + + + + nslocalizedstring_require_bundle Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

NSLocalizedString Require Bundle

+ +

Calls to NSLocalizedString should specify the bundle which contains the strings file

+ +
    +
  • Identifier: nslocalizedstring_require_bundle
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
NSLocalizedString("someKey", bundle: .main, comment: "test")
+
+
NSLocalizedString("someKey", tableName: "a",
+                  bundle: Bundle(for: A.self),
+                  comment: "test")
+
+
NSLocalizedString("someKey", tableName: "xyz",
+                  bundle: someBundle, value: "test"
+                  comment: "test")
+
+
arbitraryFunctionCall("something")
+
+

Triggering Examples

+
↓NSLocalizedString("someKey", comment: "test")
+
+
↓NSLocalizedString("someKey", tableName: "a", comment: "test")
+
+
↓NSLocalizedString("someKey", tableName: "xyz",
+                  value: "test", comment: "test")
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/nsobject_prefer_isequal.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/nsobject_prefer_isequal.html new file mode 100644 index 000000000..e12bd0e4c --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/nsobject_prefer_isequal.html @@ -0,0 +1,444 @@ + + + + nsobject_prefer_isequal Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

NSObject Prefer isEqual

+ +

NSObject subclasses should implement isEqual instead of ==

+ +
    +
  • Identifier: nsobject_prefer_isequal
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class AClass: NSObject {
+}
+
+
@objc class AClass: SomeNSObjectSubclass {
+}
+
+
class AClass: Equatable {
+    static func ==(lhs: AClass, rhs: AClass) -> Bool {
+        return true
+    }
+
+
class AClass: NSObject {
+    override func isEqual(_ object: Any?) -> Bool {
+        return true
+    }
+}
+
+
@objc class AClass: SomeNSObjectSubclass {
+    override func isEqual(_ object: Any?) -> Bool {
+        return false
+    }
+}
+
+
class AClass: NSObject {
+    static func ==(lhs: AClass, rhs: BClass) -> Bool {
+        return true
+    }
+}
+
+
struct AStruct: Equatable {
+    static func ==(lhs: AStruct, rhs: AStruct) -> Bool {
+        return false
+    }
+}
+
+
enum AnEnum: Equatable {
+    static func ==(lhs: AnEnum, rhs: AnEnum) -> Bool {
+        return true
+    }
+}
+
+

Triggering Examples

+
class AClass: NSObject {
+    ↓static func ==(lhs: AClass, rhs: AClass) -> Bool {
+        return false
+    }
+}
+
+
@objc class AClass: SomeOtherNSObjectSubclass {
+    ↓static func ==(lhs: AClass, rhs: AClass) -> Bool {
+        return true
+    }
+}
+
+
class AClass: NSObject, Equatable {
+    ↓static func ==(lhs: AClass, rhs: AClass) -> Bool {
+        return false
+    }
+}
+
+
class AClass: NSObject {
+    override func isEqual(_ object: Any?) -> Bool {
+        guard let other = object as? AClass else {
+            return false
+        }
+        return true
+    }
+
+    ↓static func ==(lhs: AClass, rhs: AClass) -> Bool {
+        return false
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/number_separator.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/number_separator.html new file mode 100644 index 000000000..5df22038a --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/number_separator.html @@ -0,0 +1,625 @@ + + + + number_separator Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Number Separator

+ +

Underscores should be used as thousand separator in large numbers with a configurable number of digits. In other words, there should be an underscore after every 3 digits in the integral as well as the fractional part of a number.

+ +
    +
  • Identifier: number_separator
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +minimum_length + +0 +
    +exclude_ranges + +[] +
  • +
+

Non Triggering Examples

+
let foo = -100
+
+
let foo = -1_000
+
+
let foo = -1_000_000
+
+
let foo = -1.0001
+
+
let foo = -1_000_000.0000001
+
+
let binary = -0b10000
+
+
let binary = -0b1000_0001
+
+
let hex = -0xA
+
+
let hex = -0xAA_BB
+
+
let octal = -0o21
+
+
let octal = -0o21_1
+
+
let exp = -1_000_000.000000e2
+
+
let foo: Double = -(200)
+
+
let foo: Double = -(200 / 447.214)
+
+
let foo = -6.2832e-6
+
+
let foo = +100
+
+
let foo = +1_000
+
+
let foo = +1_000_000
+
+
let foo = +1.0001
+
+
let foo = +1_000_000.0000001
+
+
let binary = +0b10000
+
+
let binary = +0b1000_0001
+
+
let hex = +0xA
+
+
let hex = +0xAA_BB
+
+
let octal = +0o21
+
+
let octal = +0o21_1
+
+
let exp = +1_000_000.000000e2
+
+
let foo: Double = +(200)
+
+
let foo: Double = +(200 / 447.214)
+
+
let foo = +6.2832e-6
+
+
let foo = 100
+
+
let foo = 1_000
+
+
let foo = 1_000_000
+
+
let foo = 1.0001
+
+
let foo = 1_000_000.0000001
+
+
let binary = 0b10000
+
+
let binary = 0b1000_0001
+
+
let hex = 0xA
+
+
let hex = 0xAA_BB
+
+
let octal = 0o21
+
+
let octal = 0o21_1
+
+
let exp = 1_000_000.000000e2
+
+
let foo: Double = (200)
+
+
let foo: Double = (200 / 447.214)
+
+
let foo = 6.2832e-6
+
+

Triggering Examples

+
let foo = -↓10_0
+
+
let foo = -↓1000
+
+
let foo = -↓1000e2
+
+
let foo = -↓1000E2
+
+
let foo = -↓1__000
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo = -↓1.0001
+
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo = -↓1_000_000.000000_1
+
+
+
let foo = -↓1000000.000000_1
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo = -↓6.2832e-6
+
+
+
let foo = +↓10_0
+
+
let foo = +↓1000
+
+
let foo = +↓1000e2
+
+
let foo = +↓1000E2
+
+
let foo = +↓1__000
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo = +↓1.0001
+
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo = +↓1_000_000.000000_1
+
+
+
let foo = +↓1000000.000000_1
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo = +↓6.2832e-6
+
+
+
let foo = ↓10_0
+
+
let foo = ↓1000
+
+
let foo = ↓1000e2
+
+
let foo = ↓1000E2
+
+
let foo = ↓1__000
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo = ↓1.0001
+
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo = ↓1_000_000.000000_1
+
+
+
let foo = ↓1000000.000000_1
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo = ↓6.2832e-6
+
+
+
let foo: Double = -(↓100000)
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo: Double = -(↓10.000000_1)
+
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo: Double = -(↓123456 / ↓447.214214)
+
+
+
let foo: Double = +(↓100000)
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo: Double = +(↓10.000000_1)
+
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo: Double = +(↓123456 / ↓447.214214)
+
+
+
let foo: Double = (↓100000)
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo: Double = (↓10.000000_1)
+
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo: Double = (↓123456 / ↓447.214214)
+
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/object_literal.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/object_literal.html new file mode 100644 index 000000000..76e4272b7 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/object_literal.html @@ -0,0 +1,436 @@ + + + + object_literal Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Object Literal

+ +

Prefer object literals over image and color inits

+ +
    +
  • Identifier: object_literal
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +image_literal + +true +
    +color_literal + +true +
  • +
+

Non Triggering Examples

+
let image = #imageLiteral(resourceName: "image.jpg")
+
+
let color = #colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)
+
+
let image = UIImage(named: aVariable)
+
+
let image = UIImage(named: "interpolated \(variable)")
+
+
let color = UIColor(red: value, green: value, blue: value, alpha: 1)
+
+
let image = NSImage(named: aVariable)
+
+
let image = NSImage(named: "interpolated \(variable)")
+
+
let color = NSColor(red: value, green: value, blue: value, alpha: 1)
+
+

Triggering Examples

+
let image = ↓UIImage(named: "foo")
+
+
let color = ↓UIColor(red: 0.3, green: 0.3, blue: 0.3, alpha: 1)
+
+
let color = ↓UIColor(red: 100 / 255.0, green: 50 / 255.0, blue: 0, alpha: 1)
+
+
let color = ↓UIColor(white: 0.5, alpha: 1)
+
+
let image = ↓NSImage(named: "foo")
+
+
let color = ↓NSColor(red: 0.3, green: 0.3, blue: 0.3, alpha: 1)
+
+
let color = ↓NSColor(red: 100 / 255.0, green: 50 / 255.0, blue: 0, alpha: 1)
+
+
let color = ↓NSColor(white: 0.5, alpha: 1)
+
+
let image = ↓UIImage.init(named: "foo")
+
+
let color = ↓UIColor.init(red: 0.3, green: 0.3, blue: 0.3, alpha: 1)
+
+
let color = ↓UIColor.init(red: 100 / 255.0, green: 50 / 255.0, blue: 0, alpha: 1)
+
+
let color = ↓UIColor.init(white: 0.5, alpha: 1)
+
+
let image = ↓NSImage.init(named: "foo")
+
+
let color = ↓NSColor.init(red: 0.3, green: 0.3, blue: 0.3, alpha: 1)
+
+
let color = ↓NSColor.init(red: 100 / 255.0, green: 50 / 255.0, blue: 0, alpha: 1)
+
+
let color = ↓NSColor.init(white: 0.5, alpha: 1)
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/one_declaration_per_file.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/one_declaration_per_file.html new file mode 100644 index 000000000..a01039e36 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/one_declaration_per_file.html @@ -0,0 +1,390 @@ + + + + one_declaration_per_file Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

One Declaration per File

+ +

Only a single declaration is allowed in a file

+ +
    +
  • Identifier: one_declaration_per_file
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
actor Foo {}
+
+
class Foo {}
+extension Foo {}
+
+
struct S {
+    struct N {}
+}
+
+

Triggering Examples

+
class Foo {}
+↓class Bar {}
+
+
protocol Foo {}
+↓enum Bar {}
+
+
struct Foo {}
+↓struct Bar {}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/opening_brace.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/opening_brace.html new file mode 100644 index 000000000..a63e2c76a --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/opening_brace.html @@ -0,0 +1,638 @@ + + + + opening_brace Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Opening Brace Spacing

+ +

The correct positioning of braces that introduce a block of code or member list is highly controversial. No matter which style is preferred, consistency is key. Apart from different tastes, the positioning of braces can also have a significant impact on the readability of the code, especially for visually impaired developers. This rule ensures that braces are preceded by a single space and on the same line as the declaration. Comments between the declaration and the opening brace are respected. Check out the contrasted_opening_brace rule for a different style.

+ +
    +
  • Identifier: opening_brace
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +ignore_multiline_type_headers + +false +
    +ignore_multiline_statement_conditions + +false +
    +ignore_multiline_function_signatures + +false +
    +allow_multiline_func + +false +
  • +
+

Non Triggering Examples

+
func abc() {
+}
+
+
[].map() { $0 }
+
+
[].map({ })
+
+
if let a = b { }
+
+
while a == b { }
+
+
guard let a = b else { }
+
+
struct Rule {}
+
+
struct Parent {
+    struct Child {
+        let foo: Int
+    }
+}
+
+
func f(rect: CGRect) {
+    {
+        let centre = CGPoint(x: rect.midX, y: rect.midY)
+        print(centre)
+    }()
+}
+
+
func f(rect: CGRect) -> () -> Void {
+    {
+        let centre = CGPoint(x: rect.midX, y: rect.midY)
+        print(centre)
+    }
+}
+
+
func f() -> () -> Void {
+    {}
+}
+
+
class Rule:
+  NSObject {
+  var a: String {
+    return ""
+  }
+}
+
+
self.foo(
+    (
+        "String parameter",
+        { "Do something here" }
+    )
+)
+
+
let pattern = #/(\{(?<key>\w+)\})/#
+
+
if c {}
+else {}
+
+
    if c /* comment */ {
+        return
+    }
+
+

Triggering Examples

+
func abc()↓{
+}
+
+
func abc()
+    ↓{ }
+
+
func abc(a: A,
+    b: B)
+↓{
+
+
[].map()↓{ $0 }
+
+
struct OldContentView: View {
+  @State private var showOptions = false
+
+  var body: some View {
+    Button(action: {
+      self.showOptions.toggle()
+    })↓{
+      Image(systemName: "gear")
+    }
+  }
+}
+
+
struct OldContentView: View {
+  @State private var showOptions = false
+
+  var body: some View {
+    Button(action: {
+      self.showOptions.toggle()
+    })
+   ↓{
+      Image(systemName: "gear")
+    }
+  }
+}
+
+
struct OldContentView: View {
+  @State private var showOptions = false
+
+  var body: some View {
+    Button {
+      self.showOptions.toggle()
+    } label:↓{
+      Image(systemName: "gear")
+    }
+  }
+}
+
+
if let a = b↓{ }
+
+
while a == b↓{ }
+
+
guard let a = b else↓{ }
+
+
if
+    let a = b,
+    let c = d
+    where a == c↓{ }
+
+
while
+    let a = b,
+    let c = d
+    where a == c↓{ }
+
+
guard
+    let a = b,
+    let c = d
+    where a == c else↓{ }
+
+
struct Rule↓{}
+
+
struct Rule
+↓{
+}
+
+
struct Rule
+
+    ↓{
+}
+
+
struct Parent {
+    struct Child
+    ↓{
+        let foo: Int
+    }
+}
+
+
switch a↓{}
+
+
if
+    let a = b,
+    let c = d,
+    a == c
+↓{ }
+
+
while
+    let a = b,
+    let c = d,
+    a == c
+↓{ }
+
+
guard
+    let a = b,
+    let c = d,
+    a == c else
+↓{ }
+
+
class Rule↓{}
+
+
+
actor Rule↓{}
+
+
+
enum Rule↓{}
+
+
+
protocol Rule↓{}
+
+
+
extension Rule↓{}
+
+
+
class Rule {
+  var a: String↓{
+    return ""
+  }
+}
+
+
class Rule {
+  var a: String {
+    willSet↓{
+
+    }
+    didSet  ↓{
+
+    }
+  }
+}
+
+
precedencegroup Group↓{
+  assignment: true
+}
+
+
if
+    "test".isEmpty
+↓{
+    // code here
+}
+
+
func fooFun() {
+    let foo: String? = "foo"
+    let bar: String? = "bar"
+
+    if
+        let foo = foo,
+        let bar = bar
+    ↓{
+        print(foo + bar)
+    }
+}
+
+
if
+    let a = ["A", "B"].first,
+    let b = ["B"].first
+↓{
+    print(a)
+}
+
+
if c  ↓{}
+else /* comment */  ↓{}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/operator_usage_whitespace.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/operator_usage_whitespace.html new file mode 100644 index 000000000..0d07e7f5b --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/operator_usage_whitespace.html @@ -0,0 +1,544 @@ + + + + operator_usage_whitespace Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Operator Usage Whitespace

+ +

Operators should be surrounded by a single whitespace when they are being used

+ +
    +
  • Identifier: operator_usage_whitespace
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +lines_look_around + +2 +
    +skip_aligned_constants + +true +
    +allowed_no_space_operators + +[“…”, “..<”] +
  • +
+

Non Triggering Examples

+
let foo = 1 + 2
+
+
let foo = 1 > 2
+
+
let foo = !false
+
+
let foo: Int?
+
+
let foo: Array<String>
+
+
let model = CustomView<Container<Button>, NSAttributedString>()
+
+
let foo: [String]
+
+
let foo = 1 + 
+  2
+
+
let range = 1...3
+
+
let range = 1 ... 3
+
+
let range = 1..<3
+
+
#if swift(>=3.0)
+    foo()
+#endif
+
+
array.removeAtIndex(-200)
+
+
let name = "image-1"
+
+
button.setImage(#imageLiteral(resourceName: "image-1"), for: .normal)
+
+
let doubleValue = -9e-11
+
+
let foo = GenericType<(UIViewController) -> Void>()
+
+
let foo = Foo<Bar<T>, Baz>()
+
+
let foo = SignalProducer<Signal<Value, Error>, Error>([ self.signal, next ]).flatten(.concat)
+
+
"let foo =  1"
+
+
enum Enum {
+case hello   = 1
+case hello2  = 1
+}
+
+
let something = Something<GenericParameter1,
+                          GenericParameter2>()
+
+
return path.flatMap { path in
+    return compileCommands[path] ??
+        compileCommands[path.path(relativeTo: FileManager.default.currentDirectoryPath)]
+}
+
+
internal static func == (lhs: Vertex, rhs: Vertex) -> Bool {
+    return lhs.filePath == rhs.filePath
+        && lhs.originalRemoteString == rhs.originalRemoteString
+        && lhs.rootDirectory == rhs.rootDirectory
+}
+
+
internal static func == (lhs: Vertex, rhs: Vertex) -> Bool {
+    return lhs.filePath == rhs.filePath &&
+        lhs.originalRemoteString == rhs.originalRemoteString &&
+        lhs.rootDirectory == rhs.rootDirectory
+}
+
+
private static let pattern =
+    "\\S\(mainPatternGroups)" + // Regexp will match if expression not begin with comma
+    "|" +                       // or
+    "\(mainPatternGroups)"      // Regexp will match if expression begins with comma
+
+
private static let pattern =
+    "\\S\(mainPatternGroups)" + // Regexp will match if expression not begin with comma
+    "|"                       + // or
+    "\(mainPatternGroups)"      // Regexp will match if expression begins with comma
+
+
typealias Foo = Bar
+
+
protocol A {
+    associatedtype B = C
+}
+
+
tabbedViewController.title = nil
+
+

Triggering Examples

+
let foo = 1↓+2
+
+
let foo = 1↓   + 2
+
+
let foo = 1↓   +    2
+
+
let foo = 1↓ +    2
+
+
let foo↓=1↓+2
+
+
let foo↓=1 + 2
+
+
let foo↓=bar
+
+
let range = 1↓ ..<  3
+
+
let foo = bar↓   ?? 0
+
+
let foo = bar↓ !=  0
+
+
let foo = bar↓ !==  bar2
+
+
let v8 = Int8(1)↓  << 6
+
+
let v8 = 1↓ <<  (6)
+
+
let v8 = 1↓ <<  (6)
+ let foo = 1 > 2
+
+
let foo↓  = [1]
+
+
let foo↓  = "1"
+
+
let foo↓ =  "1"
+
+
enum Enum {
+case one↓  =  1
+case two  = 1
+}
+
+
enum Enum {
+case one  = 1
+case two↓  =  1
+}
+
+
enum Enum {
+case one↓   = 1
+case two↓  = 1
+}
+
+
typealias Foo↓ =  Bar
+
+
protocol A {
+    associatedtype B↓  = C
+}
+
+
tabbedViewController.title↓  = nil
+
+
let foo = bar ? 0↓:1
+
+
let foo = bar↓ ?   0 : 1
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/operator_whitespace.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/operator_whitespace.html new file mode 100644 index 000000000..afaa01034 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/operator_whitespace.html @@ -0,0 +1,390 @@ + + + + operator_whitespace Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Operator Function Whitespace

+ +

Operators should be surrounded by a single whitespace when defining them

+ +
    +
  • Identifier: operator_whitespace
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func <| (lhs: Int, rhs: Int) -> Int {}
+
+
func <|< <A>(lhs: A, rhs: A) -> A {}
+
+
func abc(lhs: Int, rhs: Int) -> Int {}
+
+

Triggering Examples

+
↓func <|(lhs: Int, rhs: Int) -> Int {}
+
+
↓func <|<<A>(lhs: A, rhs: A) -> A {}
+
+
↓func <|  (lhs: Int, rhs: Int) -> Int {}
+
+
↓func <|<  <A>(lhs: A, rhs: A) -> A {}
+
+
↓func  <| (lhs: Int, rhs: Int) -> Int {}
+
+
↓func  <|< <A>(lhs: A, rhs: A) -> A {}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/optional_data_string_conversion.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/optional_data_string_conversion.html new file mode 100644 index 000000000..76f2d19d6 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/optional_data_string_conversion.html @@ -0,0 +1,384 @@ + + + + optional_data_string_conversion Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Optional Data -> String Conversion

+ +

Prefer failable String(bytes:encoding:) initializer when converting Data to String

+ +
    +
  • Identifier: optional_data_string_conversion
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
String(data: data, encoding: .utf8)
+
+
String(bytes: data, encoding: .utf8)
+
+
String(UTF8.self)
+
+
String(a, b, c, UTF8.self)
+
+
String(decoding: data, encoding: UTF8.self)
+
+

Triggering Examples

+
String(decoding: data, as: UTF8.self)
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/optional_enum_case_matching.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/optional_enum_case_matching.html new file mode 100644 index 000000000..ff108f0b4 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/optional_enum_case_matching.html @@ -0,0 +1,424 @@ + + + + optional_enum_case_matching Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Optional Enum Case Match

+ +

Matching an enum case against an optional enum without ‘?’ is supported on Swift 5.1 and above

+ +
    +
  • Identifier: optional_enum_case_matching
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.1.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
switch foo {
+ case .bar: break
+ case .baz: break
+ default: break
+}
+
+
switch foo {
+ case (.bar, .baz): break
+ case (.bar, _): break
+ case (_, .baz): break
+ default: break
+}
+
+
switch (x, y) {
+case (.c, _?):
+    break
+case (.c, nil):
+    break
+case (_, _):
+    break
+}
+
+

Triggering Examples

+
switch foo {
+ case .bar↓?: break
+ case .baz: break
+ default: break
+}
+
+
switch foo {
+ case Foo.bar↓?: break
+ case .baz: break
+ default: break
+}
+
+
switch foo {
+ case .bar↓?, .baz↓?: break
+ default: break
+}
+
+
switch foo {
+ case .bar↓? where x > 1: break
+ case .baz: break
+ default: break
+}
+
+
switch foo {
+ case (.bar↓?, .baz↓?): break
+ case (.bar↓?, _): break
+ case (_, .bar↓?): break
+ default: break
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/orphaned_doc_comment.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/orphaned_doc_comment.html new file mode 100644 index 000000000..d44f92ff9 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/orphaned_doc_comment.html @@ -0,0 +1,416 @@ + + + + orphaned_doc_comment Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Orphaned Doc Comment

+ +

A doc comment should be attached to a declaration

+ +
    +
  • Identifier: orphaned_doc_comment
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
/// My great property
+var myGreatProperty: String!
+
+
//////////////////////////////////////
+//
+// Copyright header.
+//
+//////////////////////////////////////
+
+
/// Look here for more info: https://github.com.
+var myGreatProperty: String!
+
+
/// Look here for more info:
+/// https://github.com.
+var myGreatProperty: String!
+
+

Triggering Examples

+
↓/// My great property
+// Not a doc string
+var myGreatProperty: String!
+
+
↓/// Look here for more info: https://github.com.
+// Not a doc string
+var myGreatProperty: String!
+
+
↓/// Look here for more info: https://github.com.
+
+
+// Not a doc string
+var myGreatProperty: String!
+
+
↓/// Look here for more info: https://github.com.
+// Not a doc string
+↓/// My great property
+// Not a doc string
+var myGreatProperty: String!
+
+
extension Nested {
+    ↓///
+    /// Look here for more info: https://github.com.
+
+    // Not a doc string
+    var myGreatProperty: String!
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/overridden_super_call.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/overridden_super_call.html new file mode 100644 index 000000000..79a2d161d --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/overridden_super_call.html @@ -0,0 +1,440 @@ + + + + overridden_super_call Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Overridden Method Calls Super

+ +

Some overridden methods should always call super.

+ +
    +
  • Identifier: overridden_super_call
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +excluded + +[] +
    +included + +[“*”] +
  • +
+

Non Triggering Examples

+
class VC: UIViewController {
+    override func viewWillAppear(_ animated: Bool) {
+        super.viewWillAppear(animated)
+    }
+}
+
+
class VC: UIViewController {
+    override func viewWillAppear(_ animated: Bool) {
+        self.method1()
+        super.viewWillAppear(animated)
+        self.method2()
+    }
+}
+
+
class VC: UIViewController {
+    override func loadView() {
+    }
+}
+
+
class Some {
+    func viewWillAppear(_ animated: Bool) {
+    }
+}
+
+
class VC: UIViewController {
+    override func viewDidLoad() {
+    defer {
+        super.viewDidLoad()
+        }
+    }
+}
+
+

Triggering Examples

+
class VC: UIViewController {
+    override func viewWillAppear(_ animated: Bool) {↓
+        //Not calling to super
+        self.method()
+    }
+}
+
+
class VC: UIViewController {
+    override func viewWillAppear(_ animated: Bool) {↓
+        super.viewWillAppear(animated)
+        //Other code
+        super.viewWillAppear(animated)
+    }
+}
+
+
class VC: UIViewController {
+    override func didReceiveMemoryWarning() {↓
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/override_in_extension.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/override_in_extension.html new file mode 100644 index 000000000..c2fd8368a --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/override_in_extension.html @@ -0,0 +1,404 @@ + + + + override_in_extension Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Override in Extension

+ +

Extensions shouldn’t override declarations

+ +
    +
  • Identifier: override_in_extension
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
extension Person {
+  var age: Int { return 42 }
+}
+
+
extension Person {
+  func celebrateBirthday() {}
+}
+
+
class Employee: Person {
+  override func celebrateBirthday() {}
+}
+
+
class Foo: NSObject {}
+extension Foo {
+    override var description: String { return "" }
+}
+
+
struct Foo {
+    class Bar: NSObject {}
+}
+extension Foo.Bar {
+    override var description: String { return "" }
+}
+
+

Triggering Examples

+
extension Person {
+  override ↓var age: Int { return 42 }
+}
+
+
extension Person {
+  override ↓func celebrateBirthday() {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/pattern_matching_keywords.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/pattern_matching_keywords.html new file mode 100644 index 000000000..5f33b5f0e --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/pattern_matching_keywords.html @@ -0,0 +1,464 @@ + + + + pattern_matching_keywords Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Pattern Matching Keywords

+ +

Combine multiple pattern matching bindings by moving keywords out of tuples

+ +
    +
  • Identifier: pattern_matching_keywords
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
switch foo {
+    default: break
+}
+
+
switch foo {
+    case 1: break
+}
+
+
switch foo {
+    case bar: break
+}
+
+
switch foo {
+    case let (x, y): break
+}
+
+
switch foo {
+    case .foo(let x): break
+}
+
+
switch foo {
+    case let .foo(x, y): break
+}
+
+
switch foo {
+    case .foo(let x), .bar(let x): break
+}
+
+
switch foo {
+    case .foo(let x, var y): break
+}
+
+
switch foo {
+    case var (x, y): break
+}
+
+
switch foo {
+    case .foo(var x): break
+}
+
+
switch foo {
+    case var .foo(x, y): break
+}
+
+
switch foo {
+    case (y, let x, z): break
+}
+
+

Triggering Examples

+
switch foo {
+    case (↓let x,  ↓let y): break
+}
+
+
switch foo {
+    case (↓let x,  ↓let y, .foo): break
+}
+
+
switch foo {
+    case (↓let x,  ↓let y, _): break
+}
+
+
switch foo {
+    case (↓let x,  ↓let y, f()): break
+}
+
+
switch foo {
+    case (↓let x,  ↓let y, s.f()): break
+}
+
+
switch foo {
+    case (↓let x,  ↓let y, s.t): break
+}
+
+
switch foo {
+    case .foo(↓let x, ↓let y): break
+}
+
+
switch foo {
+    case (.yamlParsing(↓let x), .yamlParsing(↓let y)): break
+}
+
+
switch foo {
+    case (↓var x,  ↓var y): break
+}
+
+
switch foo {
+    case .foo(↓var x, ↓var y): break
+}
+
+
switch foo {
+    case (.yamlParsing(↓var x), .yamlParsing(↓var y)): break
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/period_spacing.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/period_spacing.html new file mode 100644 index 000000000..cc2623b2d --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/period_spacing.html @@ -0,0 +1,405 @@ + + + + period_spacing Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Period Spacing

+ +

Periods should not be followed by more than one space

+ +
    +
  • Identifier: period_spacing
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let pi = 3.2
+
+
let pi = Double.pi
+
+
let pi = Double. pi
+
+
let pi = Double.  pi
+
+
// A. Single.
+
+
///   - code: Identifier of the error. Integer.
+
+
// value: Multiline.
+//        Comment.
+
+
/**
+Sentence ended in period.
+
+- Sentence 2 new line characters after.
+**/
+
+

Triggering Examples

+
/* Only god knows why. ↓ This symbol does nothing. */
+
+
// Only god knows why. ↓ This symbol does nothing.
+
+
// Single. Double. ↓ End.
+
+
// Single. Double. ↓ Triple. ↓  End.
+
+
// Triple. ↓  Quad. ↓   End.
+
+
///   - code: Identifier of the error. ↓ Integer.
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prefer_key_path.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prefer_key_path.html new file mode 100644 index 000000000..7f19d00b0 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prefer_key_path.html @@ -0,0 +1,497 @@ + + + + prefer_key_path Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Prefer Key Path

+ +

Use a key path argument instead of a closure with property access

+ +
    +
  • Identifier: prefer_key_path
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.2.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +restrict_to_standard_functions + +true +
  • +
+

Non Triggering Examples

+
f {}
+
+
f { $0 }
+
+
f { $0.a }
+
+
let f = { $0.a }(b)
+
+
//
+// restrict_to_standard_functions: false
+//
+
+f {}
+
+
+
//
+// restrict_to_standard_functions: false
+//
+
+f() { g() }
+
+
+
//
+// restrict_to_standard_functions: false
+//
+
+f { a.b.c }
+
+
+
//
+// restrict_to_standard_functions: false
+//
+
+f { a, b in a.b }
+
+
+
//
+// restrict_to_standard_functions: false
+//
+
+f { (a, b) in a.b }
+
+
+
//
+// restrict_to_standard_functions: false
+//
+
+f { $0.a } g: { $0.b }
+
+
+
//
+// restrict_to_standard_functions: false
+//
+
+[1, 2, 3].reduce(1) { $0 + $1 }
+
+
+
f.map(1) { $0.a }
+
+
f.filter({ $0.a }, x)
+
+
#Predicate { $0.a }
+
+
let transform: (Int) -> Int = nil ?? { $0.a }
+
+

Triggering Examples

+
f.map ↓{ $0.a }
+
+
f.filter ↓{ $0.a }
+
+
f.first ↓{ $0.a }
+
+
f.contains ↓{ $0.a }
+
+
f.contains(where: ↓{ $0.a })
+
+
//
+// restrict_to_standard_functions: false
+//
+
+f(↓{ $0.a })
+
+
+
//
+// restrict_to_standard_functions: false
+//
+
+f(a: ↓{ $0.b })
+
+
+
//
+// restrict_to_standard_functions: false
+//
+
+f(a: ↓{ a in a.b }, x)
+
+
+
f.map ↓{ a in a.b.c }
+
+
f.allSatisfy ↓{ (a: A) in a.b }
+
+
f.first ↓{ (a b: A) in b.c }
+
+
f.contains ↓{ $0.0.a }
+
+
f.compactMap ↓{ $0.a.b.c.d }
+
+
f.flatMap ↓{ $0.a.b }
+
+
//
+// restrict_to_standard_functions: false
+//
+
+let f: (Int) -> Int = ↓{ $0.bigEndian }
+
+
+
transform = ↓{ $0.a }
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prefer_nimble.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prefer_nimble.html new file mode 100644 index 000000000..48ec6a54b --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prefer_nimble.html @@ -0,0 +1,388 @@ + + + + prefer_nimble Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Prefer Nimble

+ +

Prefer Nimble matchers over XCTAssert functions

+ +
    +
  • Identifier: prefer_nimble
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
expect(foo) == 1
+
+
expect(foo).to(equal(1))
+
+

Triggering Examples

+
↓XCTAssertTrue(foo)
+
+
↓XCTAssertEqual(foo, 2)
+
+
↓XCTAssertNotEqual(foo, 2)
+
+
↓XCTAssertNil(foo)
+
+
↓XCTAssert(foo)
+
+
↓XCTAssertGreaterThan(foo, 10)
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prefer_self_in_static_references.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prefer_self_in_static_references.html new file mode 100644 index 000000000..f20e1bf58 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prefer_self_in_static_references.html @@ -0,0 +1,443 @@ + + + + prefer_self_in_static_references Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Prefer Self in Static References

+ +

Use Self to refer to the surrounding type name

+ +
    +
  • Identifier: prefer_self_in_static_references
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class C {
+    static let primes = [2, 3, 5, 7]
+    func isPrime(i: Int) -> Bool { Self.primes.contains(i) }
+
+
struct T {
+    static let i = 0
+}
+struct S {
+    static let i = 0
+}
+extension T {
+    static let j = S.i + T.i
+    static let k = { T.j }()
+}
+
+
class `Self` {
+    static let i = 0
+    func f() -> Int { Self.i }
+}
+
+

Triggering Examples

+
final class CheckCellView: NSTableCellView {
+    @IBOutlet var checkButton: NSButton!
+
+    override func awakeFromNib() {
+    checkButton.action = #selector(↓CheckCellView.check(_:))
+    }
+
+    @objc func check(_ button: AnyObject?) {}
+}
+
+
class C {
+    static let i = 1
+    var j: Int {
+        let ii = ↓C.i
+        return ii
+    }
+}
+
+
class C {
+    func f() {
+        _ = [↓C]()
+        _ = [Int: ↓C]()
+    }
+}
+
+
struct S {
+    let j: Int
+    static let i = 1
+    static func f() -> Int { ↓S.i }
+    func g() -> Any { ↓S.self }
+    func h() -> ↓S { ↓S(j: 2) }
+    func i() -> KeyPath<↓S, Int> { \↓S.j }
+    func j(@Wrap(-↓S.i, ↓S.i) n: Int = ↓S.i) {}
+}
+
+
struct S {
+    struct T {
+        static let i = 3
+    }
+    struct R {
+        static let j = S.T.i
+    }
+    static let h = ↓S.T.i + ↓S.R.j
+}
+
+
enum E {
+    case A
+    static func f() -> ↓E { ↓E.A }
+    static func g() -> ↓E { ↓E.f() }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prefer_self_type_over_type_of_self.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prefer_self_type_over_type_of_self.html new file mode 100644 index 000000000..7a6fcac9e --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prefer_self_type_over_type_of_self.html @@ -0,0 +1,414 @@ + + + + prefer_self_type_over_type_of_self Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Prefer Self Type Over Type of Self

+ +

Prefer Self over type(of: self) when accessing properties or calling methods

+ +
    +
  • Identifier: prefer_self_type_over_type_of_self
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.1.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class Foo {
+    func bar() {
+        Self.baz()
+    }
+}
+
+
class Foo {
+    func bar() {
+        print(Self.baz)
+    }
+}
+
+
class A {
+    func foo(param: B) {
+        type(of: param).bar()
+    }
+}
+
+
class A {
+    func foo() {
+        print(type(of: self))
+    }
+}
+
+

Triggering Examples

+
class Foo {
+    func bar() {
+        ↓type(of: self).baz()
+    }
+}
+
+
class Foo {
+    func bar() {
+        print(↓type(of: self).baz)
+    }
+}
+
+
class Foo {
+    func bar() {
+        print(↓Swift.type(of: self).baz)
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prefer_type_checking.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prefer_type_checking.html new file mode 100644 index 000000000..cfd1600ec --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prefer_type_checking.html @@ -0,0 +1,406 @@ + + + + prefer_type_checking Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Prefer Type Checking

+ +

Prefer a is X to a as? X != nil

+ +
    +
  • Identifier: prefer_type_checking
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let foo = bar as? Foo
+
+
bar is Foo
+
+
2*x is X
+
+
if foo is Bar {
+    doSomeThing()
+}
+
+
if let bar = foo as? Bar {
+    foo.run()
+}
+
+
bar as Foo != nil
+
+
nil != bar as Foo
+
+
bar as Foo? != nil
+
+
bar as? Foo? != nil
+
+

Triggering Examples

+
bar ↓as? Foo != nil
+
+
2*x as? X != nil
+
+
if foo ↓as? Bar != nil {
+    doSomeThing()
+}
+
+
nil != bar ↓as? Foo
+
+
nil != 2*x ↓as? X
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prefer_zero_over_explicit_init.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prefer_zero_over_explicit_init.html new file mode 100644 index 000000000..97cb01b68 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prefer_zero_over_explicit_init.html @@ -0,0 +1,396 @@ + + + + prefer_zero_over_explicit_init Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Prefer Zero Over Explicit Init

+ +

Prefer .zero over explicit init with zero parameters (e.g. CGPoint(x: 0, y: 0))

+ +
    +
  • Identifier: prefer_zero_over_explicit_init
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
CGRect(x: 0, y: 0, width: 0, height: 1)
+
+
CGPoint(x: 0, y: -1)
+
+
CGSize(width: 2, height: 4)
+
+
CGVector(dx: -5, dy: 0)
+
+
UIEdgeInsets(top: 0, left: 1, bottom: 0, right: 1)
+
+

Triggering Examples

+
↓CGPoint(x: 0, y: 0)
+
+
↓CGPoint(x: 0.000000, y: 0)
+
+
↓CGPoint(x: 0.000000, y: 0.000)
+
+
↓CGRect(x: 0, y: 0, width: 0, height: 0)
+
+
↓CGSize(width: 0, height: 0)
+
+
↓CGVector(dx: 0, dy: 0)
+
+
↓UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prefixed_toplevel_constant.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prefixed_toplevel_constant.html new file mode 100644 index 000000000..126578ee1 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prefixed_toplevel_constant.html @@ -0,0 +1,457 @@ + + + + prefixed_toplevel_constant Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Prefixed Top-Level Constant

+ +

Top-level constants should be prefixed by k

+ +
    +
  • Identifier: prefixed_toplevel_constant
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +only_private + +false +
  • +
+

Non Triggering Examples

+
private let kFoo = 20.0
+
+
public let kFoo = false
+
+
internal let kFoo = "Foo"
+
+
let kFoo = true
+
+
//
+// only_private: true
+//
+
+let Foo = true
+
+
+
struct Foo {
+    let bar = 20.0
+}
+
+
private var foo = 20.0
+
+
public var foo = false
+
+
internal var foo = "Foo"
+
+
var foo = true
+
+
var foo = true, bar = true
+
+
var foo = true, let kFoo = true
+
+
let
+    kFoo = true
+
+
var foo: Int {
+    return a + b
+}
+
+
let kFoo = {
+    return a + b
+}()
+
+
var foo: String {
+    let bar = ""
+    return bar
+}
+
+
if condition() {
+    let result = somethingElse()
+    print(result)
+    exit()
+}
+
+
[1, 2, 3, 1000, 4000].forEach { number in
+    let isSmall = number < 10
+    if isSmall {
+        print("\(number) is a small number")
+    }
+}
+
+

Triggering Examples

+
private let ↓Foo = 20.0
+
+
public let ↓Foo = false
+
+
internal let ↓Foo = "Foo"
+
+
let ↓Foo = true
+
+
let ↓foo = 2, ↓bar = true
+
+
let
+    ↓foo = true
+
+
let ↓foo = {
+    return a + b
+}()
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/private_action.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/private_action.html new file mode 100644 index 000000000..66bbad396 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/private_action.html @@ -0,0 +1,440 @@ + + + + private_action Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Private Actions

+ +

IBActions should be private

+ +
    +
  • Identifier: private_action
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class Foo {
+    @IBAction private func barButtonTapped(_ sender: UIButton) {}
+}
+
+
struct Foo {
+    @IBAction private func barButtonTapped(_ sender: UIButton) {}
+}
+
+
class Foo {
+    @IBAction fileprivate func barButtonTapped(_ sender: UIButton) {}
+}
+
+
struct Foo {
+    @IBAction fileprivate func barButtonTapped(_ sender: UIButton) {}
+}
+
+
private extension Foo {
+    @IBAction func barButtonTapped(_ sender: UIButton) {}
+}
+
+
fileprivate extension Foo {
+    @IBAction func barButtonTapped(_ sender: UIButton) {}
+}
+
+

Triggering Examples

+
class Foo {
+    @IBAction ↓func barButtonTapped(_ sender: UIButton) {}
+}
+
+
struct Foo {
+    @IBAction ↓func barButtonTapped(_ sender: UIButton) {}
+}
+
+
class Foo {
+    @IBAction public ↓func barButtonTapped(_ sender: UIButton) {}
+}
+
+
struct Foo {
+    @IBAction public ↓func barButtonTapped(_ sender: UIButton) {}
+}
+
+
class Foo {
+    @IBAction internal ↓func barButtonTapped(_ sender: UIButton) {}
+}
+
+
struct Foo {
+    @IBAction internal ↓func barButtonTapped(_ sender: UIButton) {}
+}
+
+
extension Foo {
+    @IBAction ↓func barButtonTapped(_ sender: UIButton) {}
+}
+
+
extension Foo {
+    @IBAction public ↓func barButtonTapped(_ sender: UIButton) {}
+}
+
+
extension Foo {
+    @IBAction internal ↓func barButtonTapped(_ sender: UIButton) {}
+}
+
+
public extension Foo {
+    @IBAction ↓func barButtonTapped(_ sender: UIButton) {}
+}
+
+
internal extension Foo {
+    @IBAction ↓func barButtonTapped(_ sender: UIButton) {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/private_outlet.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/private_outlet.html new file mode 100644 index 000000000..51572f188 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/private_outlet.html @@ -0,0 +1,435 @@ + + + + private_outlet Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Private Outlets

+ +

IBOutlets should be private to avoid leaking UIKit to higher layers

+ +
    +
  • Identifier: private_outlet
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +allow_private_set + +false +
  • +
+

Non Triggering Examples

+
class Foo { @IBOutlet private var label: UILabel? }
+
+
class Foo { @IBOutlet private var label: UILabel! }
+
+
class Foo { var notAnOutlet: UILabel }
+
+
class Foo { @IBOutlet weak private var label: UILabel? }
+
+
class Foo { @IBOutlet private weak var label: UILabel? }
+
+
class Foo { @IBOutlet fileprivate weak var label: UILabel? }
+
+
//
+// allow_private_set: true
+//
+
+class Foo { @IBOutlet private(set) var label: UILabel? }
+
+
+
//
+// allow_private_set: true
+//
+
+class Foo { @IBOutlet private(set) var label: UILabel! }
+
+
+
//
+// allow_private_set: true
+//
+
+class Foo { @IBOutlet weak private(set) var label: UILabel? }
+
+
+
//
+// allow_private_set: true
+//
+
+class Foo { @IBOutlet private(set) weak var label: UILabel? }
+
+
+
//
+// allow_private_set: true
+//
+
+class Foo { @IBOutlet fileprivate(set) weak var label: UILabel? }
+
+
+

Triggering Examples

+
class Foo { @IBOutlet ↓var label: UILabel? }
+
+
class Foo { @IBOutlet ↓var label: UILabel! }
+
+
class Foo { @IBOutlet private(set) ↓var label: UILabel? }
+
+
class Foo { @IBOutlet fileprivate(set) ↓var label: UILabel? }
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/private_over_fileprivate.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/private_over_fileprivate.html new file mode 100644 index 000000000..b3065b5c3 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/private_over_fileprivate.html @@ -0,0 +1,428 @@ + + + + private_over_fileprivate Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Private over Fileprivate

+ +

Prefer private over fileprivate declarations

+ +
    +
  • Identifier: private_over_fileprivate
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +validate_extensions + +false +
  • +
+

Non Triggering Examples

+
extension String {}
+
+
private extension String {}
+
+
public protocol P {}
+
+
open extension 
+ String {}
+
+
internal extension String {}
+
+
package typealias P = Int
+
+
extension String {
+  fileprivate func Something(){}
+}
+
+
class MyClass {
+  fileprivate let myInt = 4
+}
+
+
actor MyActor {
+  fileprivate let myInt = 4
+}
+
+
class MyClass {
+  fileprivate(set) var myInt = 4
+}
+
+
struct Outer {
+  struct Inter {
+    fileprivate struct Inner {}
+  }
+}
+
+

Triggering Examples

+
↓fileprivate enum MyEnum {}
+
+
↓fileprivate class MyClass {
+  fileprivate(set) var myInt = 4
+}
+
+
↓fileprivate actor MyActor {
+  fileprivate let myInt = 4
+}
+
+
    ↓fileprivate func f() {}
+    ↓fileprivate var x = 0
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/private_subject.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/private_subject.html new file mode 100644 index 000000000..1b89e77a7 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/private_subject.html @@ -0,0 +1,534 @@ + + + + private_subject Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Private Combine Subject

+ +

Combine Subject should be private

+ +
    +
  • Identifier: private_subject
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
final class Foobar {
+    private let goodSubject = PassthroughSubject<Bool, Never>()
+}
+
+
final class Foobar {
+    private let goodSubject: PassthroughSubject<Bool, Never>
+}
+
+
final class Foobar {
+    fileprivate let goodSubject: PassthroughSubject<Bool, Never>
+}
+
+
final class Foobar {
+    private let goodSubject: PassthroughSubject<Bool, Never> = .init()
+}
+
+
final class Foobar {
+    private let goodSubject = CurrentValueSubject<Bool, Never>(false)
+}
+
+
final class Foobar {
+    private let goodSubject: CurrentValueSubject<Bool, Never>
+}
+
+
final class Foobar {
+    fileprivate let goodSubject: CurrentValueSubject<String, Never>
+}
+
+
final class Foobar {
+    private let goodSubject: CurrentValueSubject<String, Never> = .init("toto")
+}
+
+
final class Foobar {
+    private let goodSubject = PassthroughSubject<Set<String>, Never>()
+}
+
+
final class Foobar {
+    private let goodSubject: PassthroughSubject<Set<String>, Never> = .init()
+}
+
+
final class Foobar {
+    private let goodSubject: CurrentValueSubject<Set<String>, Never> = .init([])
+}
+
+
final class Foobar {
+    private let goodSubject =
+        PassthroughSubject<Bool, Never>()
+}
+
+
final class Foobar {
+    private let goodSubject:
+        PassthroughSubject<Bool, Never> = .init()
+}
+
+
final class Foobar {
+    private let goodSubject =
+        CurrentValueSubject<Bool, Never>(true)
+}
+
+
final class Foobar {
+    private let goodSubject: CurrentValueSubject<Bool, Never>
+    init() {
+        let goodSubject = CurrentValueSubject<Bool, Never>(true)
+        self.goosSubject = goodSubject
+    }
+}
+
+
func foo() {
+    let goodSubject = PassthroughSubject<Bool, Never>(true)
+}
+
+

Triggering Examples

+
final class Foobar {
+    let ↓badSubject = PassthroughSubject<Bool, Never>()
+}
+
+
final class Foobar {
+    let ↓badSubject: PassthroughSubject<Bool, Never>
+}
+
+
final class Foobar {
+    private(set) let ↓badSubject: PassthroughSubject<Bool, Never>
+}
+
+
final class Foobar {
+    private(set) let ↓badSubject = PassthroughSubject<Bool, Never>()
+}
+
+
final class Foobar {
+    let goodSubject: PassthroughSubject<Bool, Never> = .init()
+}
+
+
final class Foobar {
+    private let goodSubject: PassthroughSubject<Bool, Never>
+    private(set) let ↓badSubject = PassthroughSubject<Bool, Never>()
+    private(set) let ↓anotherBadSubject = PassthroughSubject<Bool, Never>()
+}
+
+
final class Foobar {
+    private(set) let ↓badSubject = PassthroughSubject<Bool, Never>()
+    private let goodSubject: PassthroughSubject<Bool, Never>
+    private(set) let ↓anotherBadSubject = PassthroughSubject<Bool, Never>()
+}
+
+
final class Foobar {
+    let ↓badSubject = CurrentValueSubject<Bool, Never>(true)
+}
+
+
final class Foobar {
+    let ↓badSubject: CurrentValueSubject<Bool, Never>
+}
+
+
final class Foobar {
+    private(set) let ↓badSubject: CurrentValueSubject<Bool, Never>
+}
+
+
final class Foobar {
+    private(set) let ↓badSubject = CurrentValueSubject<Bool, Never>(false)
+}
+
+
final class Foobar {
+    let goodSubject: CurrentValueSubject<String, Never> = .init("toto")
+}
+
+
final class Foobar {
+    private let goodSubject: CurrentValueSubject<Bool, Never>
+    private(set) let ↓badSubject = CurrentValueSubject<Bool, Never>(false)
+    private(set) let ↓anotherBadSubject = CurrentValueSubject<Bool, Never>(false)
+}
+
+
final class Foobar {
+    private(set) let ↓badSubject = CurrentValueSubject<Bool, Never>(false)
+    private let goodSubject: CurrentValueSubject<Bool, Never>
+    private(set) let ↓anotherBadSubject = CurrentValueSubject<Bool, Never>(true)
+}
+
+
final class Foobar {
+    let ↓badSubject = PassthroughSubject<Set<String>, Never>()
+}
+
+
final class Foobar {
+    let ↓badSubject: PassthroughSubject<Set<String>, Never> = .init()
+}
+
+
final class Foobar {
+    let ↓badSubject: CurrentValueSubject<Set<String>, Never> = .init([])
+}
+
+
final class Foobar {
+    let ↓badSubject =
+        PassthroughSubject<Bool, Never>()
+}
+
+
final class Foobar {
+    let ↓badSubject:
+        PassthroughSubject<Bool, Never> = .init()
+}
+
+
final class Foobar {
+    let ↓badSubject =
+        CurrentValueSubject<Bool, Never>(true)
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/private_swiftui_state.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/private_swiftui_state.html new file mode 100644 index 000000000..e15342e6e --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/private_swiftui_state.html @@ -0,0 +1,524 @@ + + + + private_swiftui_state Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Private SwiftUI State Properties

+ +

SwiftUI state properties should be private

+ +
    +
  • Identifier: private_swiftui_state
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
struct MyApp: App {
+    @State private var isPlaying: Bool = false
+}
+
+
struct MyScene: Scene {
+    @State private var isPlaying: Bool = false
+}
+
+
struct CofntentView: View {
+    @State private var isPlaying: Bool = false
+}
+
+
struct ContentView: View {
+    @State private var isPlaying: Bool = false
+
+    struct InnerView: View {
+        @State private var showsIndicator: Bool = false
+    }
+}
+
+
struct MyStruct {
+    struct ContentView: View {
+        @State private var isPlaying: Bool = false
+    }
+}
+
+
struct MyStruct {
+    struct ContentView: View {
+        @State private var isPlaying: Bool = false
+    }
+
+    @State var nonTriggeringState: Bool = false
+}
+
+
struct ContentView: View {
+    var s: Int {
+        @State
+        var s: Int = 3
+        return s
+    }
+
+    var body: some View { Text("") }
+}
+
+
struct ContentView: View {
+    var isPlaying = false
+}
+
+
struct MyApp: App {
+    @StateObject private var model = DataModel()
+}
+
+
struct MyScene: Scene {
+    @StateObject private var model = DataModel()
+}
+
+
struct ContentView: View {
+    @StateObject private var model = DataModel()
+}
+
+
struct MyStruct {
+    struct ContentView: View {
+        @StateObject private var dataModel = DataModel()
+    }
+
+    @StateObject var nonTriggeringObject = MyModel()
+}
+
+
struct Foo {
+    @State var bar = false
+}
+
+
class Foo: ObservableObject {
+    @State var bar = Bar()
+}
+
+
extension MyObject {
+    struct ContentView: View {
+        @State private var isPlaying: Bool = false
+    }
+}
+
+
actor ContentView: View {
+    @State private var isPlaying: Bool = false
+}
+
+

Triggering Examples

+
struct MyApp: App {
+    @State ↓var isPlaying: Bool = false
+}
+
+
struct MyScene: Scene {
+    @State ↓public var isPlaying: Bool = false
+}
+
+
struct ContentView: View {
+    @State ↓var isPlaying: Bool = false
+}
+
+
struct ContentView: View {
+    struct InnerView: View {
+        @State private var showsIndicator: Bool = false
+    }
+
+    @State ↓var isPlaying: Bool = false
+}
+
+
struct MyStruct {
+    struct ContentView: View {
+        @State ↓var isPlaying: Bool = false
+    }
+}
+
+
struct MyStruct {
+    struct ContentView: View {
+        @State ↓var isPlaying: Bool = false
+    }
+
+    @State var isPlaying: Bool = false
+}
+
+
final class ContentView: View {
+    @State ↓var isPlaying: Bool = false
+}
+
+
extension MyObject {
+    struct ContentView: View {
+        @State ↓var isPlaying: Bool = false
+    }
+}
+
+
actor ContentView: View {
+    @State ↓var isPlaying: Bool = false
+}
+
+
struct MyApp: App {
+    @StateObject ↓var model = DataModel()
+}
+
+
struct MyScene: Scene {
+    @StateObject ↓var model = DataModel()
+}
+
+
struct ContentView: View {
+    @StateObject ↓var model = DataModel()
+}
+
+
struct ContentView: View {
+    @State ↓private(set) var isPlaying = false
+
+
struct ContentView: View {
+    @State ↓fileprivate(set) public var isPlaying = false
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/private_unit_test.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/private_unit_test.html new file mode 100644 index 000000000..97f749316 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/private_unit_test.html @@ -0,0 +1,451 @@ + + + + private_unit_test Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Private Unit Test

+ +

Unit tests marked private are silently skipped

+ +
    +
  • Identifier: private_unit_test
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +test_parent_classes + +[“QuickSpec”, “XCTestCase”] +
  • +
+

Non Triggering Examples

+
class FooTest: XCTestCase {
+    func test1() {}
+    internal func test2() {}
+    public func test3() {}
+}
+
+
internal class FooTest: XCTestCase {
+    func test1() {}
+    internal func test2() {}
+    public func test3() {}
+}
+
+
public class FooTest: XCTestCase {
+    func test1() {}
+    internal func test2() {}
+    public func test3() {}
+}
+
+
@objc private class FooTest: XCTestCase {
+    @objc private func test1() {}
+    internal func test2() {}
+    public func test3() {}
+}
+
+
private class Foo: NSObject {
+    func test1() {}
+    internal func test2() {}
+    public func test3() {}
+}
+
+
private class Foo {
+    func test1() {}
+    internal func test2() {}
+    public func test3() {}
+}
+
+
public class FooTest: XCTestCase {
+    private func test1(param: Int) {}
+    private func test2() -> String { "" }
+    private func atest() {}
+    private static func test3() {}
+}
+
+

Triggering Examples

+
private ↓class FooTest: XCTestCase {
+    func test1() {}
+    internal func test2() {}
+    public func test3() {}
+    private func test4() {}
+}
+
+
class FooTest: XCTestCase {
+    func test1() {}
+    internal func test2() {}
+    public func test3() {}
+    private ↓func test4() {}
+}
+
+
internal class FooTest: XCTestCase {
+    func test1() {}
+    internal func test2() {}
+    public func test3() {}
+    private ↓func test4() {}
+}
+
+
public class FooTest: XCTestCase {
+    func test1() {}
+    internal func test2() {}
+    public func test3() {}
+    private ↓func test4() {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prohibited_interface_builder.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prohibited_interface_builder.html new file mode 100644 index 000000000..ccf454750 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prohibited_interface_builder.html @@ -0,0 +1,388 @@ + + + + prohibited_interface_builder Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Prohibited Interface Builder

+ +

Creating views using Interface Builder should be avoided

+ +
    +
  • Identifier: prohibited_interface_builder
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class ViewController: UIViewController {
+    var label: UILabel!
+}
+
+
class ViewController: UIViewController {
+    @objc func buttonTapped(_ sender: UIButton) {}
+}
+
+

Triggering Examples

+
class ViewController: UIViewController {
+    @IBOutlet ↓var label: UILabel!
+}
+
+
class ViewController: UIViewController {
+    @IBAction ↓func buttonTapped(_ sender: UIButton) {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prohibited_super_call.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prohibited_super_call.html new file mode 100644 index 000000000..d244264c9 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/prohibited_super_call.html @@ -0,0 +1,437 @@ + + + + prohibited_super_call Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Prohibited Calls to Super

+ +

Some methods should not call super.

+ +
    +
  • Identifier: prohibited_super_call
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +excluded + +[] +
    +included + +[“*”] +
  • +
+

Non Triggering Examples

+
class VC: UIViewController {
+    override func loadView() {
+    }
+}
+
+
class NSView {
+    func updateLayer() {
+        self.method1()
+    }
+}
+
+
public class FileProviderExtension: NSFileProviderExtension {
+    override func providePlaceholder(at url: URL, completionHandler: @escaping (Error?) -> Void) {
+        guard let identifier = persistentIdentifierForItem(at: url) else {
+            completionHandler(NSFileProviderError(.noSuchItem))
+            return
+        }
+    }
+}
+
+

Triggering Examples

+
class VC: UIViewController {
+    override func loadView() {↓
+        super.loadView()
+    }
+}
+
+
class VC: NSFileProviderExtension {
+    override func providePlaceholder(at url: URL, completionHandler: @escaping (Error?) -> Void) {↓
+        self.method1()
+        super.providePlaceholder(at:url, completionHandler: completionHandler)
+    }
+}
+
+
class VC: NSView {
+    override func updateLayer() {↓
+        self.method1()
+        super.updateLayer()
+        self.method2()
+    }
+}
+
+
class VC: NSView {
+    override func updateLayer() {↓
+        defer {
+            super.updateLayer()
+        }
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/protocol_property_accessors_order.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/protocol_property_accessors_order.html new file mode 100644 index 000000000..2d1ccc560 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/protocol_property_accessors_order.html @@ -0,0 +1,388 @@ + + + + protocol_property_accessors_order Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Protocol Property Accessors Order

+ +

When declaring properties in protocols, the order of accessors should be get set

+ +
    +
  • Identifier: protocol_property_accessors_order
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
protocol Foo {
+ var bar: String { get set }
+ }
+
+
protocol Foo {
+ var bar: String { get }
+ }
+
+
protocol Foo {
+ var bar: String { set }
+ }
+
+

Triggering Examples

+
protocol Foo {
+ var bar: String { ↓set get }
+ }
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/quick_discouraged_call.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/quick_discouraged_call.html new file mode 100644 index 000000000..aafc4e9b8 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/quick_discouraged_call.html @@ -0,0 +1,664 @@ + + + + quick_discouraged_call Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Quick Discouraged Call

+ +

Discouraged call inside ‘describe’ and/or ‘context’ block.

+ +
    +
  • Identifier: quick_discouraged_call
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class TotoTests {
+   override func spec() {
+       describe("foo") {
+           let foo = Foo()
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           beforeEach {
+               let foo = Foo()
+               foo.toto()
+           }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           beforeEach {
+               let foo = Foo()
+               foo.toto()
+           }
+           afterEach {
+               let foo = Foo()
+               foo.toto()
+           }
+           describe("bar") {
+           }
+           context("bar") {
+           }
+           it("bar") {
+               let foo = Foo()
+               foo.toto()
+           }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           justBeforeEach {
+               let foo = Foo()
+               foo.toto()
+           }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           aroundEach {
+               let foo = Foo()
+               foo.toto()
+           }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+          itBehavesLike("bar")
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           it("does something") {
+               let foo = Foo()
+               foo.toto()
+           }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       context("foo") {
+           afterEach { toto.append(foo) }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       xcontext("foo") {
+           afterEach { toto.append(foo) }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       xdescribe("foo") {
+           afterEach { toto.append(foo) }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           xit("does something") {
+               let foo = Foo()
+               foo.toto()
+           }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       fcontext("foo") {
+           afterEach { toto.append(foo) }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       fdescribe("foo") {
+           afterEach { toto.append(foo) }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           fit("does something") {
+               let foo = Foo()
+               foo.toto()
+           }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       fitBehavesLike("foo")
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       xitBehavesLike("foo")
+   }
+}
+
+

Triggering Examples

+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           let foo = ↓Foo()
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override static func spec() {
+       describe("foo") {
+           let foo = ↓Foo()
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           let foo = ↓Foo()
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           context("foo") {
+               let foo = ↓Foo()
+           }
+           context("bar") {
+               let foo = ↓Foo()
+               ↓foo.bar()
+               it("does something") {
+                   let foo = Foo()
+                   foo.toto()
+               }
+           }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           context("foo") {
+               context("foo") {
+                   beforeEach {
+                       let foo = Foo()
+                       foo.toto()
+                   }
+                   it("bar") {
+                   }
+                   context("foo") {
+                       let foo = ↓Foo()
+                   }
+               }
+           }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       context("foo") {
+           let foo = ↓Foo()
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       sharedExamples("foo") {
+           let foo = ↓Foo()
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           ↓foo()
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       context("foo") {
+           ↓foo()
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       sharedExamples("foo") {
+           ↓foo()
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       xdescribe("foo") {
+           let foo = ↓Foo()
+       }
+       fdescribe("foo") {
+           let foo = ↓Foo()
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       xcontext("foo") {
+           let foo = ↓Foo()
+       }
+       fcontext("foo") {
+           let foo = ↓Foo()
+       }
+   }
+}
+
+
class TotoTests: QuickSpecSubclass {
+   override func spec() {
+       xcontext("foo") {
+           let foo = ↓Foo()
+       }
+       fcontext("foo") {
+           let foo = ↓Foo()
+       }
+   }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/quick_discouraged_focused_test.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/quick_discouraged_focused_test.html new file mode 100644 index 000000000..cefb450d2 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/quick_discouraged_focused_test.html @@ -0,0 +1,441 @@ + + + + quick_discouraged_focused_test Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Quick Discouraged Focused Test

+ +

Non-focused tests won’t run as long as this test is focused

+ +
    +
  • Identifier: quick_discouraged_focused_test
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           describe("bar") { }
+           context("bar") {
+               it("bar") { }
+           }
+           it("bar") { }
+           itBehavesLike("bar")
+       }
+   }
+}
+
+

Triggering Examples

+
class TotoTests: QuickSpec {
+   override func spec() {
+       ↓fdescribe("foo") { }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       ↓fcontext("foo") { }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       ↓fit("foo") { }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           ↓fit("bar") { }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       context("foo") {
+           ↓fit("bar") { }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           context("bar") {
+               ↓fit("toto") { }
+           }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       ↓fitBehavesLike("foo")
+   }
+}
+
+
class TotoTests: QuickSpecSubclass {
+   override func spec() {
+       ↓fitBehavesLike("foo")
+   }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/quick_discouraged_pending_test.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/quick_discouraged_pending_test.html new file mode 100644 index 000000000..961f61e10 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/quick_discouraged_pending_test.html @@ -0,0 +1,447 @@ + + + + quick_discouraged_pending_test Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Quick Discouraged Pending Test

+ +

This test won’t run as long as it’s marked pending

+ +
    +
  • Identifier: quick_discouraged_pending_test
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           describe("bar") { }
+           context("bar") {
+               it("bar") { }
+           }
+           it("bar") { }
+           itBehavesLike("bar")
+       }
+   }
+}
+
+

Triggering Examples

+
class TotoTests: QuickSpec {
+   override func spec() {
+       ↓xdescribe("foo") { }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       ↓xcontext("foo") { }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       ↓xit("foo") { }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           ↓xit("bar") { }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       context("foo") {
+           ↓xit("bar") { }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           context("bar") {
+               ↓xit("toto") { }
+           }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       ↓pending("foo")
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       ↓xitBehavesLike("foo")
+   }
+}
+
+
class TotoTests: QuickSpecSubclass {
+   override func spec() {
+       ↓xitBehavesLike("foo")
+   }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/raw_value_for_camel_cased_codable_enum.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/raw_value_for_camel_cased_codable_enum.html new file mode 100644 index 000000000..d18abb932 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/raw_value_for_camel_cased_codable_enum.html @@ -0,0 +1,437 @@ + + + + raw_value_for_camel_cased_codable_enum Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Raw Value for Camel Cased Codable Enum

+ +

Camel cased cases of Codable String enums should have raw values

+ +
    +
  • Identifier: raw_value_for_camel_cased_codable_enum
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
enum Numbers: Codable {
+  case int(Int)
+  case short(Int16)
+}
+
+
enum Numbers: Int, Codable {
+  case one = 1
+  case two = 2
+}
+
+
enum Numbers: Double, Codable {
+  case one = 1.1
+  case two = 2.2
+}
+
+
enum Numbers: String, Codable {
+  case one = "one"
+  case two = "two"
+}
+
+
enum Status: String, Codable {
+    case OK, ACCEPTABLE
+}
+
+
enum Status: String, Codable {
+    case ok
+    case maybeAcceptable = "maybe_acceptable"
+}
+
+
enum Status: String {
+    case ok
+    case notAcceptable
+    case maybeAcceptable = "maybe_acceptable"
+}
+
+
enum Status: Int, Codable {
+    case ok
+    case notAcceptable
+    case maybeAcceptable = -1
+}
+
+

Triggering Examples

+
enum Status: String, Codable {
+    case ok
+    case ↓notAcceptable
+    case maybeAcceptable = "maybe_acceptable"
+}
+
+
enum Status: String, Decodable {
+   case ok
+   case ↓notAcceptable
+   case maybeAcceptable = "maybe_acceptable"
+}
+
+
enum Status: String, Encodable {
+   case ok
+   case ↓notAcceptable
+   case maybeAcceptable = "maybe_acceptable"
+}
+
+
enum Status: String, Codable {
+    case ok
+    case ↓notAcceptable
+    case maybeAcceptable = "maybe_acceptable"
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/reduce_boolean.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/reduce_boolean.html new file mode 100644 index 000000000..5290d6e8b --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/reduce_boolean.html @@ -0,0 +1,396 @@ + + + + reduce_boolean Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Reduce Boolean

+ +

Prefer using .allSatisfy() or .contains() over reduce(true) or reduce(false).

+ +
    +
  • Identifier: reduce_boolean
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
nums.reduce(0) { $0.0 + $0.1 }
+
+
nums.reduce(0.0) { $0.0 + $0.1 }
+
+
nums.reduce(initial: true) { $0.0 && $0.1 == 3 }
+
+

Triggering Examples

+
let allNines = nums.↓reduce(true) { $0.0 && $0.1 == 9 }
+
+
let anyNines = nums.↓reduce(false) { $0.0 || $0.1 == 9 }
+
+
let allValid = validators.↓reduce(true) { $0 && $1(input) }
+
+
let anyValid = validators.↓reduce(false) { $0 || $1(input) }
+
+
let allNines = nums.↓reduce(true, { $0.0 && $0.1 == 9 })
+
+
let anyNines = nums.↓reduce(false, { $0.0 || $0.1 == 9 })
+
+
let allValid = validators.↓reduce(true, { $0 && $1(input) })
+
+
let anyValid = validators.↓reduce(false, { $0 || $1(input) })
+
+
nums.reduce(into: true) { (r: inout Bool, s) in r = r && (s == 3) }
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/reduce_into.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/reduce_into.html new file mode 100644 index 000000000..437a435bf --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/reduce_into.html @@ -0,0 +1,447 @@ + + + + reduce_into Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Reduce into

+ +

Prefer reduce(into:_:) over reduce(_:_:) for copy-on-write types

+ +
    +
  • Identifier: reduce_into
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let foo = values.reduce(into: "abc") { $0 += "\($1)" }
+
+
values.reduce(into: Array<Int>()) { result, value in
+    result.append(value)
+}
+
+
let rows = violations.enumerated().reduce(into: "") { rows, indexAndViolation in
+    rows.append(generateSingleRow(for: indexAndViolation.1, at: indexAndViolation.0 + 1))
+}
+
+
zip(group, group.dropFirst()).reduce(into: []) { result, pair in
+    result.append(pair.0 + pair.1)
+}
+
+
let foo = values.reduce(into: [String: Int]()) { result, value in
+    result["\(value)"] = value
+}
+
+
let foo = values.reduce(into: Dictionary<String, Int>.init()) { result, value in
+    result["\(value)"] = value
+}
+
+
let foo = values.reduce(into: [Int](repeating: 0, count: 10)) { result, value in
+    result.append(value)
+}
+
+
let foo = values.reduce(MyClass()) { result, value in
+    result.handleValue(value)
+    return result
+}
+
+

Triggering Examples

+
let bar = values.↓reduce("abc") { $0 + "\($1)" }
+
+
values.↓reduce(Array<Int>()) { result, value in
+    result += [value]
+}
+
+
[1, 2, 3].↓reduce(Set<Int>()) { acc, value in
+    var result = acc
+    result.insert(value)
+    return result
+}
+
+
let rows = violations.enumerated().↓reduce("") { rows, indexAndViolation in
+    return rows + generateSingleRow(for: indexAndViolation.1, at: indexAndViolation.0 + 1)
+}
+
+
zip(group, group.dropFirst()).↓reduce([]) { result, pair in
+    result + [pair.0 + pair.1]
+}
+
+
let foo = values.↓reduce([String: Int]()) { result, value in
+    var result = result
+    result["\(value)"] = value
+    return result
+}
+
+
let bar = values.↓reduce(Dictionary<String, Int>.init()) { result, value in
+    var result = result
+    result["\(value)"] = value
+    return result
+}
+
+
let bar = values.↓reduce([Int](repeating: 0, count: 10)) { result, value in
+    return result + [value]
+}
+
+
extension Data {
+    var hexString: String {
+        return ↓reduce("") { (output, byte) -> String in
+            output + String(format: "%02x", byte)
+        }
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_discardable_let.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_discardable_let.html new file mode 100644 index 000000000..702e888ed --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_discardable_let.html @@ -0,0 +1,411 @@ + + + + redundant_discardable_let Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Redundant Discardable Let

+ +

Prefer _ = foo() over let _ = foo() when discarding a result from a function

+ +
    +
  • Identifier: redundant_discardable_let
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +ignore_swiftui_view_bodies + +false +
  • +
+

Non Triggering Examples

+
_ = foo()
+
+
if let _ = foo() { }
+
+
guard let _ = foo() else { return }
+
+
let _: ExplicitType = foo()
+
+
while let _ = SplashStyle(rawValue: maxValue) { maxValue += 1 }
+
+
async let _ = await foo()
+
+
//
+// ignore_swiftui_view_bodies: true
+//
+
+var body: some View {
+    let _ = foo()
+    return Text("Hello, World!")
+}
+
+
+

Triggering Examples

+
↓let _ = foo()
+
+
if _ = foo() { ↓let _ = bar() }
+
+
var body: some View {
+    ↓let _ = foo()
+    Text("Hello, World!")
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_nil_coalescing.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_nil_coalescing.html new file mode 100644 index 000000000..196f138b0 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_nil_coalescing.html @@ -0,0 +1,376 @@ + + + + redundant_nil_coalescing Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Redundant Nil Coalescing

+ +

nil coalescing operator is only evaluated if the lhs is nil, coalescing operator with nil as rhs is redundant

+ +
    +
  • Identifier: redundant_nil_coalescing
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
var myVar: Int?; myVar ?? 0
+
+

Triggering Examples

+
var myVar: Int? = nil; myVar ↓?? nil
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_objc_attribute.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_objc_attribute.html new file mode 100644 index 000000000..c28159db9 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_objc_attribute.html @@ -0,0 +1,562 @@ + + + + redundant_objc_attribute Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Redundant @objc Attribute

+ +

Objective-C attribute (@objc) is redundant in declaration

+ +
    +
  • Identifier: redundant_objc_attribute
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
@objc private var foo: String? {}
+
+
@IBInspectable private var foo: String? {}
+
+
@objc private func foo(_ sender: Any) {}
+
+
@IBAction private func foo(_ sender: Any) {}
+
+
@GKInspectable private var foo: String! {}
+
+
private @GKInspectable var foo: String! {}
+
+
@NSManaged var foo: String!
+
+
@objc @NSCopying var foo: String!
+
+
@objcMembers
+class Foo {
+    var bar: Any?
+    @objc
+    class Bar: NSObject {
+        @objc
+        var foo: Any?
+    }
+}
+
+
@objc
+extension Foo {
+    var bar: Int {
+        return 0
+    }
+}
+
+
extension Foo {
+    @objc
+    var bar: Int { return 0 }
+}
+
+
@objc @IBDesignable
+extension Foo {
+    var bar: Int { return 0 }
+}
+
+
@IBDesignable
+extension Foo {
+    @objc
+    var bar: Int { return 0 }
+    var fooBar: Int { return 1 }
+}
+
+
@objcMembers
+class Foo: NSObject {
+    @objc
+    private var bar: Int {
+        return 0
+    }
+}
+
+
@objcMembers
+class Foo {
+    @objc
+    class Bar: NSObject {
+        @objc var foo: Any?
+    }
+}
+
+
@objcMembers
+class Foo: NSObject {
+    @objc class Bar {}
+}
+
+
extension BlockEditorSettings {
+    @objc(addElementsObject:)
+    @NSManaged public func addToElements(_ value: BlockEditorSettingElement)
+}
+
+
@objcMembers
+public class Foo: NSObject {
+    @objc
+    private func handler(_ notification: Notification) {
+    }
+
+    func registerForNotifications() {
+        NotificationCenter.default.addObserver(self, selector: #selector(handler(_:)), name: nil, object: nil)
+    }
+}
+
+
class Foo: NSObject { }
+
+@objc extension Foo {
+    @objc enum Bar: Int {
+       case bar
+    }
+
+    var bar: Bar { .bar }
+}
+
+
class Foo: NSObject { }
+
+@objc extension Foo {
+    @objc private enum Baz: Int {
+      case baz
+    }
+
+    private var baz: Baz { .baz }
+}
+
+
@objcMembers
+internal class Foo: NSObject {
+    @objc
+    private var baz: Int = 1
+
+    var x: Any? {
+        value(forKey: "baz")
+    }
+}
+
+
@objcMembers
+class Foo: NSObject {
+    @objc enum Bar: Int {
+       case bar
+    }
+}
+
+

Triggering Examples

+
↓@objc @IBInspectable private var foo: String? {}
+
+
@IBInspectable ↓@objc private var foo: String? {}
+
+
↓@objc @IBAction private func foo(_ sender: Any) {}
+
+
@IBAction ↓@objc private func foo(_ sender: Any) {}
+
+
↓@objc @GKInspectable private var foo: String! {}
+
+
@GKInspectable ↓@objc private var foo: String! {}
+
+
↓@objc @NSManaged private var foo: String!
+
+
@NSManaged ↓@objc private var foo: String!
+
+
↓@objc @IBDesignable class Foo {}
+
+
@objcMembers
+class Foo: NSObject {
+    ↓@objc var bar: Any?
+}
+
+
@objcMembers
+class Foo: NSObject {
+    ↓@objc var bar: Any?
+    ↓@objc var foo: Any?
+    @objc
+    class Bar {
+        @objc
+        var foo: Any?
+    }
+}
+
+
@objc
+extension Foo {
+    ↓@objc
+    var bar: Int {
+        return 0
+    }
+}
+
+
@objc @IBDesignable
+extension Foo {
+    ↓@objc
+    var bar: Int {
+        return 0
+    }
+}
+
+
@objcMembers
+class Foo: NSObject {
+    @objcMembers
+    class Bar: NSObject {
+        ↓@objc var foo: Any
+    }
+}
+
+
@objc
+extension Foo {
+    ↓@objc
+    private var bar: Int {
+        return 0
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_optional_initialization.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_optional_initialization.html new file mode 100644 index 000000000..e92f7a198 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_optional_initialization.html @@ -0,0 +1,423 @@ + + + + redundant_optional_initialization Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Redundant Optional Initialization

+ +

Initializing an optional variable with nil is redundant

+ +
    +
  • Identifier: redundant_optional_initialization
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
var myVar: Int?
+
+
let myVar: Int? = nil
+
+
var myVar: Int? = 0
+
+
func foo(bar: Int? = 0) { }
+
+
var myVar: Optional<Int>
+
+
let myVar: Optional<Int> = nil
+
+
var myVar: Optional<Int> = 0
+
+
var foo: Int? {
+  if bar != nil { }
+  return 0
+}
+
+
var foo: Int? = {
+  if bar != nil { }
+  return 0
+}()
+
+
lazy var test: Int? = nil
+
+
func funcName() {
+  var myVar: String?
+}
+
+
func funcName() {
+  let myVar: String? = nil
+}
+
+

Triggering Examples

+
var myVar: Int?↓ = nil
+
+
var myVar: Optional<Int>↓ = nil
+
+
var myVar: Int?↓=nil
+
+
var myVar: Optional<Int>↓=nil
+)
+
+
var myVar: String?↓ = nil {
+  didSet { print("didSet") }
+}
+
+
func funcName() {
+    var myVar: String?↓ = nil
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_self_in_closure.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_self_in_closure.html new file mode 100644 index 000000000..c0eeec369 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_self_in_closure.html @@ -0,0 +1,541 @@ + + + + redundant_self_in_closure Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Redundant Self in Closure

+ +

Explicit use of ‘self’ is not required

+ +
    +
  • Identifier: redundant_self_in_closure
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
struct S {
+    var x = 0
+    func f(_ work: @escaping () -> Void) { work() }
+    func g() {
+        f {
+            x = 1
+            f { x = 1 }
+            g()
+        }
+    }
+}
+
+
class C {
+    var x = 0
+    func f(_ work: @escaping () -> Void) { work() }
+    func g() {
+        f { [weak self] in
+            self?.x = 1
+            self?.g()
+            guard let self = self ?? C() else { return }
+            self?.x = 1
+        }
+        C().f { self.x = 1 }
+        f { [weak self] in if let self { x = 1 } }
+    }
+}
+
+
struct S {
+    var x = 0, error = 0, exception = 0
+    var y: Int?, z: Int?, u: Int, v: Int?, w: Int?
+    func f(_ work: @escaping (Int) -> Void) { work() }
+    func g(x: Int) {
+        f { u in
+            self.x = x
+            let x = 1
+            self.x = 2
+            if let y, let v {
+                self.y = 3
+                self.v = 1
+            }
+            guard let z else {
+                let v = 4
+                self.x = 5
+                self.v = 6
+                return
+            }
+            self.z = 7
+            while let v { self.v = 8 }
+            for w in [Int]() { self.w = 9 }
+            self.u = u
+            do {} catch { self.error = 10 }
+            do {} catch let exception { self.exception = 11 }
+        }
+    }
+}
+
+
enum E {
+    case a(Int)
+    case b(Int, Int)
+}
+struct S {
+    var x: E = .a(3), y: Int, z: Int
+    func f(_ work: @escaping () -> Void) { work() }
+    func g(x: Int) {
+        f {
+            switch x {
+            case let .a(y):
+                self.y = 1
+            case .b(let y, var z):
+                self.y = 2
+                self.z = 3
+            }
+        }
+    }
+}
+
+

Triggering Examples

+
struct S {
+    var x = 0
+    func f(_ work: @escaping () -> Void) { work() }
+    func g() {
+        f {
+            ↓self.x = 1
+            if ↓self.x == 1 { ↓self.g() }
+        }
+    }
+}
+
+
class C {
+    var x = 0
+    func g() {
+        {
+            ↓self.x = 1
+            ↓self.g()
+        }()
+    }
+}
+
+
class C {
+    var x = 0
+    func f(_ work: @escaping () -> Void) { work() }
+    func g() {
+        f { [self] in
+            ↓self.x = 1
+            ↓self.g()
+            f { self.x = 1 }
+        }
+    }
+}
+
+
class C {
+    var x = 0
+    func f(_ work: @escaping () -> Void) { work() }
+    func g() {
+        f { [unowned self] in ↓self.x = 1 }
+        f { [self = self] in ↓self.x = 1 }
+        f { [s = self] in s.x = 1 }
+    }
+}
+
+
struct S {
+    var x = 0
+    var y: Int?, z: Int?, v: Int?, w: Int?
+    func f(_ work: @escaping () -> Void) { work() }
+    func g(w: Int, _ v: Int) {
+        f {
+            self.w = 1
+            ↓self.x = 2
+            if let y { ↓self.x = 3 }
+            else { ↓self.y = 3 }
+            guard let z else {
+                ↓self.z = 4
+                ↓self.x = 5
+                return
+            }
+            ↓self.y = 6
+            while let y { ↓self.x = 7 }
+            for y in [Int]() { ↓self.x = 8 }
+            self.v = 9
+            do {
+                let x = 10
+                self.x = 11
+            }
+            ↓self.x = 12
+        }
+    }
+}
+
+
class C {
+    var x = 0
+    func f(_ work: @escaping () -> Void) { work() }
+    func g() {
+        f { [weak self] in
+            self?.x = 1
+            guard let self else { return }
+            ↓self.x = 1
+        }
+        f { [weak self] in
+            self?.x = 1
+            if let self = self else { ↓self.x = 1 }
+            self?.x = 1
+        }
+        f { [weak self] in
+            self?.x = 1
+            while let self else { ↓self.x = 1 }
+            self?.x = 1
+        }
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_sendable.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_sendable.html new file mode 100644 index 000000000..3df730895 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_sendable.html @@ -0,0 +1,401 @@ + + + + redundant_sendable Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Redundant Sendable

+ +

Sendable conformance is redundant on an actor-isolated type

+ +
    +
  • Identifier: redundant_sendable
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +global_actors + +[] +
  • +
+

Non Triggering Examples

+
struct S: Sendable {}
+
+
class C: Sendable {}
+
+
actor A {}
+
+
@MainActor struct S {}
+
+
@MyActor enum E: Sendable { case a }
+
+

Triggering Examples

+
@MainActor struct ↓S: Sendable {}
+
+
actor ↓A: Sendable {}
+
+
//
+// global_actors: ["MyActor"]
+//
+
+@MyActor enum ↓E: Sendable { case a }
+
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_set_access_control.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_set_access_control.html new file mode 100644 index 000000000..0a49bcd47 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_set_access_control.html @@ -0,0 +1,412 @@ + + + + redundant_set_access_control Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Redundant Access Control for Setter

+ +

Property setter access level shouldn’t be explicit if it’s the same as the variable access level

+ +
    +
  • Identifier: redundant_set_access_control
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
private(set) public var foo: Int
+
+
public let foo: Int
+
+
public var foo: Int
+
+
var foo: Int
+
+
private final class A {
+  private(set) var value: Int
+}
+
+
extension Color {
+    public internal(set) static var someColor = Color.anotherColor
+}
+
+

Triggering Examples

+
↓private(set) private var foo: Int
+
+
↓fileprivate(set) fileprivate var foo: Int
+
+
↓internal(set) internal var foo: Int
+
+
↓public(set) public var foo: Int
+
+
open class Foo {
+  ↓open(set) open var bar: Int
+}
+
+
class A {
+  ↓internal(set) var value: Int
+}
+
+
internal class A {
+  ↓internal(set) var value: Int
+}
+
+
fileprivate class A {
+  ↓fileprivate(set) var value: Int
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_string_enum_value.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_string_enum_value.html new file mode 100644 index 000000000..3d4181862 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_string_enum_value.html @@ -0,0 +1,409 @@ + + + + redundant_string_enum_value Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Redundant String Enum Value

+ +

String enum values can be omitted when they are equal to the enumcase name

+ +
    +
  • Identifier: redundant_string_enum_value
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
enum Numbers: String {
+  case one
+  case two
+}
+
+
enum Numbers: Int {
+  case one = 1
+  case two = 2
+}
+
+
enum Numbers: String {
+  case one = "ONE"
+  case two = "TWO"
+}
+
+
enum Numbers: String {
+  case one = "ONE"
+  case two = "two"
+}
+
+
enum Numbers: String {
+  case one, two
+}
+
+

Triggering Examples

+
enum Numbers: String {
+  case one = ↓"one"
+  case two = ↓"two"
+}
+
+
enum Numbers: String {
+  case one = ↓"one", two = ↓"two"
+}
+
+
enum Numbers: String {
+  case one, two = ↓"two"
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_type_annotation.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_type_annotation.html new file mode 100644 index 000000000..a413c655c --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_type_annotation.html @@ -0,0 +1,601 @@ + + + + redundant_type_annotation Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Redundant Type Annotation

+ +

Variables should not have redundant type annotation

+ +
    +
  • Identifier: redundant_type_annotation
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +ignore_attributes + +[“IBInspectable”] +
    +ignore_properties + +false +
    +consider_default_literal_types_redundant + +false +
  • +
+

Non Triggering Examples

+
var url = URL()
+
+
var url: CustomStringConvertible = URL()
+
+
var one: Int = 1, two: Int = 2, three: Int
+
+
guard let url = URL() else { return }
+
+
if let url = URL() { return }
+
+
let alphanumerics = CharacterSet.alphanumerics
+
+
var set: Set<Int> = Set([])
+
+
var set: Set<Int> = Set.init([])
+
+
var set = Set<Int>([])
+
+
var set = Set<Int>.init([])
+
+
guard var set: Set<Int> = Set([]) else { return }
+
+
if var set: Set<Int> = Set.init([]) { return }
+
+
guard var set = Set<Int>([]) else { return }
+
+
if var set = Set<Int>.init([]) { return }
+
+
var one: A<T> = B()
+
+
var one: A = B<T>()
+
+
var one: A<T> = B<T>()
+
+
let a = A.b.c.d
+
+
let a: B = A.b.c.d
+
+
enum Direction {
+    case up
+    case down
+}
+
+var direction: Direction = .up
+
+
enum Direction {
+    case up
+    case down
+}
+
+var direction = Direction.up
+
+
//
+// ignore_attributes: ["IgnoreMe"]
+//
+
+@IgnoreMe var a: Int = Int(5)
+
+
+
//
+// ignore_attributes: ["IgnoreMe"]
+//
+
+var a: Int {
+    @IgnoreMe let i: Int = Int(1)
+    return i
+}
+
+
+
var bol: Bool = true
+
+
var dbl: Double = 0.0
+
+
var int: Int = 0
+
+
var str: String = "str"
+
+
//
+// ignore_properties: true
+//
+
+struct Foo {
+    var url: URL = URL()
+    let myVar: Int? = 0, s: String = ""
+}
+
+
+

Triggering Examples

+
var url↓:URL=URL()
+
+
var url↓:URL = URL(string: "")
+
+
var url↓: URL = URL()
+
+
let url↓: URL = URL()
+
+
lazy var url↓: URL = URL()
+
+
let url↓: URL = URL()!
+
+
var one: Int = 1, two↓: Int = Int(5), three: Int
+
+
guard let url↓: URL = URL() else { return }
+
+
if let url↓: URL = URL() { return }
+
+
let alphanumerics↓: CharacterSet = CharacterSet.alphanumerics
+
+
var set↓: Set<Int> = Set<Int>([])
+
+
var set↓: Set<Int> = Set<Int>.init([])
+
+
var set↓: Set = Set<Int>([])
+
+
var set↓: Set = Set<Int>.init([])
+
+
guard var set↓: Set = Set<Int>([]) else { return }
+
+
if var set↓: Set = Set<Int>.init([]) { return }
+
+
guard var set↓: Set<Int> = Set<Int>([]) else { return }
+
+
if var set↓: Set<Int> = Set<Int>.init([]) { return }
+
+
var set↓: Set = Set<Int>([]), otherSet: Set<Int>
+
+
var num↓: Int = Int.random(0..<10)
+
+
let a↓: A = A.b.c.d
+
+
let a↓: A = A.f().b
+
+
class ViewController: UIViewController {
+  func someMethod() {
+    let myVar↓: Int = Int(5)
+  }
+}
+
+
//
+// ignore_properties: true
+//
+
+class ViewController: UIViewController {
+  func someMethod() {
+    let myVar↓: Int = Int(5)
+  }
+}
+
+
+
let a↓: [Int] = [Int]()
+
+
let a↓: A.B = A.B()
+
+
enum Direction {
+    case up
+    case down
+}
+
+var direction↓: Direction = Direction.up
+
+
//
+// ignore_attributes: ["IgnoreMe"]
+//
+
+@DontIgnoreMe var a↓: Int = Int(5)
+
+
+
//
+// ignore_attributes: ["IgnoreMe"]
+//
+
+@IgnoreMe
+var a: Int {
+    let i↓: Int = Int(1)
+    return i
+}
+
+
+
//
+// consider_default_literal_types_redundant: true
+//
+
+var bol↓: Bool = true
+
+
+
//
+// consider_default_literal_types_redundant: true
+//
+
+var dbl↓: Double = 0.0
+
+
+
//
+// consider_default_literal_types_redundant: true
+//
+
+var int↓: Int = 0
+
+
+
//
+// consider_default_literal_types_redundant: true
+//
+
+var str↓: String = "str"
+
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_void_return.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_void_return.html new file mode 100644 index 000000000..028a7efa4 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/redundant_void_return.html @@ -0,0 +1,439 @@ + + + + redundant_void_return Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Redundant Void Return

+ +

Returning Void in a function declaration is redundant

+ +
    +
  • Identifier: redundant_void_return
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +include_closures + +true +
  • +
+

Non Triggering Examples

+
func foo() {}
+
+
func foo() -> Int {}
+
+
func foo() -> Int -> Void {}
+
+
func foo() -> VoidResponse
+
+
let foo: (Int) -> Void
+
+
func foo() -> Int -> () {}
+
+
let foo: (Int) -> ()
+
+
func foo() -> ()?
+
+
func foo() -> ()!
+
+
func foo() -> Void?
+
+
func foo() -> Void!
+
+
struct A {
+    subscript(key: String) {
+        print(key)
+    }
+}
+
+
//
+// include_closures: false
+//
+
+doSomething { arg -> Void in
+    print(arg)
+}
+
+
+

Triggering Examples

+
func foo()↓ -> Void {}
+
+
protocol Foo {
+  func foo()↓ -> Void
+}
+
+
func foo()↓ -> () {}
+
+
func foo()↓ -> ( ) {}
+
+
protocol Foo {
+  func foo()↓ -> ()
+}
+
+
doSomething { arg↓ -> () in
+    print(arg)
+}
+
+
doSomething { arg↓ -> Void in
+    print(arg)
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/required_deinit.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/required_deinit.html new file mode 100644 index 000000000..7593798a9 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/required_deinit.html @@ -0,0 +1,417 @@ + + + + required_deinit Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Required Deinit

+ +

Classes should have an explicit deinit method

+ +
    +
  • Identifier: required_deinit
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class Apple {
+    deinit { }
+}
+
+
enum Banana { }
+
+
protocol Cherry { }
+
+
struct Damson { }
+
+
class Outer {
+    deinit { print("Deinit Outer") }
+    class Inner {
+        deinit { print("Deinit Inner") }
+    }
+}
+
+

Triggering Examples

+
↓class Apple { }
+
+
↓class Banana: NSObject, Equatable { }
+
+
↓class Cherry {
+    // deinit { }
+}
+
+
↓class Damson {
+    func deinitialize() { }
+}
+
+
class Outer {
+    func hello() -> String { return "outer" }
+    deinit { }
+    ↓class Inner {
+        func hello() -> String { return "inner" }
+    }
+}
+
+
↓class Outer {
+    func hello() -> String { return "outer" }
+    class Inner {
+        func hello() -> String { return "inner" }
+        deinit { }
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/required_enum_case.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/required_enum_case.html new file mode 100644 index 000000000..e52887492 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/required_enum_case.html @@ -0,0 +1,496 @@ + + + + required_enum_case Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Required Enum Case

+ +

Enums conforming to a specified protocol must implement a specific case(s).

+ +
    +
  • Identifier: required_enum_case
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +{Protocol Name} + + + + + + + + + + + + + + + +
    KeyValue
    +{Case Name 1} + +{warning|error} +
    +{Case Name 2} + +{warning|error} +
    +
  • +
+

Non Triggering Examples

+
//
+// NetworkResponsable:
+//   error: warning
+//   notConnected: warning
+//   success: warning
+//
+
+enum MyNetworkResponse: String, NetworkResponsable {
+    case success, error, notConnected
+}
+
+
+
//
+// NetworkResponsable:
+//   error: warning
+//   notConnected: warning
+//   success: warning
+//
+
+enum MyNetworkResponse: String, NetworkResponsable {
+    case success, error, notConnected(error: Error)
+}
+
+
+
//
+// NetworkResponsable:
+//   error: warning
+//   notConnected: warning
+//   success: warning
+//
+
+enum MyNetworkResponse: String, NetworkResponsable {
+    case success
+    case error
+    case notConnected
+}
+
+
+
//
+// NetworkResponsable:
+//   error: warning
+//   notConnected: warning
+//   success: warning
+//
+
+enum MyNetworkResponse: String, NetworkResponsable {
+    case success
+    case error
+    case notConnected(error: Error)
+}
+
+
+

Triggering Examples

+
//
+// NetworkResponsable:
+//   error: warning
+//   notConnected: warning
+//   success: warning
+//
+
+↓enum MyNetworkResponse: String, NetworkResponsable {
+    case success, error
+}
+
+
+
//
+// NetworkResponsable:
+//   error: warning
+//   notConnected: warning
+//   success: warning
+//
+
+↓enum MyNetworkResponse: String, NetworkResponsable {
+    case success, error
+}
+
+
+
//
+// NetworkResponsable:
+//   error: warning
+//   notConnected: warning
+//   success: warning
+//
+
+↓enum MyNetworkResponse: String, NetworkResponsable {
+    case success
+    case error
+}
+
+
+
//
+// NetworkResponsable:
+//   error: warning
+//   notConnected: warning
+//   success: warning
+//
+
+↓enum MyNetworkResponse: String, NetworkResponsable {
+    case success
+    case error
+}
+
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/return_arrow_whitespace.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/return_arrow_whitespace.html new file mode 100644 index 000000000..2e9ebd10e --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/return_arrow_whitespace.html @@ -0,0 +1,425 @@ + + + + return_arrow_whitespace Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Returning Whitespace

+ +

Return arrow and return type should be separated by a single space or on a separate line

+ +
    +
  • Identifier: return_arrow_whitespace
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func abc() -> Int {}
+
+
func abc() -> [Int] {}
+
+
func abc() -> (Int, Int) {}
+
+
var abc = {(param: Int) -> Void in }
+
+
func abc() ->
+    Int {}
+
+
func abc()
+    -> Int {}
+
+
func reallyLongFunctionMethods<T>(withParam1: Int, param2: String, param3: Bool) where T: AGenericConstraint
+    -> Int {
+    return 1
+}
+
+
typealias SuccessBlock = ((Data) -> Void)
+
+

Triggering Examples

+
func abc()↓->Int {}
+
+
func abc()↓->[Int] {}
+
+
func abc()↓->(Int, Int) {}
+
+
func abc()↓-> Int {}
+
+
func abc()↓->   Int {}
+
+
func abc()↓ ->Int {}
+
+
func abc()↓  ->  Int {}
+
+
var abc = {(param: Int)↓ ->Bool in }
+
+
var abc = {(param: Int)↓->Bool in }
+
+
typealias SuccessBlock = ((Data)↓->Void)
+
+
func abc()
+  ↓->  Int {}
+
+
func abc()
+ ↓->  Int {}
+
+
func abc()↓  ->
+  Int {}
+
+
func abc()↓  ->
+Int {}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/return_value_from_void_function.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/return_value_from_void_function.html new file mode 100644 index 000000000..1c48316b5 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/return_value_from_void_function.html @@ -0,0 +1,586 @@ + + + + return_value_from_void_function Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Return Value from Void Function

+ +

Returning values from Void functions should be avoided

+ +
    +
  • Identifier: return_value_from_void_function
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.1.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func foo() {
+    return
+}
+
+
func foo() {
+    return /* a comment */
+}
+
+
func foo() -> Int {
+    return 1
+}
+
+
func foo() -> Void {
+    if condition {
+        return
+    }
+    bar()
+}
+
+
func foo() {
+    return;
+    bar()
+}
+
+
func test() {}
+
+
init?() {
+    guard condition else {
+        return nil
+    }
+}
+
+
init?(arg: String?) {
+    guard arg != nil else {
+        return nil
+    }
+}
+
+
func test() {
+    guard condition else {
+        return
+    }
+}
+
+
func test() -> Result<String, Error> {
+    func other() {}
+    func otherVoid() -> Void {}
+}
+
+
func test() -> Int? {
+    return nil
+}
+
+
func test() {
+    if bar {
+        print("")
+        return
+    }
+    let foo = [1, 2, 3].filter { return true }
+    return
+}
+
+
func test() {
+    guard foo else {
+        bar()
+        return
+    }
+}
+
+
func spec() {
+    var foo: Int {
+        return 0
+    }
+
+
func f() -> () { g() }
+
+
func f() { g() }
+
+
func f() { { return g() }() }
+
+
func f() {
+    func g() -> Int {
+        return 1
+    }
+}
+
+
init?() { return nil }
+
+
func f() {
+    var i: Int { return 1 }
+}
+
+

Triggering Examples

+
func foo() {
+    ↓return bar()
+}
+
+
func foo() -> () {
+    ↓return self.bar()
+}
+
+
func foo() -> Void {
+    ↓return bar()
+}
+
+
func foo() -> Void {
+    ↓return /* comment */ bar()
+}
+
+
func foo() {
+    ↓return
+    self.bar()
+}
+
+
func foo() {
+    variable += 1
+    ↓return
+    variable += 1
+}
+
+
func initThing() {
+    guard foo else {
+        ↓return print("")
+    }
+}
+
+
// Leading comment
+func test() {
+    guard condition else {
+        ↓return assertionfailure("")
+    }
+}
+
+
func test() -> Result<String, Error> {
+    func other() {
+        guard false else {
+            ↓return assertionfailure("")
+        }
+    }
+    func otherVoid() -> Void {}
+}
+
+
func test() {
+    guard conditionIsTrue else {
+        sideEffects()
+        return // comment
+    }
+    guard otherCondition else {
+        ↓return assertionfailure("")
+    }
+    differentSideEffect()
+}
+
+
func test() {
+    guard otherCondition else {
+        ↓return assertionfailure(""); // comment
+    }
+    differentSideEffect()
+}
+
+
func test() {
+  if x {
+    ↓return foo()
+  }
+  bar()
+}
+
+
func test() {
+  switch x {
+    case .a:
+      ↓return foo() // return to skip baz()
+    case .b:
+      bar()
+  }
+  baz()
+}
+
+
func test() {
+  if check {
+    if otherCheck {
+      ↓return foo()
+    }
+  }
+  bar()
+}
+
+
func test() {
+    ↓return foo()
+}
+
+
func test() {
+  ↓return foo({
+    return bar()
+  })
+}
+
+
func test() {
+  guard x else {
+    ↓return foo()
+  }
+  bar()
+}
+
+
func test() {
+  let closure: () -> () = {
+    return assert()
+  }
+  if check {
+    if otherCheck {
+      return // comments are fine
+    }
+  }
+  ↓return foo()
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/rule-directory.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/rule-directory.html new file mode 100644 index 000000000..2d69999db --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/rule-directory.html @@ -0,0 +1,599 @@ + + + + Rule Directory Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Rule Directory

+

Default Rules

+ + +

Opt-in Rules

+ + +

Analyzer Rules

+ + + +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/search.json b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/search.json new file mode 100644 index 000000000..e9ff46d7a --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/search.json @@ -0,0 +1 @@ +{"Macros.html#/s:13SwiftLintCore16AutoConfigParseryycfm":{"name":"AutoConfigParser()","abstract":"

Macro to be attached to rule configurations. It generates the configuration parsing logic"},"Macros.html#/s:13SwiftLintCore32AcceptableByConfigurationElementyycfm":{"name":"AcceptableByConfigurationElement()","abstract":"

Macro that lets an enum with a String raw type automatically conform to AcceptableByConfigurationElement.

"},"Macros.html#/s:13SwiftLintCore0A10SyntaxRule15foldExpressions16explicitRewriter11correctable5optInySb_S3btcfm":{"name":"SwiftSyntaxRule(foldExpressions:explicitRewriter:correctable:optIn:)","abstract":"

Macro that adds a conformance to the SwiftSyntaxRule protocol and a default makeVisitor(file:) implementation"},"Structs/SeverityLevelsConfiguration.html#/s:13SwiftLintCore27SeverityLevelsConfigurationV7warningSivp":{"name":"warning","abstract":"

The threshold for a violation to be a warning.

","parent_name":"SeverityLevelsConfiguration"},"Structs/SeverityLevelsConfiguration.html#/s:13SwiftLintCore27SeverityLevelsConfigurationV5errorSiSgvp":{"name":"error","abstract":"

The threshold for a violation to be an error.

","parent_name":"SeverityLevelsConfiguration"},"Structs/SeverityLevelsConfiguration.html#/s:13SwiftLintCore27SeverityLevelsConfigurationV7warning5errorACyxGSi_SiSgtcfc":{"name":"init(warning:error:)","abstract":"

Create a SeverityLevelsConfiguration based on the specified warning and error thresholds.

","parent_name":"SeverityLevelsConfiguration"},"Structs/SeverityLevelsConfiguration.html#/s:13SwiftLintCore27SeverityLevelsConfigurationV6paramsSayAA13RuleParameterVySiGGvp":{"name":"params","abstract":"

The rule parameters that define the thresholds that should map to each severity.

","parent_name":"SeverityLevelsConfiguration"},"Structs/SeverityLevelsConfiguration.html#/s:13SwiftLintCore17RuleConfigurationP5apply13configurationyyp_tKF":{"name":"apply(configuration:)","parent_name":"SeverityLevelsConfiguration"},"Structs/RegexConfiguration.html#/s:13SwiftLintCore18RegexConfigurationV10identifierSSvp":{"name":"identifier","abstract":"

The identifier for this custom rule.

","parent_name":"RegexConfiguration"},"Structs/RegexConfiguration.html#/s:13SwiftLintCore18RegexConfigurationV4nameSSSgvp":{"name":"name","abstract":"

The name for this custom rule.

","parent_name":"RegexConfiguration"},"Structs/RegexConfiguration.html#/s:13SwiftLintCore18RegexConfigurationV7messageSSvp":{"name":"message","abstract":"

The message to be presented when producing violations.

","parent_name":"RegexConfiguration"},"Structs/RegexConfiguration.html#/s:13SwiftLintCore18RegexConfigurationV8includedSayAA17RegularExpressionVGvp":{"name":"included","abstract":"

Regular expressions to include when matching the file path.

","parent_name":"RegexConfiguration"},"Structs/RegexConfiguration.html#/s:13SwiftLintCore18RegexConfigurationV8excludedSayAA17RegularExpressionVGvp":{"name":"excluded","abstract":"

Regular expressions to exclude when matching the file path.

","parent_name":"RegexConfiguration"},"Structs/RegexConfiguration.html#/s:13SwiftLintCore18RegexConfigurationV18excludedMatchKindsShy21SourceKittenFramework10SyntaxKindOGvp":{"name":"excludedMatchKinds","abstract":"

The syntax kinds to exclude from matches. If the regex matched syntax kinds from this list, it would","parent_name":"RegexConfiguration"},"Structs/RegexConfiguration.html#/s:13SwiftLintCore30SeverityBasedRuleConfigurationP08severityG0AA0dG0Vy6ParentQzGvp":{"name":"severityConfiguration","parent_name":"RegexConfiguration"},"Structs/RegexConfiguration.html#/s:13SwiftLintCore18RegexConfigurationV12captureGroupSivp":{"name":"captureGroup","abstract":"

The index of the regex capture group to match.

","parent_name":"RegexConfiguration"},"Structs/RegexConfiguration.html#/s:13SwiftLintCore24CacheDescriptionProviderP05cacheE0SSvp":{"name":"cacheDescription","parent_name":"RegexConfiguration"},"Structs/RegexConfiguration.html#/s:13SwiftLintCore18RegexConfigurationV11descriptionAA15RuleDescriptionVvp":{"name":"description","abstract":"

The RuleDescription for the custom rule defined here.

","parent_name":"RegexConfiguration"},"Structs/RegexConfiguration.html#/s:13SwiftLintCore18RegexConfigurationV10identifierACyxGSS_tcfc":{"name":"init(identifier:)","abstract":"

Create a RegexConfiguration with the specified identifier, with other properties to be set later.

","parent_name":"RegexConfiguration"},"Structs/RegexConfiguration.html#/s:13SwiftLintCore17RuleConfigurationP5apply13configurationyyp_tKF":{"name":"apply(configuration:)","parent_name":"RegexConfiguration"},"Structs/RegexConfiguration.html#/s:SH4hash4intoys6HasherVz_tF":{"name":"hash(into:)","parent_name":"RegexConfiguration"},"Structs/ReasonedRuleViolation/ViolationCorrection.html#/s:13SwiftLintCore21ReasonedRuleViolationV0F10CorrectionV5start3end11replacementAE0A6Syntax16AbsolutePositionV_AKSStcfc":{"name":"init(start:end:replacement:)","abstract":"

Create a ViolationCorrection.

","parent_name":"ViolationCorrection"},"Structs/ReasonedRuleViolation/ViolationCorrection.html":{"name":"ViolationCorrection","abstract":"

The correction of a violation that is basically the violation’s range in the source code and a","parent_name":"ReasonedRuleViolation"},"Structs/ReasonedRuleViolation.html#/s:13SwiftLintCore21ReasonedRuleViolationV8position0A6Syntax16AbsolutePositionVvp":{"name":"position","abstract":"

The violation’s position.

","parent_name":"ReasonedRuleViolation"},"Structs/ReasonedRuleViolation.html#/s:13SwiftLintCore21ReasonedRuleViolationV6reasonSSSgvp":{"name":"reason","abstract":"

A specific reason for the violation.

","parent_name":"ReasonedRuleViolation"},"Structs/ReasonedRuleViolation.html#/s:13SwiftLintCore21ReasonedRuleViolationV8severityAA0F8SeverityOSgvp":{"name":"severity","abstract":"

The violation’s severity.

","parent_name":"ReasonedRuleViolation"},"Structs/ReasonedRuleViolation.html#/s:13SwiftLintCore21ReasonedRuleViolationV10correctionAC0F10CorrectionVSgvp":{"name":"correction","abstract":"

An optional correction of the violation to be used in rewriting (see SwiftSyntaxCorrectableRule). Can be","parent_name":"ReasonedRuleViolation"},"Structs/ReasonedRuleViolation.html#/s:13SwiftLintCore21ReasonedRuleViolationV8position6reason8severity10correctionAC0A6Syntax16AbsolutePositionV_SSSgAA0F8SeverityOSgAC0F10CorrectionVSgtcfc":{"name":"init(position:reason:severity:correction:)","abstract":"

Creates a ReasonedRuleViolation.

","parent_name":"ReasonedRuleViolation"},"Structs/ReasonedRuleViolation.html#/s:SL1loiySbx_xtFZ":{"name":"<(_:_:)","parent_name":"ReasonedRuleViolation"},"Structs/SwiftVersion.html#/s:SY8RawValueQa":{"name":"RawValue","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:SY8rawValue03RawB0Qzvp":{"name":"rawValue","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:SY8rawValuexSg03RawB0Qz_tcfc":{"name":"init(rawValue:)","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:13SwiftLintCore0A7VersionV4fiveACvpZ":{"name":"five","abstract":"

Swift 5

","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:13SwiftLintCore0A7VersionV10fiveDotOneACvpZ":{"name":"fiveDotOne","abstract":"

Swift 5.1

","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:13SwiftLintCore0A7VersionV10fiveDotTwoACvpZ":{"name":"fiveDotTwo","abstract":"

Swift 5.2

","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:13SwiftLintCore0A7VersionV12fiveDotThreeACvpZ":{"name":"fiveDotThree","abstract":"

Swift 5.3

","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:13SwiftLintCore0A7VersionV11fiveDotFourACvpZ":{"name":"fiveDotFour","abstract":"

Swift 5.4

","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:13SwiftLintCore0A7VersionV11fiveDotFiveACvpZ":{"name":"fiveDotFive","abstract":"

Swift 5.5

","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:13SwiftLintCore0A7VersionV10fiveDotSixACvpZ":{"name":"fiveDotSix","abstract":"

Swift 5.6

","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:13SwiftLintCore0A7VersionV12fiveDotSevenACvpZ":{"name":"fiveDotSeven","abstract":"

Swift 5.7

","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:13SwiftLintCore0A7VersionV12fiveDotEightACvpZ":{"name":"fiveDotEight","abstract":"

Swift 5.8

","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:13SwiftLintCore0A7VersionV11fiveDotNineACvpZ":{"name":"fiveDotNine","abstract":"

Swift 5.9

","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:13SwiftLintCore0A7VersionV3sixACvpZ":{"name":"six","abstract":"

Swift 6

","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:13SwiftLintCore0A7VersionV7currentACvpZ":{"name":"current","abstract":"

The current detected Swift compiler version, based on the currently accessible SourceKit version.

","parent_name":"SwiftVersion"},"Structs/SwiftLintSyntaxToken.html#/s:13SwiftLintCore0aB11SyntaxTokenV5value21SourceKittenFramework0dE0Vvp":{"name":"value","abstract":"

The raw SyntaxToken obtained by SourceKitten.

","parent_name":"SwiftLintSyntaxToken"},"Structs/SwiftLintSyntaxToken.html#/s:13SwiftLintCore0aB11SyntaxTokenV4kind21SourceKittenFramework0D4KindOSgvp":{"name":"kind","abstract":"

The syntax kind associated with is token.

","parent_name":"SwiftLintSyntaxToken"},"Structs/SwiftLintSyntaxToken.html#/s:13SwiftLintCore0aB11SyntaxTokenV5valueAC21SourceKittenFramework0dE0V_tcfc":{"name":"init(value:)","abstract":"

Creates a SwiftLintSyntaxToken from the raw SyntaxToken obtained by SourceKitten.

","parent_name":"SwiftLintSyntaxToken"},"Structs/SwiftLintSyntaxToken.html#/s:13SwiftLintCore0aB11SyntaxTokenV5range21SourceKittenFramework9ByteRangeVvp":{"name":"range","abstract":"

The byte range in a source file for this token.

","parent_name":"SwiftLintSyntaxToken"},"Structs/SwiftLintSyntaxToken.html#/s:13SwiftLintCore0aB11SyntaxTokenV6offset21SourceKittenFramework9ByteCountVvp":{"name":"offset","abstract":"

The starting byte offset in a source file for this token.

","parent_name":"SwiftLintSyntaxToken"},"Structs/SwiftLintSyntaxToken.html#/s:13SwiftLintCore0aB11SyntaxTokenV6length21SourceKittenFramework9ByteCountVvp":{"name":"length","abstract":"

The length in bytes for this token.

","parent_name":"SwiftLintSyntaxToken"},"Structs/SwiftLintSyntaxMap.html#/s:13SwiftLintCore0aB9SyntaxMapV5value21SourceKittenFramework0dE0Vvp":{"name":"value","abstract":"

The raw SyntaxMap obtained by SourceKitten.

","parent_name":"SwiftLintSyntaxMap"},"Structs/SwiftLintSyntaxMap.html#/s:13SwiftLintCore0aB9SyntaxMapV6tokensSayAA0abD5TokenVGvp":{"name":"tokens","abstract":"

The SwiftLint-specific syntax tokens for this syntax map.

","parent_name":"SwiftLintSyntaxMap"},"Structs/SwiftLintSyntaxMap.html#/s:13SwiftLintCore0aB9SyntaxMapV5valueAC21SourceKittenFramework0dE0V_tcfc":{"name":"init(value:)","abstract":"

Creates a SwiftLintSyntaxMap from the raw SyntaxMap obtained by SourceKitten.

","parent_name":"SwiftLintSyntaxMap"},"Structs/SwiftLintSyntaxMap.html#/s:13SwiftLintCore0aB9SyntaxMapV6tokens11inByteRangeSayAA0abD5TokenVG21SourceKittenFramework0hI0V_tF":{"name":"tokens(inByteRange:)","abstract":"

Returns array of syntax tokens intersecting with byte range.

","parent_name":"SwiftLintSyntaxMap"},"Structs/SwiftLintSyntaxMap.html#/s:13SwiftLintCore0aB9SyntaxMapV5kinds11inByteRangeSay21SourceKittenFramework0D4KindOGAF0hI0V_tF":{"name":"kinds(inByteRange:)","abstract":"

Returns the syntax kinds in the specified byte range.

","parent_name":"SwiftLintSyntaxMap"},"Structs/StyleViolation.html#/s:13SwiftLintCore14StyleViolationV14ruleIdentifierSSvp":{"name":"ruleIdentifier","abstract":"

The identifier of the rule that generated this violation.

","parent_name":"StyleViolation"},"Structs/StyleViolation.html#/s:13SwiftLintCore14StyleViolationV15ruleDescriptionSSvp":{"name":"ruleDescription","abstract":"

The description of the rule that generated this violation.

","parent_name":"StyleViolation"},"Structs/StyleViolation.html#/s:13SwiftLintCore14StyleViolationV8ruleNameSSvp":{"name":"ruleName","abstract":"

The name of the rule that generated this violation.

","parent_name":"StyleViolation"},"Structs/StyleViolation.html#/s:13SwiftLintCore14StyleViolationV8severityAA0E8SeverityOvp":{"name":"severity","abstract":"

The severity of this violation.

","parent_name":"StyleViolation"},"Structs/StyleViolation.html#/s:13SwiftLintCore14StyleViolationV8locationAA8LocationVvp":{"name":"location","abstract":"

The location of this violation.

","parent_name":"StyleViolation"},"Structs/StyleViolation.html#/s:13SwiftLintCore14StyleViolationV6reasonSSvp":{"name":"reason","abstract":"

The justification for this violation.

","parent_name":"StyleViolation"},"Structs/StyleViolation.html#/s:13SwiftLintCore14StyleViolationV11descriptionSSvp":{"name":"description","abstract":"

A printable description for this violation.

","parent_name":"StyleViolation"},"Structs/StyleViolation.html#/s:13SwiftLintCore14StyleViolationV15ruleDescription8severity8location6reasonAcA04RuleG0V_AA0E8SeverityOAA8LocationVSSSgtcfc":{"name":"init(ruleDescription:severity:location:reason:)","abstract":"

Creates a StyleViolation by specifying its properties directly.

","parent_name":"StyleViolation"},"Structs/StyleViolation.html#/s:13SwiftLintCore14StyleViolationV4with8severityAcA0E8SeverityO_tF":{"name":"with(severity:)","abstract":"

Returns the same violation, but with the severity that is passed in

","parent_name":"StyleViolation"},"Structs/StyleViolation.html#/s:13SwiftLintCore14StyleViolationV4with8locationAcA8LocationV_tF":{"name":"with(location:)","abstract":"

Returns the same violation, but with the location that is passed in

","parent_name":"StyleViolation"},"Structs/StyleViolation.html#/s:SH4hash4intoys6HasherVz_tF":{"name":"hash(into:)","parent_name":"StyleViolation"},"Structs/RuleParameter.html#/s:13SwiftLintCore13RuleParameterV8severityAA17ViolationSeverityOvp":{"name":"severity","abstract":"

The severity that should be assigned to the violation of this parameter’s value is met.

","parent_name":"RuleParameter"},"Structs/RuleParameter.html#/s:13SwiftLintCore13RuleParameterV5valuexvp":{"name":"value","abstract":"

The value to configure the rule.

","parent_name":"RuleParameter"},"Structs/RuleParameter.html#/s:13SwiftLintCore13RuleParameterV8severity5valueACyxGAA17ViolationSeverityO_xtcfc":{"name":"init(severity:value:)","abstract":"

Creates a RuleParameter by specifying its properties directly.

","parent_name":"RuleParameter"},"Structs/RuleList.html#/s:13SwiftLintCore8RuleListV4listSDySSAA0D0_pXpGvp":{"name":"list","abstract":"

The rules contained in this list.

","parent_name":"RuleList"},"Structs/RuleList.html#/s:13SwiftLintCore8RuleListV5rulesAcA0D0_pXpd_tcfc":{"name":"init(rules:)","abstract":"

Creates a RuleList by specifying all its rules.

","parent_name":"RuleList"},"Structs/RuleList.html#/s:13SwiftLintCore8RuleListV5rulesACSayAA0D0_pXpG_tcfc":{"name":"init(rules:)","abstract":"

Creates a RuleList by specifying all its rules.

","parent_name":"RuleList"},"Structs/RuleList.html#/s:SQ2eeoiySbx_xtFZ":{"name":"==(_:_:)","parent_name":"RuleList"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV10identifierSSvp":{"name":"identifier","abstract":"

The rule’s unique identifier, to be used in configuration files and SwiftLint commands.","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV4nameSSvp":{"name":"name","abstract":"

The rule’s human-readable name. Should be short, descriptive and formatted in Title Case. May contain spaces.

","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV11descriptionSSvp":{"name":"description","abstract":"

The rule’s verbose description. Should read as a sentence or short paragraph. Good things to include are an","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV4kindAA0D4KindOvp":{"name":"kind","abstract":"

The RuleKind that best categorizes this rule.

","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV21nonTriggeringExamplesSayAA7ExampleVGvp":{"name":"nonTriggeringExamples","abstract":"

Swift source examples that do not trigger a violation for this rule. Used for documentation purposes to inform","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV18triggeringExamplesSayAA7ExampleVGvp":{"name":"triggeringExamples","abstract":"

Swift source examples that do trigger one or more violations for this rule. Used for documentation purposes to","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV11correctionsSDyAA7ExampleVAFGvp":{"name":"corrections","abstract":"

Pairs of Swift source examples, where keys are examples that trigger violations for this rule, and the values","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV17deprecatedAliasesShySSGvp":{"name":"deprecatedAliases","abstract":"

Any previous iteration of the rule’s identifier that was previously shipped with SwiftLint.

","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV03minA7VersionAA0aG0Vvp":{"name":"minSwiftVersion","abstract":"

The oldest version of the Swift compiler supported by this rule.

","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV18requiresFileOnDiskSbvp":{"name":"requiresFileOnDisk","abstract":"

Whether or not this rule can only be executed on a file physically on-disk. Typically necessary for rules","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV07consoleE0SSvp":{"name":"consoleDescription","abstract":"

The console-printable string for this description.

","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV14allIdentifiersSaySSGvp":{"name":"allIdentifiers","abstract":"

All identifiers that have been used to uniquely identify this rule in past and current SwiftLint versions.

","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV10identifier4name11description4kind03minA7Version21nonTriggeringExamples010triggeringN011corrections17deprecatedAliases18requiresFileOnDiskACSS_S2SAA0D4KindOAA0aK0VSayAA7ExampleVGATSDyA2SGShySSGSbtcfc":{"name":"init(identifier:name:description:kind:minSwiftVersion:nonTriggeringExamples:triggeringExamples:corrections:deprecatedAliases:requiresFileOnDisk:)","abstract":"

Creates a RuleDescription by specifying all its properties directly.

","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:SQ2eeoiySbx_xtFZ":{"name":"==(_:_:)","parent_name":"RuleDescription"},"Structs/SeverityConfiguration.html#/s:13SwiftLintCore21SeverityConfigurationV5errorACyxGvpZ":{"name":"error","abstract":"

Configuration with a warning severity.

","parent_name":"SeverityConfiguration"},"Structs/SeverityConfiguration.html#/s:13SwiftLintCore21SeverityConfigurationV7warningACyxGvpZ":{"name":"warning","abstract":"

Configuration with an error severity.

","parent_name":"SeverityConfiguration"},"Structs/SeverityConfiguration.html#/s:13SwiftLintCore30SeverityBasedRuleConfigurationP08severityG0AA0dG0Vy6ParentQzGvp":{"name":"severityConfiguration","parent_name":"SeverityConfiguration"},"Structs/SeverityConfiguration.html#/s:13SwiftLintCore21SeverityConfigurationVyACyxGAA09ViolationD0Ocfc":{"name":"init(_:)","abstract":"

Create a SeverityConfiguration with the specified severity.

","parent_name":"SeverityConfiguration"},"Structs/SeverityConfiguration.html#/s:13SwiftLintCore17RuleConfigurationP5apply13configurationyyp_tKF":{"name":"apply(configuration:)","parent_name":"SeverityConfiguration"},"Structs/SeverityConfiguration.html#/s:13SwiftLintCore21SeverityConfigurationV13asDescription4withAA04RuleeG0VSS_tF":{"name":"asDescription(with:)","abstract":"

Severity configurations are special in that they shall not be nested when an option name is provided.","parent_name":"SeverityConfiguration"},"Structs/ConfigurationElement/DeprecationNotice.html#/s:13SwiftLintCore20ConfigurationElementV17DeprecationNoticeO18suggestAlternativeyAEyx_GSS_SStcAGmSQRzs8SendableRzAA012AcceptableBydE0RzlF":{"name":"suggestAlternative(ruleID:name:)","abstract":"

Warning suggesting an alternative option.

","parent_name":"DeprecationNotice"},"Structs/ConfigurationElement/DeprecationNotice.html":{"name":"DeprecationNotice","abstract":"

A deprecation notice.

","parent_name":"ConfigurationElement"},"Structs/ConfigurationElement.html#/s:13SwiftLintCore20ConfigurationElementV12wrappedValuexvp":{"name":"wrappedValue","abstract":"

Wrapped option value.

","parent_name":"ConfigurationElement"},"Structs/ConfigurationElement.html#/s:13SwiftLintCore20ConfigurationElementV14projectedValueACyxGvp":{"name":"projectedValue","abstract":"

The wrapper itself providing access to all its data. This field can only be accessed by the","parent_name":"ConfigurationElement"},"Structs/ConfigurationElement.html#/s:13SwiftLintCore20ConfigurationElementV3keySSvp":{"name":"key","abstract":"

Name of this configuration entry.

","parent_name":"ConfigurationElement"},"Structs/ConfigurationElement.html#/s:13SwiftLintCore20ConfigurationElementV6inlineSbvp":{"name":"inline","abstract":"

Whether this configuration element will be inlined into its description.

","parent_name":"ConfigurationElement"},"Structs/ConfigurationElement.html#/s:13SwiftLintCore20ConfigurationElementV12wrappedValue3key17deprecationNotice13postprocessorACyxGx_SSAC011DeprecationJ0Oyx_GSgyxzYbctcfc":{"name":"init(wrappedValue:key:deprecationNotice:postprocessor:)","abstract":"

Default constructor.

","parent_name":"ConfigurationElement"},"Structs/ConfigurationElement.html#/s:13SwiftLintCore20ConfigurationElementV3keyACyqd__SgGSS_tcAERszSQRd__s8SendableRd__AA012AcceptableBydE0Rd__lufc":{"name":"init(key:)","abstract":"

Constructor for optional values.

","parent_name":"ConfigurationElement"},"Structs/ConfigurationElement.html#/s:13SwiftLintCore20ConfigurationElementV12wrappedValue6inlineACyxGx_SbtcAA19InlinableOptionTypeRzrlufc":{"name":"init(wrappedValue:inline:)","abstract":"

Constructor for an InlinableOptionType without a key.

","parent_name":"ConfigurationElement"},"Structs/ConfigurationElement.html#/s:13SwiftLintCore20ConfigurationElementV12wrappedValue3keyACyxGx_SStcAA19InlinableOptionTypeRzrlufc":{"name":"init(wrappedValue:key:)","abstract":"

Constructor for an InlinableOptionType with a name. The configuration will explicitly not be inlined.

","parent_name":"ConfigurationElement"},"Structs/ConfigurationElement.html#/s:SQ2eeoiySbx_xtFZ":{"name":"==(_:_:)","parent_name":"ConfigurationElement"},"Structs/RuleConfigurationOption.html#/s:13SwiftLintCore23RuleConfigurationOptionV9noOptionsACvpZ":{"name":"noOptions","abstract":"

An option serving as a marker for an empty configuration description.

","parent_name":"RuleConfigurationOption"},"Structs/RuleConfigurationOption.html#/s:13SwiftLintCore12DocumentableP10hasContentSbvp":{"name":"hasContent","parent_name":"RuleConfigurationOption"},"Structs/RuleConfigurationOption.html#/s:13SwiftLintCore12DocumentableP8markdownSSyF":{"name":"markdown()","parent_name":"RuleConfigurationOption"},"Structs/RuleConfigurationOption.html#/s:13SwiftLintCore12DocumentableP8oneLinerSSyF":{"name":"oneLiner()","parent_name":"RuleConfigurationOption"},"Structs/RuleConfigurationOption.html#/s:13SwiftLintCore12DocumentableP4yamlSSyF":{"name":"yaml()","parent_name":"RuleConfigurationOption"},"Structs/RuleConfigurationDescription.html#/s:13SwiftLintCore12DocumentableP10hasContentSbvp":{"name":"hasContent","parent_name":"RuleConfigurationDescription"},"Structs/RuleConfigurationDescription.html#/s:13SwiftLintCore12DocumentableP8oneLinerSSyF":{"name":"oneLiner()","parent_name":"RuleConfigurationDescription"},"Structs/RuleConfigurationDescription.html#/s:13SwiftLintCore12DocumentableP8markdownSSyF":{"name":"markdown()","parent_name":"RuleConfigurationDescription"},"Structs/RuleConfigurationDescription.html#/s:13SwiftLintCore12DocumentableP4yamlSSyF":{"name":"yaml()","parent_name":"RuleConfigurationDescription"},"Structs/Region.html#/s:13SwiftLintCore6RegionV5startAA8LocationVvp":{"name":"start","abstract":"

The location describing the start of the region. All locations that are less than this value","parent_name":"Region"},"Structs/Region.html#/s:13SwiftLintCore6RegionV3endAA8LocationVvp":{"name":"end","abstract":"

The location describing the end of the region. All locations that are greater than this value","parent_name":"Region"},"Structs/Region.html#/s:13SwiftLintCore6RegionV23disabledRuleIdentifiersShyAA0F10IdentifierOGvp":{"name":"disabledRuleIdentifiers","abstract":"

All SwiftLint rule identifiers that are disabled in this region.

","parent_name":"Region"},"Structs/Region.html#/s:13SwiftLintCore6RegionV5start3end23disabledRuleIdentifiersAcA8LocationV_AHShyAA0H10IdentifierOGtcfc":{"name":"init(start:end:disabledRuleIdentifiers:)","abstract":"

Creates a Region by setting explicit values for all its properties.

","parent_name":"Region"},"Structs/Region.html#/s:13SwiftLintCore6RegionV8containsySbAA8LocationVF":{"name":"contains(_:)","abstract":"

Whether the specific location is contained in this region.

","parent_name":"Region"},"Structs/Region.html#/s:13SwiftLintCore6RegionV13isRuleEnabledySbxAA0F0RzlF":{"name":"isRuleEnabled(_:)","abstract":"

Whether the specified rule is enabled in this region.

","parent_name":"Region"},"Structs/Region.html#/s:13SwiftLintCore6RegionV14isRuleDisabledySbxAA0F0RzlF":{"name":"isRuleDisabled(_:)","abstract":"

Whether the specified rule is disabled in this region.

","parent_name":"Region"},"Structs/Region.html#/s:13SwiftLintCore6RegionV16areRulesDisabled7ruleIDsSbSaySSG_tF":{"name":"areRulesDisabled(ruleIDs:)","abstract":"

Whether the given rules are disabled in this region.

","parent_name":"Region"},"Structs/Region.html#/s:13SwiftLintCore6RegionV26deprecatedAliasesDisabling4ruleShySSGx_tAA4RuleRzlF":{"name":"deprecatedAliasesDisabling(rule:)","abstract":"

Returns the deprecated rule aliases that are disabling the specified rule in this region.","parent_name":"Region"},"Structs/Location.html#/s:13SwiftLintCore8LocationV4fileSSSgvp":{"name":"file","abstract":"

The file path on disk for this location.

","parent_name":"Location"},"Structs/Location.html#/s:13SwiftLintCore8LocationV4lineSiSgvp":{"name":"line","abstract":"

The line offset in the file for this location. 1-indexed.

","parent_name":"Location"},"Structs/Location.html#/s:13SwiftLintCore8LocationV9characterSiSgvp":{"name":"character","abstract":"

The character offset in the file for this location. 1-indexed.

","parent_name":"Location"},"Structs/Location.html#/s:13SwiftLintCore8LocationV11descriptionSSvp":{"name":"description","abstract":"

A lossless printable description of this location.

","parent_name":"Location"},"Structs/Location.html#/s:13SwiftLintCore8LocationV12relativeFileSSSgvp":{"name":"relativeFile","abstract":"

The file path for this location relative to the current working directory.

","parent_name":"Location"},"Structs/Location.html#/s:13SwiftLintCore8LocationV4file4line9characterACSSSg_SiSgAHtcfc":{"name":"init(file:line:character:)","abstract":"

Creates a Location by specifying its properties directly.

","parent_name":"Location"},"Structs/Location.html#/s:13SwiftLintCore8LocationV4file10byteOffsetAcA0aB4FileC_21SourceKittenFramework9ByteCountVtcfc":{"name":"init(file:byteOffset:)","abstract":"

Creates a Location based on a SwiftLintFile and a byte-offset into the file.","parent_name":"Location"},"Structs/Location.html#/s:13SwiftLintCore8LocationV4file8positionAcA0aB4FileC_0A6Syntax16AbsolutePositionVtcfc":{"name":"init(file:position:)","abstract":"

Creates a Location based on a SwiftLintFile and a SwiftSyntax AbsolutePosition into the file.","parent_name":"Location"},"Structs/Location.html#/s:13SwiftLintCore8LocationV4file15characterOffsetAcA0aB4FileC_Sitcfc":{"name":"init(file:characterOffset:)","abstract":"

Creates a Location based on a SwiftLintFile and a UTF8 character-offset into the file.","parent_name":"Location"},"Structs/Location.html#/s:SL1loiySbx_xtFZ":{"name":"<(_:_:)","parent_name":"Location"},"Structs/Example.html#/s:13SwiftLintCore7ExampleV4codeSSvp":{"name":"code","abstract":"

The contents of the example

","parent_name":"Example"},"Structs/Example.html#/s:13SwiftLintCore7ExampleV13configurationSDySSs8Sendable_pGSgvp":{"name":"configuration","abstract":"

The untyped configuration to apply to the rule, if deviating from the default configuration.","parent_name":"Example"},"Structs/Example.html#/s:13SwiftLintCore7ExampleV20testMultiByteOffsetsSbvp":{"name":"testMultiByteOffsets","abstract":"

Whether the example should be tested by prepending multibyte grapheme clusters

","parent_name":"Example"},"Structs/Example.html#/s:13SwiftLintCore7ExampleV11testOnLinuxSbvp":{"name":"testOnLinux","abstract":"

Whether the example should be tested on Linux

","parent_name":"Example"},"Structs/Example.html#/s:13SwiftLintCore7ExampleV4files12StaticStringVvp":{"name":"file","abstract":"

The path to the file where the example was created

","parent_name":"Example"},"Structs/Example.html#/s:13SwiftLintCore7ExampleV4lineSuvp":{"name":"line","abstract":"

The line in the file where the example was created

","parent_name":"Example"},"Structs/Example.html#/s:13SwiftLintCore7ExampleV_13configuration20testMultiByteOffsets0F17WrappingInComment0fjK6String0F14DisableCommand0F7OnLinux4file4line24excludeFromDocumentationACSS_SDySSs8Sendable_pGSgS5bs06StaticM0VSuSbtcfc":{"name":"init(_:configuration:testMultiByteOffsets:testWrappingInComment:testWrappingInString:testDisableCommand:testOnLinux:file:line:excludeFromDocumentation:)","abstract":"

Create a new Example with the specified code, file, and line.

","parent_name":"Example"},"Structs/Example.html#/s:13SwiftLintCore7ExampleV4with4codeACSS_tF":{"name":"with(code:)","abstract":"

Returns the same example, but with the code that is passed in

","parent_name":"Example"},"Structs/Example.html#/s:13SwiftLintCore7ExampleV24removingViolationMarkersACyF":{"name":"removingViolationMarkers()","abstract":"

Returns a copy of the Example with all instances of the “↓” character removed.

","parent_name":"Example"},"Structs/Example.html#/s:13SwiftLintCore7ExampleV7focusedACyF":{"name":"focused()","abstract":"

Makes the current example focused. This is for debugging purposes only.

","parent_name":"Example"},"Structs/Example.html#/s:SQ2eeoiySbx_xtFZ":{"name":"==(_:_:)","parent_name":"Example"},"Structs/Example.html#/s:SH4hash4intoys6HasherVz_tF":{"name":"hash(into:)","parent_name":"Example"},"Structs/Example.html#/s:SL1loiySbx_xtFZ":{"name":"<(_:_:)","parent_name":"Example"},"Structs/Correction.html#/s:13SwiftLintCore10CorrectionV15ruleDescriptionAA04RuleF0Vvp":{"name":"ruleDescription","abstract":"

The description of the rule for which this correction was applied.

","parent_name":"Correction"},"Structs/Correction.html#/s:13SwiftLintCore10CorrectionV8locationAA8LocationVvp":{"name":"location","abstract":"

The location of the original violation that was corrected.

","parent_name":"Correction"},"Structs/Correction.html#/s:13SwiftLintCore10CorrectionV18consoleDescriptionSSvp":{"name":"consoleDescription","abstract":"

The console-printable description for this correction.

","parent_name":"Correction"},"Structs/Correction.html#/s:13SwiftLintCore10CorrectionV15ruleDescription8locationAcA04RuleF0V_AA8LocationVtcfc":{"name":"init(ruleDescription:location:)","abstract":"

Memberwise initializer.

","parent_name":"Correction"},"Structs/Command/Modifier.html#/s:13SwiftLintCore7CommandV8ModifierO8previousyA2EmF":{"name":"previous","abstract":"

The command should only apply to the line preceding its definition.

","parent_name":"Modifier"},"Structs/Command/Modifier.html#/s:13SwiftLintCore7CommandV8ModifierO4thisyA2EmF":{"name":"this","abstract":"

The command should only apply to the same line as its definition.

","parent_name":"Modifier"},"Structs/Command/Modifier.html#/s:13SwiftLintCore7CommandV8ModifierO4nextyA2EmF":{"name":"next","abstract":"

The command should only apply to the line following its definition.

","parent_name":"Modifier"},"Structs/Command/Modifier.html#/s:13SwiftLintCore7CommandV8ModifierO7invalidyA2EmF":{"name":"invalid","abstract":"

The modifier string was invalid.

","parent_name":"Modifier"},"Structs/Command/Action.html#/s:13SwiftLintCore7CommandV6ActionO6enableyA2EmF":{"name":"enable","abstract":"

The rule(s) associated with this command should be enabled by the SwiftLint engine.

","parent_name":"Action"},"Structs/Command/Action.html#/s:13SwiftLintCore7CommandV6ActionO7disableyA2EmF":{"name":"disable","abstract":"

The rule(s) associated with this command should be disabled by the SwiftLint engine.

","parent_name":"Action"},"Structs/Command/Action.html#/s:13SwiftLintCore7CommandV6ActionO7invalidyA2EmF":{"name":"invalid","abstract":"

The action string was invalid.

","parent_name":"Action"},"Structs/Command/Action.html":{"name":"Action","abstract":"

The action (verb) that SwiftLint should perform when interpreting this command.

","parent_name":"Command"},"Structs/Command/Modifier.html":{"name":"Modifier","abstract":"

The modifier for a command, used to modify its scope.

","parent_name":"Command"},"Structs/Command.html#/s:13SwiftLintCore7CommandV6actionAC6ActionOvp":{"name":"action","abstract":"

The action (verb) that SwiftLint should perform when interpreting this command.

","parent_name":"Command"},"Structs/Command.html#/s:13SwiftLintCore7CommandV15ruleIdentifiersShyAA14RuleIdentifierOGvp":{"name":"ruleIdentifiers","abstract":"

The identifiers for the rules associated with this command.

","parent_name":"Command"},"Structs/Command.html#/s:13SwiftLintCore7CommandV4lineSivp":{"name":"line","abstract":"

The line in the source file where this command is defined.

","parent_name":"Command"},"Structs/Command.html#/s:13SwiftLintCore7CommandV9characterSiSgvp":{"name":"character","abstract":"

The character offset within the line in the source file where this command is defined.

","parent_name":"Command"},"Structs/Command.html#/s:13SwiftLintCore7CommandV8modifierAC8ModifierOSgvp":{"name":"modifier","abstract":"

This command’s modifier, if any.

","parent_name":"Command"},"Structs/Command.html#/s:13SwiftLintCore7CommandV6action15ruleIdentifiers4line9character8modifier15trailingCommentA2C6ActionO_ShyAA14RuleIdentifierOGS2iSgAC8ModifierOSgSSSgtcfc":{"name":"init(action:ruleIdentifiers:line:character:modifier:trailingComment:)","abstract":"

Creates a command based on the specified parameters.

","parent_name":"Command"},"Structs/Command.html#/s:13SwiftLintCore7CommandV12actionString4line9characterACSS_S2itcfc":{"name":"init(actionString:line:character:)","abstract":"

Creates a command based on the specified parameters.

","parent_name":"Command"},"Structs/ChildOptionSeverityConfiguration.html#/s:13SwiftLintCore32ChildOptionSeverityConfigurationV5errorACyxGvpZ":{"name":"error","abstract":"

Configuration with a warning severity.

","parent_name":"ChildOptionSeverityConfiguration"},"Structs/ChildOptionSeverityConfiguration.html#/s:13SwiftLintCore32ChildOptionSeverityConfigurationV7warningACyxGvpZ":{"name":"warning","abstract":"

Configuration with an error severity.

","parent_name":"ChildOptionSeverityConfiguration"},"Structs/ChildOptionSeverityConfiguration.html#/s:13SwiftLintCore32ChildOptionSeverityConfigurationV3offACyxGvpZ":{"name":"off","abstract":"

Configuration disabling an option.

","parent_name":"ChildOptionSeverityConfiguration"},"Structs/ChildOptionSeverityConfiguration.html#/s:13SwiftLintCore32ChildOptionSeverityConfigurationV8severityAA09ViolationF0OSgvp":{"name":"severity","abstract":"

The ChildOptionSeverityConfiguration mapped to a usually used ViolationSeverity. It’s nil if the option","parent_name":"ChildOptionSeverityConfiguration"},"Structs/ChildOptionSeverityConfiguration.html#/s:13SwiftLintCore17RuleConfigurationP5apply13configurationyyp_tKF":{"name":"apply(configuration:)","parent_name":"ChildOptionSeverityConfiguration"},"Structs/ChildOptionSeverityConfiguration.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP8asOptionAA0I4TypeOyF":{"name":"asOption()","parent_name":"ChildOptionSeverityConfiguration"},"Structs/Baseline.html#/s:13SwiftLintCore8BaselineV10violationsSayAA14StyleViolationVGvp":{"name":"violations","abstract":"

The stored violations.

","parent_name":"Baseline"},"Structs/Baseline.html#/s:13SwiftLintCore8BaselineV8fromPathACSS_tKcfc":{"name":"init(fromPath:)","abstract":"

Creates a Baseline from a saved file.

","parent_name":"Baseline"},"Structs/Baseline.html#/s:13SwiftLintCore8BaselineV10violationsACSayAA14StyleViolationVG_tcfc":{"name":"init(violations:)","abstract":"

Creates a Baseline from a list of violations.

","parent_name":"Baseline"},"Structs/Baseline.html#/s:13SwiftLintCore8BaselineV5write6toPathySS_tKF":{"name":"write(toPath:)","abstract":"

Writes a Baseline to disk in JSON format.

","parent_name":"Baseline"},"Structs/Baseline.html#/s:13SwiftLintCore8BaselineV6filterySayAA14StyleViolationVGAGF":{"name":"filter(_:)","abstract":"

Filters out violations that are present in the Baseline.

","parent_name":"Baseline"},"Structs/Baseline.html#/s:13SwiftLintCore8BaselineV7compareySayAA14StyleViolationVGACF":{"name":"compare(_:)","abstract":"

Returns the violations that are present in another Baseline, but not in this one.

","parent_name":"Baseline"},"Structs/Stack.html#/s:13SwiftLintCore5StackVACyxGycfc":{"name":"init()","abstract":"

Creates an empty Stack.

","parent_name":"Stack"},"Structs/Stack.html#/s:13SwiftLintCore5StackV5countSivp":{"name":"count","abstract":"

The number of elements in this stack.

","parent_name":"Stack"},"Structs/Stack.html#/s:13SwiftLintCore5StackV4pushyyxF":{"name":"push(_:)","abstract":"

Pushes (appends) an element onto the stack.

","parent_name":"Stack"},"Structs/Stack.html#/s:13SwiftLintCore5StackV3popxSgyF":{"name":"pop()","abstract":"

Removes and returns the last element of the stack.

","parent_name":"Stack"},"Structs/Stack.html#/s:13SwiftLintCore5StackV4peekxSgyF":{"name":"peek()","abstract":"

Returns the last element of the stack if the stack is not empty; otherwise, nil.

","parent_name":"Stack"},"Structs/Stack.html#/s:13SwiftLintCore5StackV8contains5whereS2bxXE_tF":{"name":"contains(where:)","abstract":"

Check whether the sequence contains an element that satisfies the given predicate.

","parent_name":"Stack"},"Structs/Stack.html#/s:13SwiftLintCore5StackV10modifyLast2byyyxzXE_tF":{"name":"modifyLast(by:)","abstract":"

Modify the last element.

","parent_name":"Stack"},"Structs/Stack.html#/s:ST12makeIterator0B0QzyF":{"name":"makeIterator()","parent_name":"Stack"},"Structs/Stack.html#/s:s28CustomDebugStringConvertibleP16debugDescriptionSSvp":{"name":"debugDescription","parent_name":"Stack"},"Structs/Stack.html":{"name":"Stack","abstract":"

A basic stack type implementing the LIFO principle - only the last inserted element can be accessed and removed.

"},"Structs/Baseline.html":{"name":"Baseline","abstract":"

A set of violations that can be used to filter newly detected violations.

"},"Structs/ChildOptionSeverityConfiguration.html":{"name":"ChildOptionSeverityConfiguration","abstract":"

A rule configuration that allows to disable (off) an option of a rule or specify its severity level in which"},"Structs/Command.html":{"name":"Command","abstract":"

A SwiftLint-interpretable command to modify SwiftLint’s behavior embedded as comments in source code.

"},"Structs/Correction.html":{"name":"Correction","abstract":"

A value describing a SwiftLint violation that was corrected.

"},"Structs/Example.html":{"name":"Example","abstract":"

Captures code and context information for an example of a triggering or"},"Structs/Location.html":{"name":"Location","abstract":"

The placement of a segment of Swift in a collection of source files.

"},"Structs/Region.html":{"name":"Region","abstract":"

A contiguous region of Swift source code.

"},"Structs/RuleConfigurationDescription.html":{"name":"RuleConfigurationDescription","abstract":"

Description of a rule configuration.

"},"Structs/RuleConfigurationOption.html":{"name":"RuleConfigurationOption","abstract":"

A single option of a RuleConfigurationDescription.

"},"Structs.html#/s:13SwiftLintCore35RuleConfigurationDescriptionBuilderV":{"name":"RuleConfigurationDescriptionBuilder","abstract":"

A result builder creating configuration descriptions.

"},"Structs/ConfigurationElement.html":{"name":"ConfigurationElement","abstract":"

A single parameter of a rule configuration.

"},"Structs/SeverityConfiguration.html":{"name":"SeverityConfiguration","abstract":"

A rule configuration that allows specifying the desired severity level for violations.

"},"Structs/RuleDescription.html":{"name":"RuleDescription","abstract":"

A detailed description for a SwiftLint rule. Used for both documentation and testing purposes.

"},"Structs/RuleList.html":{"name":"RuleList","abstract":"

A list of available SwiftLint rules.

"},"Structs/RuleParameter.html":{"name":"RuleParameter","abstract":"

A configuration parameter for rules.

"},"Structs/StyleViolation.html":{"name":"StyleViolation","abstract":"

A value describing an instance of Swift source code that is considered invalid by a SwiftLint rule.

"},"Structs/SwiftLintSyntaxMap.html":{"name":"SwiftLintSyntaxMap","abstract":"

Represents a Swift file’s syntax information.

"},"Structs/SwiftLintSyntaxToken.html":{"name":"SwiftLintSyntaxToken","abstract":"

A SwiftLint-aware Swift syntax token.

"},"Structs/SwiftVersion.html":{"name":"SwiftVersion","abstract":"

A value describing the version of the Swift compiler.

"},"Structs/ReasonedRuleViolation.html":{"name":"ReasonedRuleViolation","abstract":"

A violation produced by ViolationsSyntaxVisitors.

"},"Structs/RegexConfiguration.html":{"name":"RegexConfiguration","abstract":"

A rule configuration used for defining custom rules in yaml.

"},"Structs/SeverityLevelsConfiguration.html":{"name":"SeverityLevelsConfiguration","abstract":"

A rule configuration that allows specifying thresholds for warning and error severities.

"},"Protocols/SwiftSyntaxRule.html#/s:13SwiftLintCore0A10SyntaxRuleP11makeVisitor4fileAA010ViolationsdG0Cy17ConfigurationTypeQzGAA0aB4FileC_tF":{"name":"makeVisitor(file:)","abstract":"

Produce a ViolationsSyntaxVisitor for the given file.

","parent_name":"SwiftSyntaxRule"},"Protocols/SwiftSyntaxRule.html#/s:13SwiftLintCore0A10SyntaxRuleP13makeViolation4file9violationAA05StyleG0VAA0aB4FileC_AA08ReasonedeG0VtF":{"name":"makeViolation(file:violation:)","abstract":"

Produce a violation for the given file and absolute position.

","parent_name":"SwiftSyntaxRule"},"Protocols/SwiftSyntaxRule.html#/s:13SwiftLintCore0A10SyntaxRuleP10preprocess4file0aD0010SourceFileD0VSgAA0abI0C_tF":{"name":"preprocess(file:)","abstract":"

Gives a chance for the rule to do some pre-processing on the syntax tree.","parent_name":"SwiftSyntaxRule"},"Protocols/SwiftSyntaxRule.html#/s:13SwiftLintCore4RuleP8validate4fileSayAA14StyleViolationVGAA0aB4FileC_tF":{"name":"validate(file:)","parent_name":"SwiftSyntaxRule"},"Protocols/SwiftSyntaxCorrectableRule.html#/s:13SwiftLintCore0A21SyntaxCorrectableRuleP12makeRewriter4fileAA010ViolationsdH0Cy17ConfigurationTypeQzGSgAA0aB4FileC_tF":{"name":"makeRewriter(file:)","abstract":"

Produce a ViolationsSyntaxRewriter for the given file.

","parent_name":"SwiftSyntaxCorrectableRule"},"Protocols/SwiftSyntaxCorrectableRule.html#/s:13SwiftLintCore15CorrectableRuleP7correct4fileSayAA10CorrectionVGAA0aB4FileC_tF":{"name":"correct(file:)","parent_name":"SwiftSyntaxCorrectableRule"},"Protocols/SeverityBasedRuleConfiguration.html#/s:13SwiftLintCore30SeverityBasedRuleConfigurationP08severityG0AA0dG0Vy6ParentQzGvp":{"name":"severityConfiguration","abstract":"

The configuration of a rule’s severity.

","parent_name":"SeverityBasedRuleConfiguration"},"Protocols/SeverityBasedRuleConfiguration.html#/s:13SwiftLintCore30SeverityBasedRuleConfigurationPAAE8severityAA09ViolationD0Ovp":{"name":"severity","abstract":"

The severity of a rule.

","parent_name":"SeverityBasedRuleConfiguration"},"Protocols/RuleConfiguration.html#/s:13SwiftLintCore17RuleConfigurationP6ParentQa":{"name":"Parent","abstract":"

The type of the rule that’s using this configuration.

","parent_name":"RuleConfiguration"},"Protocols/RuleConfiguration.html#/s:13SwiftLintCore17RuleConfigurationP20parameterDescriptionAA0deG0VSgvp":{"name":"parameterDescription","abstract":"

A description for this configuration’s parameters. It can be built using the annotated result builder.

","parent_name":"RuleConfiguration"},"Protocols/RuleConfiguration.html#/s:13SwiftLintCore17RuleConfigurationP5apply13configurationyyp_tKF":{"name":"apply(configuration:)","abstract":"

Apply an untyped configuration to the current value.

","parent_name":"RuleConfiguration"},"Protocols/RuleConfiguration.html#/s:13SwiftLintCore17RuleConfigurationP8validateyyKF":{"name":"validate()","abstract":"

Run a sanity check on the configuration, perform optional postprocessing steps and/or warn about potential","parent_name":"RuleConfiguration"},"Protocols/RuleConfiguration.html#/s:13SwiftLintCore17RuleConfigurationPAAE13supportedKeysShySSGvp":{"name":"supportedKeys","abstract":"

All keys supported by this configuration.

","parent_name":"RuleConfiguration"},"Protocols/AnalyzerRule.html#/s:13SwiftLintCore4RuleP8validate4fileSayAA14StyleViolationVGAA0aB4FileC_tF":{"name":"validate(file:)","parent_name":"AnalyzerRule"},"Protocols/SubstitutionCorrectableRule.html#/s:13SwiftLintCore27SubstitutionCorrectableRuleP15violationRanges2inSaySo8_NSRangeVGAA0aB4FileC_tF":{"name":"violationRanges(in:)","abstract":"

Returns the NSString-based NSRanges to be replaced in the specified file.

","parent_name":"SubstitutionCorrectableRule"},"Protocols/SubstitutionCorrectableRule.html#/s:13SwiftLintCore27SubstitutionCorrectableRuleP12substitution3for2inSo8_NSRangeV_SStSgAH_AA0aB4FileCtF":{"name":"substitution(for:in:)","abstract":"

Returns the substitution to apply for the given range.

","parent_name":"SubstitutionCorrectableRule"},"Protocols/SubstitutionCorrectableRule.html#/s:13SwiftLintCore15CorrectableRuleP7correct4fileSayAA10CorrectionVGAA0aB4FileC_tF":{"name":"correct(file:)","parent_name":"SubstitutionCorrectableRule"},"Protocols/CorrectableRule.html#/s:13SwiftLintCore15CorrectableRuleP7correct4file17compilerArgumentsSayAA10CorrectionVGAA0aB4FileC_SaySSGtF":{"name":"correct(file:compilerArguments:)","abstract":"

Attempts to correct the violations to this rule in the specified file.

","parent_name":"CorrectableRule"},"Protocols/CorrectableRule.html#/s:13SwiftLintCore15CorrectableRuleP7correct4fileSayAA10CorrectionVGAA0aB4FileC_tF":{"name":"correct(file:)","abstract":"

Attempts to correct the violations to this rule in the specified file.

","parent_name":"CorrectableRule"},"Protocols/CorrectableRule.html#/s:13SwiftLintCore15CorrectableRuleP7correct4file5using17compilerArgumentsSayAA10CorrectionVGAA0aB4FileC_AA0E7StorageCSaySSGtF":{"name":"correct(file:using:compilerArguments:)","abstract":"

Attempts to correct the violations to this rule in the specified file after collecting file info for all files","parent_name":"CorrectableRule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP17ConfigurationTypeQa":{"name":"ConfigurationType","abstract":"

The type of the configuration used to configure this rule.

","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP11descriptionAA0D11DescriptionVvpZ":{"name":"description","abstract":"

A verbose description of many of this rule’s properties.

","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP13configuration17ConfigurationTypeQzvp":{"name":"configuration","abstract":"

This rule’s configuration.

","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP06shouldB10EmptyFilesSbvp":{"name":"shouldLintEmptyFiles","abstract":"

Whether this rule should be used on empty files. Defaults to false.

","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RulePxycfc":{"name":"init()","abstract":"

A default initializer for rules. All rules need to be trivially initializable.

","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP13configurationxyp_tKcfc":{"name":"init(configuration:)","abstract":"

Creates a rule by applying its configuration.

","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP30createConfigurationDescription16exclusiveOptionsAA0dfG0VShySSG_tF":{"name":"createConfigurationDescription(exclusiveOptions:)","abstract":"

Create a description of how this rule has been configured to run.

","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP8validate4file17compilerArgumentsSayAA14StyleViolationVGAA0aB4FileC_SaySSGtF":{"name":"validate(file:compilerArguments:)","abstract":"

Executes the rule on a file and returns any violations to the rule’s expectations.

","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP8validate4fileSayAA14StyleViolationVGAA0aB4FileC_tF":{"name":"validate(file:)","abstract":"

Executes the rule on a file and returns any violations to the rule’s expectations.

","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP9isEqualToySbAaB_pF":{"name":"isEqualTo(_:)","abstract":"

Whether or not the specified rule is equivalent to the current rule.

","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP11collectInfo3for4into17compilerArgumentsyAA0aB4FileC_AA0D7StorageCSaySSGtF":{"name":"collectInfo(for:into:compilerArguments:)","abstract":"

Collects information for the specified file in a storage object, to be analyzed by a CollectedLinter.

","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP8validate4file5using17compilerArgumentsSayAA14StyleViolationVGAA0aB4FileC_AA0D7StorageCSaySSGtF":{"name":"validate(file:using:compilerArguments:)","abstract":"

Executes the rule on a file after collecting file info for all files and returns any violations to the rule’s","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP13canBeDisabled9violation2bySbAA14StyleViolationV_AA0D10IdentifierOtF":{"name":"canBeDisabled(violation:by:)","abstract":"

Checks if a style violation can be disabled by a command specifying a rule ID. Only the rule can claim that for","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP9isEnabled2in3forSbAA6RegionV_SStF":{"name":"isEnabled(in:for:)","abstract":"

Checks if a the rule is enabled in a given region. A specific rule ID can be provided in case a rule supports","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RulePAAE16cacheDescriptionSSvp":{"name":"cacheDescription","abstract":"

The cache description which will be used to determine if a previous","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RulePAAE10identifierSSvpZ":{"name":"identifier","abstract":"

The rule’s unique identifier which is the same as Rule.description.identifier.

","parent_name":"Rule"},"Protocols/CollectingRule.html#/s:13SwiftLintCore14CollectingRuleP8FileInfoQa":{"name":"FileInfo","abstract":"

The kind of information to collect for each file being linted for this rule.

","parent_name":"CollectingRule"},"Protocols/CollectingRule.html#/s:13SwiftLintCore14CollectingRuleP11collectInfo3for17compilerArguments04FileG0QzAA0abK0C_SaySSGtF":{"name":"collectInfo(for:compilerArguments:)","abstract":"

Collects information for the specified file, to be analyzed by a CollectedLinter.

","parent_name":"CollectingRule"},"Protocols/CollectingRule.html#/s:13SwiftLintCore14CollectingRuleP11collectInfo3for04FileG0QzAA0abI0C_tF":{"name":"collectInfo(for:)","abstract":"

Collects information for the specified file, to be analyzed by a CollectedLinter.

","parent_name":"CollectingRule"},"Protocols/CollectingRule.html#/s:13SwiftLintCore14CollectingRuleP8validate4file13collectedInfo17compilerArgumentsSayAA14StyleViolationVGAA0aB4FileC_SDyAL0nI0QzGSaySSGtF":{"name":"validate(file:collectedInfo:compilerArguments:)","abstract":"

Executes the rule on a file after collecting file info for all files and returns any violations to the rule’s","parent_name":"CollectingRule"},"Protocols/CollectingRule.html#/s:13SwiftLintCore14CollectingRuleP8validate4file13collectedInfoSayAA14StyleViolationVGAA0aB4FileC_SDyAK0lI0QzGtF":{"name":"validate(file:collectedInfo:)","abstract":"

Executes the rule on a file after collecting file info for all files and returns any violations to the rule’s","parent_name":"CollectingRule"},"Protocols/CollectingRule.html#/s:13SwiftLintCore4RuleP11collectInfo3for4into17compilerArgumentsyAA0aB4FileC_AA0D7StorageCSaySSGtF":{"name":"collectInfo(for:into:compilerArguments:)","parent_name":"CollectingRule"},"Protocols/CollectingRule.html#/s:13SwiftLintCore4RuleP8validate4file5using17compilerArgumentsSayAA14StyleViolationVGAA0aB4FileC_AA0D7StorageCSaySSGtF":{"name":"validate(file:using:compilerArguments:)","parent_name":"CollectingRule"},"Protocols/CollectingRule.html#/s:13SwiftLintCore4RuleP8validate4fileSayAA14StyleViolationVGAA0aB4FileC_tF":{"name":"validate(file:)","parent_name":"CollectingRule"},"Protocols/CollectingRule.html#/s:13SwiftLintCore4RuleP8validate4file17compilerArgumentsSayAA14StyleViolationVGAA0aB4FileC_SaySSGtF":{"name":"validate(file:compilerArguments:)","parent_name":"CollectingRule"},"Protocols/CacheDescriptionProvider.html#/s:13SwiftLintCore24CacheDescriptionProviderP05cacheE0SSvp":{"name":"cacheDescription","abstract":"

The cache description which will be used to determine if a previous","parent_name":"CacheDescriptionProvider"},"Protocols/ASTRule.html#/s:13SwiftLintCore7ASTRuleP8KindTypeQa":{"name":"KindType","abstract":"

The kind of token being recursed over.

","parent_name":"ASTRule"},"Protocols/ASTRule.html#/s:13SwiftLintCore7ASTRuleP8validate4file4kind10dictionarySayAA14StyleViolationVGAA0aB4FileC_8KindTypeQzAA22SourceKittenDictionaryVtF":{"name":"validate(file:kind:dictionary:)","abstract":"

Executes the rule on a file and a subset of its AST structure, returning any violations to the rule’s","parent_name":"ASTRule"},"Protocols/ASTRule.html#/s:13SwiftLintCore7ASTRuleP4kind4from8KindTypeQzSgAA22SourceKittenDictionaryV_tF":{"name":"kind(from:)","abstract":"

Get the kind from the specified dictionary.

","parent_name":"ASTRule"},"Protocols/ASTRule.html#/s:13SwiftLintCore4RuleP8validate4fileSayAA14StyleViolationVGAA0aB4FileC_tF":{"name":"validate(file:)","parent_name":"ASTRule"},"Protocols/ASTRule.html#/s:13SwiftLintCore7ASTRulePAAE8validate4file10dictionarySayAA14StyleViolationVGAA0aB4FileC_AA22SourceKittenDictionaryVtF":{"name":"validate(file:dictionary:)","abstract":"

Executes the rule on a file and a subset of its AST structure, returning any violations to the rule’s","parent_name":"ASTRule"},"Protocols/VersionComparable.html#/s:13SwiftLintCore17VersionComparableP8rawValueSSvp":{"name":"rawValue","abstract":"

The version string.

","parent_name":"VersionComparable"},"Protocols/VersionComparable.html#/s:SQ2eeoiySbx_xtFZ":{"name":"==(_:_:)","parent_name":"VersionComparable"},"Protocols/VersionComparable.html#/s:SL1loiySbx_xtFZ":{"name":"<(_:_:)","parent_name":"VersionComparable"},"Protocols/AcceptableByConfigurationElement.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP7fromAny7contextxyp_SStKcfc":{"name":"init(fromAny:context:)","abstract":"

Initializer taking a value from a configuration to create an element of Self.

","parent_name":"AcceptableByConfigurationElement"},"Protocols/AcceptableByConfigurationElement.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP8asOptionAA0I4TypeOyF":{"name":"asOption()","abstract":"

Make the object an option.

","parent_name":"AcceptableByConfigurationElement"},"Protocols/AcceptableByConfigurationElement.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP13asDescription4withAA04RulefI0VSS_tF":{"name":"asDescription(with:)","abstract":"

Make the object a description.

","parent_name":"AcceptableByConfigurationElement"},"Protocols/AcceptableByConfigurationElement.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP5apply_6ruleIDyyp_SStKF":{"name":"apply(_:ruleID:)","abstract":"

Update the object.

","parent_name":"AcceptableByConfigurationElement"},"Protocols/Documentable.html#/s:13SwiftLintCore12DocumentableP8markdownSSyF":{"name":"markdown()","abstract":"

Convert an object to Markdown.

","parent_name":"Documentable"},"Protocols/Documentable.html#/s:13SwiftLintCore12DocumentableP8oneLinerSSyF":{"name":"oneLiner()","abstract":"

Convert an object to a single line string.

","parent_name":"Documentable"},"Protocols/Documentable.html#/s:13SwiftLintCore12DocumentableP10hasContentSbvp":{"name":"hasContent","abstract":"

Indicate if the item has some content that is useful to document.

","parent_name":"Documentable"},"Protocols/Documentable.html#/s:13SwiftLintCore12DocumentableP4yamlSSyF":{"name":"yaml()","abstract":"

Convert an object to YAML as used in .swiftlint.yml.

","parent_name":"Documentable"},"Protocols/Documentable.html":{"name":"Documentable","abstract":"

A type that can be converted into a human-readable representation.

"},"Protocols/AcceptableByConfigurationElement.html":{"name":"AcceptableByConfigurationElement","abstract":"

Type of an object that can be used as a configuration element.

"},"Protocols.html#/s:13SwiftLintCore19InlinableOptionTypeP":{"name":"InlinableOptionType","abstract":"

An option type that can appear inlined into its using configuration.

"},"Protocols/VersionComparable.html":{"name":"VersionComparable","abstract":"

A comparable major.minor.patch version number.

"},"Protocols/ASTRule.html":{"name":"ASTRule","abstract":"

A rule that leverages the Swift source’s pre-typechecked Abstract Syntax Tree to recurse into the source’s"},"Protocols/CacheDescriptionProvider.html":{"name":"CacheDescriptionProvider","abstract":"

Interface providing access to a cache description.

"},"Protocols.html#/s:13SwiftLintCore17AnyCollectingRuleP":{"name":"AnyCollectingRule","abstract":"

Type-erased protocol used to check whether a rule is collectable.

"},"Protocols/CollectingRule.html":{"name":"CollectingRule","abstract":"

A rule that requires knowledge of all other files being linted.

"},"Protocols/Rule.html":{"name":"Rule","abstract":"

An executable value that can identify issues (violations) in Swift source code.

"},"Protocols.html#/s:13SwiftLintCore9OptInRuleP":{"name":"OptInRule","abstract":"

A rule that is not enabled by default. Rules conforming to this need to be explicitly enabled by users.

"},"Protocols/CorrectableRule.html":{"name":"CorrectableRule","abstract":"

A rule that can correct violations.

"},"Protocols/SubstitutionCorrectableRule.html":{"name":"SubstitutionCorrectableRule","abstract":"

A correctable rule that can apply its corrections by replacing the content of ranges in the offending file with"},"Protocols.html#/s:13SwiftLintCore17SourceKitFreeRuleP":{"name":"SourceKitFreeRule","abstract":"

A rule that does not need SourceKit to operate and can still operate even after SourceKit has crashed.

"},"Protocols/AnalyzerRule.html":{"name":"AnalyzerRule","abstract":"

A rule that can operate on the post-typechecked AST using compiler arguments. Performs rules that are more like"},"Protocols/RuleConfiguration.html":{"name":"RuleConfiguration","abstract":"

A configuration value for a rule to allow users to modify its behavior.

"},"Protocols/SeverityBasedRuleConfiguration.html":{"name":"SeverityBasedRuleConfiguration","abstract":"

A configuration for a rule that allows to configure at least the severity.

"},"Protocols/SwiftSyntaxCorrectableRule.html":{"name":"SwiftSyntaxCorrectableRule","abstract":"

A SwiftLint CorrectableRule that performs its corrections using a SwiftSyntax SyntaxRewriter.

"},"Protocols/SwiftSyntaxRule.html":{"name":"SwiftSyntaxRule","abstract":"

A SwiftLint Rule backed by SwiftSyntax that does not use SourceKit requests.

"},"Extensions/Double.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP8asOptionAA0I4TypeOyF":{"name":"asOption()","parent_name":"Double"},"Extensions/Double.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP7fromAny7contextxyp_SStKcfc":{"name":"init(fromAny:context:)","parent_name":"Double"},"Extensions/Int.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP8asOptionAA0I4TypeOyF":{"name":"asOption()","parent_name":"Int"},"Extensions/Int.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP7fromAny7contextxyp_SStKcfc":{"name":"init(fromAny:context:)","parent_name":"Int"},"Extensions/Set.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP8asOptionAA0I4TypeOyF":{"name":"asOption()","parent_name":"Set"},"Extensions/Set.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP7fromAny7contextxyp_SStKcfc":{"name":"init(fromAny:context:)","parent_name":"Set"},"Extensions/String.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP8asOptionAA0I4TypeOyF":{"name":"asOption()","parent_name":"String"},"Extensions/String.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP7fromAny7contextxyp_SStKcfc":{"name":"init(fromAny:context:)","parent_name":"String"},"Extensions/Bool.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP8asOptionAA0I4TypeOyF":{"name":"asOption()","parent_name":"Bool"},"Extensions/Bool.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP7fromAny7contextxyp_SStKcfc":{"name":"init(fromAny:context:)","parent_name":"Bool"},"Extensions/Optional.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP8asOptionAA0I4TypeOyF":{"name":"asOption()","parent_name":"Optional"},"Extensions/Optional.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP7fromAny7contextxyp_SStKcfc":{"name":"init(fromAny:context:)","parent_name":"Optional"},"Extensions/Array.html#/s:Sa13SwiftLintCoreAA7ExampleVRszlE26skipWrappingInCommentTestsSayACGyF":{"name":"skipWrappingInCommentTests()","abstract":"

Make these examples skip wrapping in comment tests.

","parent_name":"Array"},"Extensions/Array.html#/s:Sa13SwiftLintCoreAA7ExampleVRszlE25skipWrappingInStringTestsSayACGyF":{"name":"skipWrappingInStringTests()","abstract":"

Make these examples skip wrapping in string tests.

","parent_name":"Array"},"Extensions/Array.html#/s:Sa13SwiftLintCoreAA7ExampleVRszlE24skipMultiByteOffsetTestsSayACGyF":{"name":"skipMultiByteOffsetTests()","abstract":"

Make these examples skip multi-byte offset tests.

","parent_name":"Array"},"Extensions/Array.html#/s:Sa13SwiftLintCoreAA7ExampleVRszlE23skipDisableCommandTestsSayACGyF":{"name":"skipDisableCommandTests()","abstract":"

Make these examples skip disable command tests.

","parent_name":"Array"},"Extensions/Array.html#/s:Sa13SwiftLintCoreAA7ExampleVRszlE23removingViolationMarkerSayACGyF":{"name":"removingViolationMarker()","abstract":"

Remove all violation markers from the examples.

","parent_name":"Array"},"Extensions/Array.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP8asOptionAA0I4TypeOyF":{"name":"asOption()","parent_name":"Array"},"Extensions/Array.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP7fromAny7contextxyp_SStKcfc":{"name":"init(fromAny:context:)","parent_name":"Array"},"Extensions/Array.html#/s:Sa13SwiftLintCoreAA0aB11SyntaxTokenVRszlE5kindsSay21SourceKittenFramework0D4KindOGvp":{"name":"kinds","abstract":"

The kinds for these tokens.

","parent_name":"Array"},"Extensions/Array.html#/s:Sa13SwiftLintCoreAA21ReasonedRuleViolationVRszlE6appendyy0A6Syntax16AbsolutePositionVF":{"name":"append(_:)","abstract":"

Add a violation at the specified position using the default description and severity.

","parent_name":"Array"},"Extensions/Array.html#/s:Sa13SwiftLintCoreAA21ReasonedRuleViolationVRszlE6append2at10correctiony0A6Syntax16AbsolutePositionV_AC0F10CorrectionVSgtF":{"name":"append(at:correction:)","abstract":"

Add a violation and the correction at the specified position using the default description and severity.

","parent_name":"Array"},"Extensions/Array.html#/s:Sa13SwiftLintCoreAA21ReasonedRuleViolationVRszlE6append10contentsOfySay0A6Syntax16AbsolutePositionVG_tF":{"name":"append(contentsOf:)","abstract":"

Add violations for the specified positions using the default description and severity.

","parent_name":"Array"},"Extensions/Array.html#/s:Sa13SwiftLintCore0A6Syntax04DeclD8Protocol_pXpRszlE3allSayAbC_pXpGvpZ":{"name":"all","abstract":"

All visitable declaration syntax types.

","parent_name":"Array"},"Extensions/Array.html#/s:Sa13SwiftLintCore0A6Syntax04DeclD8Protocol_pXpRszlE9allExceptySayAbC_pXpGAbC_pXpd_tFZ":{"name":"allExcept(_:)","abstract":"

All declarations except for the specified ones.

","parent_name":"Array"},"Extensions/Array.html":{"name":"Array"},"Extensions/Optional.html":{"name":"Optional"},"Extensions/Bool.html":{"name":"Bool"},"Extensions/String.html":{"name":"String"},"Extensions/Set.html":{"name":"Set"},"Extensions/Int.html":{"name":"Int"},"Extensions/Double.html":{"name":"Double"},"Enums/IdentifierDeclaration.html#/s:13SwiftLintCore21IdentifierDeclarationO9parameteryAC0A6Syntax05TokenG0V_tcACmF":{"name":"parameter(name:)","abstract":"

Parameter declaration with a name token.

","parent_name":"IdentifierDeclaration"},"Enums/IdentifierDeclaration.html#/s:13SwiftLintCore21IdentifierDeclarationO13localVariableyAC0A6Syntax05TokenH0V_tcACmF":{"name":"localVariable(name:)","abstract":"

Local variable declaration with a name token.

","parent_name":"IdentifierDeclaration"},"Enums/IdentifierDeclaration.html#/s:13SwiftLintCore21IdentifierDeclarationO16implicitVariableyACSS_tcACmF":{"name":"implicitVariable(name:)","abstract":"

A variable that is implicitly added by the compiler (e.g. error in catch clauses).

","parent_name":"IdentifierDeclaration"},"Enums/IdentifierDeclaration.html#/s:13SwiftLintCore21IdentifierDeclarationO8wildcardyA2CmF":{"name":"wildcard","abstract":"

A variable hidden from scope because its name is a wildcard _.

","parent_name":"IdentifierDeclaration"},"Enums/IdentifierDeclaration.html#/s:13SwiftLintCore21IdentifierDeclarationO14lookupBoundaryyA2CmF":{"name":"lookupBoundary","abstract":"

Special case that marks a type boundary at which name lookup stops.

","parent_name":"IdentifierDeclaration"},"Enums/IdentifierDeclaration.html#/s:13SwiftLintCore21IdentifierDeclarationO8declares2id18disregardBackticksSbSS_SbtF":{"name":"declares(id:disregardBackticks:)","abstract":"

Check whether self declares a variable given by name.

","parent_name":"IdentifierDeclaration"},"Enums/ViolationSeverity.html#/s:13SwiftLintCore17ViolationSeverityO7warningyA2CmF":{"name":"warning","abstract":"

Non-fatal. If using SwiftLint as an Xcode build phase, Xcode will mark the build as having succeeded.

","parent_name":"ViolationSeverity"},"Enums/ViolationSeverity.html#/s:13SwiftLintCore17ViolationSeverityO5erroryA2CmF":{"name":"error","abstract":"

Fatal. If using SwiftLint as an Xcode build phase, Xcode will mark the build as having failed.

","parent_name":"ViolationSeverity"},"Enums/ViolationSeverity.html#/s:SL1loiySbx_xtFZ":{"name":"<(_:_:)","parent_name":"ViolationSeverity"},"Enums/SwiftExpressionKind.html#/s:13SwiftLintCore0A14ExpressionKindO4callyA2CmF":{"name":"call","abstract":"

A call to a named function or closure.

","parent_name":"SwiftExpressionKind"},"Enums/SwiftExpressionKind.html#/s:13SwiftLintCore0A14ExpressionKindO8argumentyA2CmF":{"name":"argument","abstract":"

An argument value for a function or closure.

","parent_name":"SwiftExpressionKind"},"Enums/SwiftExpressionKind.html#/s:13SwiftLintCore0A14ExpressionKindO5arrayyA2CmF":{"name":"array","abstract":"

An Array expression.

","parent_name":"SwiftExpressionKind"},"Enums/SwiftExpressionKind.html#/s:13SwiftLintCore0A14ExpressionKindO10dictionaryyA2CmF":{"name":"dictionary","abstract":"

A Dictionary expression.

","parent_name":"SwiftExpressionKind"},"Enums/SwiftExpressionKind.html#/s:13SwiftLintCore0A14ExpressionKindO13objectLiteralyA2CmF":{"name":"objectLiteral","abstract":"

An object literal expression. https://developer.apple.com/swift/blog/?id=33

","parent_name":"SwiftExpressionKind"},"Enums/SwiftExpressionKind.html#/s:13SwiftLintCore0A14ExpressionKindO7closureyA2CmF":{"name":"closure","abstract":"

A closure expression. https://docs.swift.org/swift-book/LanguageGuide/Closures.html

","parent_name":"SwiftExpressionKind"},"Enums/SwiftExpressionKind.html#/s:13SwiftLintCore0A14ExpressionKindO5tupleyA2CmF":{"name":"tuple","abstract":"

A tuple expression. https://docs.swift.org/swift-book/ReferenceManual/Types.html#ID448

","parent_name":"SwiftExpressionKind"},"Enums/RuleListError.html#/s:13SwiftLintCore13RuleListErrorO24duplicatedConfigurationsyAcA0D0_pXp_tcACmF":{"name":"duplicatedConfigurations(rule:)","abstract":"

The rule list contains more than one configuration for the specified rule.

","parent_name":"RuleListError"},"Enums/RuleKind.html#/s:13SwiftLintCore8RuleKindO4lintyA2CmF":{"name":"lint","abstract":"

Describes rules that validate Swift source conventions.

","parent_name":"RuleKind"},"Enums/RuleKind.html#/s:13SwiftLintCore8RuleKindO9idiomaticyA2CmF":{"name":"idiomatic","abstract":"

Describes rules that validate common practices in the Swift community.

","parent_name":"RuleKind"},"Enums/RuleKind.html#/s:13SwiftLintCore8RuleKindO5styleyA2CmF":{"name":"style","abstract":"

Describes rules that validate stylistic choices.

","parent_name":"RuleKind"},"Enums/RuleKind.html#/s:13SwiftLintCore8RuleKindO7metricsyA2CmF":{"name":"metrics","abstract":"

Describes rules that validate magnitudes or measurements of Swift source.

","parent_name":"RuleKind"},"Enums/RuleKind.html#/s:13SwiftLintCore8RuleKindO11performanceyA2CmF":{"name":"performance","abstract":"

Describes rules that validate that code patterns with poor performance are avoided.

","parent_name":"RuleKind"},"Enums/RuleIdentifier.html#/s:13SwiftLintCore14RuleIdentifierO3allyA2CmF":{"name":"all","abstract":"

Special identifier that should be treated as referring to ‘all’ SwiftLint rules. One helpful usecase is in","parent_name":"RuleIdentifier"},"Enums/RuleIdentifier.html#/s:13SwiftLintCore14RuleIdentifierO6singleyACSS_tcACmF":{"name":"single(identifier:)","abstract":"

Represents a single SwiftLint rule with the specified identifier.

","parent_name":"RuleIdentifier"},"Enums/RuleIdentifier.html#/s:13SwiftLintCore14RuleIdentifierO20stringRepresentationSSvp":{"name":"stringRepresentation","abstract":"

The spelling of the string for this identifier.

","parent_name":"RuleIdentifier"},"Enums/RuleIdentifier.html#/s:13SwiftLintCore14RuleIdentifierOyACSScfc":{"name":"init(_:)","abstract":"

Creates a RuleIdentifier by its string representation.

","parent_name":"RuleIdentifier"},"Enums/RuleIdentifier.html#/s:s26ExpressibleByStringLiteralP06stringD0x0cD4TypeQz_tcfc":{"name":"init(stringLiteral:)","parent_name":"RuleIdentifier"},"Enums/RuleIdentifier.html#/s:SL1loiySbx_xtFZ":{"name":"<(_:_:)","parent_name":"RuleIdentifier"},"Enums/OptionType.html#/s:13SwiftLintCore10OptionTypeO5emptyyA2CmF":{"name":"empty","abstract":"

An irrelevant option. It will be ignored in documentation serialization.

","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore10OptionTypeO4flagyACSbcACmF":{"name":"flag(_:)","abstract":"

A boolean flag.

","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore10OptionTypeO6stringyACSScACmF":{"name":"string(_:)","abstract":"

A string option.

","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore10OptionTypeO6symbolyACSScACmF":{"name":"symbol(_:)","abstract":"

Like a string option but without quotes in the serialized output.

","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore10OptionTypeO7integeryACSicACmF":{"name":"integer(_:)","abstract":"

An integer option.

","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore10OptionTypeO5floatyACSdcACmF":{"name":"float(_:)","abstract":"

A floating point number option.

","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore10OptionTypeO8severityyAcA17ViolationSeverityOcACmF":{"name":"severity(_:)","abstract":"

Special option for a ViolationSeverity.

","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore10OptionTypeO4listyACSayACGcACmF":{"name":"list(_:)","abstract":"

A list of options.

","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore10OptionTypeO6nestedyAcA28RuleConfigurationDescriptionVcACmF":{"name":"nested(_:)","abstract":"

An option which is another set of configuration options to be nested in the serialized output.

","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore12DocumentableP10hasContentSbvp":{"name":"hasContent","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore12DocumentableP8markdownSSyF":{"name":"markdown()","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore12DocumentableP8oneLinerSSyF":{"name":"oneLiner()","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore12DocumentableP4yamlSSyF":{"name":"yaml()","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore10OptionTypeO2egoiyAA017RuleConfigurationD0VSS_ACtFZ":{"name":"=>(_:_:)","abstract":"

Operator enabling an easy way to create a configuration option.

","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore10OptionTypeO4nestyAcA28RuleConfigurationDescriptionVyXEFZ":{"name":"nest(_:)","abstract":"

Create an option defined by nested configuration description.

","parent_name":"OptionType"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO20invalidConfigurationyACSS_SSSgtcACmF":{"name":"invalidConfiguration(ruleID:message:)","abstract":"

The configuration didn’t match internal expectations.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO19invalidRegexPatternyACSS_SStcACmF":{"name":"invalidRegexPattern(ruleID:pattern:)","abstract":"

Issued when a regular expression pattern is invalid.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO29deprecatedConfigurationOptionyACSS_S2SSgtcACmF":{"name":"deprecatedConfigurationOption(ruleID:key:alternative:)","abstract":"

Issued when an option is deprecated. Suggests an alternative optionally.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO14nothingAppliedyACSS_tcACmF":{"name":"nothingApplied(ruleID:)","abstract":"

Used in configuration parsing when no changes have been applied. Use only internally!

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO18listedMultipleTimeyACSS_SitcACmF":{"name":"listedMultipleTime(ruleID:times:)","abstract":"

Rule is listed multiple times in the configuration.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO17renamedIdentifieryACSS_SStcACmF":{"name":"renamedIdentifier(old:new:)","abstract":"

An identifier old has been renamed to new.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO24invalidConfigurationKeysyACSS_ShySSGtcACmF":{"name":"invalidConfigurationKeys(ruleID:keys:)","abstract":"

Some configuration keys are invalid.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO25inconsistentConfigurationyACSS_SStcACmF":{"name":"inconsistentConfiguration(ruleID:message:)","abstract":"

The configuration is inconsistent, that is options are mutually exclusive or one drives other values","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO14invalidRuleIDsyACShySSGcACmF":{"name":"invalidRuleIDs(_:)","abstract":"

Used rule IDs are invalid.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO25ruleNotPresentInOnlyRulesyACSS_tcACmF":{"name":"ruleNotPresentInOnlyRules(ruleID:)","abstract":"

Found a rule configuration for a rule that is not present in only_rules.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO014ruleDisabledInF5RulesyACSS_tcACmF":{"name":"ruleDisabledInDisabledRules(ruleID:)","abstract":"

Found a rule configuration for a rule that is disabled.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO33ruleDisabledInParentConfigurationyACSS_tcACmF":{"name":"ruleDisabledInParentConfiguration(ruleID:)","abstract":"

Found a rule configuration for a rule that is disabled in the parent configuration.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO019ruleNotEnabledInOptH5RulesyACSS_tcACmF":{"name":"ruleNotEnabledInOptInRules(ruleID:)","abstract":"

Found a rule configuration for a rule that is not enabled in opt_in_rules.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO31ruleNotEnabledInParentOnlyRulesyACSS_tcACmF":{"name":"ruleNotEnabledInParentOnlyRules(ruleID:)","abstract":"

Found a rule configuration for a rule that is not enabled in parent only_rules.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO14genericWarningyACSScACmF":{"name":"genericWarning(_:)","abstract":"

A generic warning specified by a string.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO12genericErroryACSScACmF":{"name":"genericError(_:)","abstract":"

A generic error specified by a string.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO14ruleDeprecatedyACSS_tcACmF":{"name":"ruleDeprecated(ruleID:)","abstract":"

A deprecation warning for a rule.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO19initialFileNotFoundyACSS_tcACmF":{"name":"initialFileNotFound(path:)","abstract":"

The initial configuration file was not found.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO12fileNotFoundyACSS_tcACmF":{"name":"fileNotFound(path:)","abstract":"

A file at specified path was not found.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO15fileNotReadableyACSSSg_SStcACmF":{"name":"fileNotReadable(path:ruleID:)","abstract":"

The file at path is not readable or cannot be opened.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO15fileNotWritableyACSS_tcACmF":{"name":"fileNotWritable(path:)","abstract":"

The file at path is not writable.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO13indexingErroryACSSSg_SStcACmF":{"name":"indexingError(path:ruleID:)","abstract":"

The file at path cannot be indexed by a specific rule.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO24missingCompilerArgumentsyACSSSg_SStcACmF":{"name":"missingCompilerArguments(path:ruleID:)","abstract":"

No arguments were provided to compile a file at path within a specific rule.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO17missingCursorInfoyACSSSg_SStcACmF":{"name":"missingCursorInfo(path:ruleID:)","abstract":"

Cursor information cannot be extracted from a specific location.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO11yamlParsingyACSScACmF":{"name":"yamlParsing(_:)","abstract":"

An error that occurred when parsing YAML.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO19baselineNotReadableyACSS_tcACmF":{"name":"baselineNotReadable(path:)","abstract":"

The baseline file at path is not readable or cannot be opened.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO5printyyF":{"name":"print()","abstract":"

Print the issue to the console.

","parent_name":"Issue"},"Enums/AccessControlLevel.html#/s:13SwiftLintCore18AccessControlLevelO7privateyA2CmF":{"name":"private","abstract":"

Accessible by the declaration’s immediate lexical scope.

","parent_name":"AccessControlLevel"},"Enums/AccessControlLevel.html#/s:13SwiftLintCore18AccessControlLevelO11fileprivateyA2CmF":{"name":"fileprivate","abstract":"

Accessible by the declaration’s same file.

","parent_name":"AccessControlLevel"},"Enums/AccessControlLevel.html#/s:13SwiftLintCore18AccessControlLevelO8internalyA2CmF":{"name":"internal","abstract":"

Accessible by the declaration’s same module, or modules importing it with the @testable attribute.

","parent_name":"AccessControlLevel"},"Enums/AccessControlLevel.html#/s:13SwiftLintCore18AccessControlLevelO7packageyA2CmF":{"name":"package","abstract":"

Accessible by all the modules defined in the same Swift package.

","parent_name":"AccessControlLevel"},"Enums/AccessControlLevel.html#/s:13SwiftLintCore18AccessControlLevelO6publicyA2CmF":{"name":"public","abstract":"

Accessible by the declaration’s same program.

","parent_name":"AccessControlLevel"},"Enums/AccessControlLevel.html#/s:13SwiftLintCore18AccessControlLevelO4openyA2CmF":{"name":"open","abstract":"

Accessible and customizable (via subclassing or overrides) by the declaration’s same program.

","parent_name":"AccessControlLevel"},"Enums/AccessControlLevel.html#/s:13SwiftLintCore18AccessControlLevelO11descriptionACSgSS_tcfc":{"name":"init(description:)","abstract":"

Initializes an access control level by its Swift source keyword value.

","parent_name":"AccessControlLevel"},"Enums/AccessControlLevel.html#/s:s23CustomStringConvertibleP11descriptionSSvp":{"name":"description","parent_name":"AccessControlLevel"},"Enums/AccessControlLevel.html#/s:13SwiftLintCore18AccessControlLevelO9isPrivateSbvp":{"name":"isPrivate","abstract":"

Returns true if is private or fileprivate

","parent_name":"AccessControlLevel"},"Enums/AccessControlLevel.html#/s:SL1loiySbx_xtFZ":{"name":"<(_:_:)","parent_name":"AccessControlLevel"},"Enums/AccessControlLevel.html":{"name":"AccessControlLevel","abstract":"

The accessibility of a Swift source declaration.

"},"Enums/Issue.html":{"name":"Issue","abstract":"

All possible SwiftLint issues which are printed as warnings by default.

"},"Enums/OptionType.html":{"name":"OptionType","abstract":"

Type of an option.

"},"Enums/RuleIdentifier.html":{"name":"RuleIdentifier","abstract":"

An identifier representing a SwiftLint rule, or all rules.

"},"Enums/RuleKind.html":{"name":"RuleKind","abstract":"

All the possible rule kinds (categories).

"},"Enums/RuleListError.html":{"name":"RuleListError","abstract":"

All possible rule list configuration errors.

"},"Enums/SwiftExpressionKind.html":{"name":"SwiftExpressionKind","abstract":"

The kind of expression for a contiguous set of Swift source tokens.

"},"Enums/ViolationSeverity.html":{"name":"ViolationSeverity","abstract":"

The magnitude of a StyleViolation.

"},"Enums/IdentifierDeclaration.html":{"name":"IdentifierDeclaration","abstract":"

An identifier declaration.

"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC13configurationxvp":{"name":"configuration","abstract":"

A rule’s configuration.

","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC4fileAA0aB4FileCvp":{"name":"file","abstract":"

The file from which the traversed syntax tree stems from.

","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC17locationConverter0aE0014SourceLocationH0Cvp":{"name":"locationConverter","abstract":"

A source location converter associated with the syntax tree being traversed.

","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC13configuration4fileACyxGx_AA0aB4FileCtcfc":{"name":"init(configuration:file:)","abstract":"

Initializer for a ViolationsSyntaxVisitor.

","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC10violationsSayAA21ReasonedRuleViolationVGvp":{"name":"violations","abstract":"

Positions in a source file where violations should be reported.

","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC21skippableDeclarationsSay0aE004DeclE8Protocol_pXpGvp":{"name":"skippableDeclarations","abstract":"

List of declaration types that shall be skipped while traversing the AST.

","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC5visity0aE00eF12ContinueKindOAE09ActorDeclE0VF":{"name":"visit(_:)","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC5visity0aE00eF12ContinueKindOAE09ClassDeclE0VF":{"name":"visit(_:)","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC5visity0aE00eF12ContinueKindOAE08EnumDeclE0VF":{"name":"visit(_:)","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC5visity0aE00eF12ContinueKindOAE013ExtensionDeclE0VF":{"name":"visit(_:)","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC5visity0aE00eF12ContinueKindOAE012FunctionDeclE0VF":{"name":"visit(_:)","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC5visity0aE00eF12ContinueKindOAE015InitializerDeclE0VF":{"name":"visit(_:)","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC5visity0aE00eF12ContinueKindOAE012ProtocolDeclE0VF":{"name":"visit(_:)","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC5visity0aE00eF12ContinueKindOAE010StructDeclE0VF":{"name":"visit(_:)","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC5visity0aE00eF12ContinueKindOAE013SubscriptDeclE0VF":{"name":"visit(_:)","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC5visity0aE00eF12ContinueKindOAE012VariableDeclE0VF":{"name":"visit(_:)","parent_name":"ViolationsSyntaxVisitor"},"Classes/DeclaredIdentifiersTrackingVisitor.html#/s:13SwiftLintCore34DeclaredIdentifiersTrackingVisitorC5Scopea":{"name":"Scope","abstract":"

A type that remembers the declared identifiers (in order) up to the current position in the code.

","parent_name":"DeclaredIdentifiersTrackingVisitor"},"Classes/DeclaredIdentifiersTrackingVisitor.html#/s:13SwiftLintCore34DeclaredIdentifiersTrackingVisitorC5scopeAA5StackVySayAA21IdentifierDeclarationOGGvp":{"name":"scope","abstract":"

The hierarchical stack of identifiers declared up to the current position in the code.

","parent_name":"DeclaredIdentifiersTrackingVisitor"},"Classes/DeclaredIdentifiersTrackingVisitor.html#/s:13SwiftLintCore34DeclaredIdentifiersTrackingVisitorC13configuration4file5scopeACyxGx_AA0aB4FileCAA5StackVySayAA21IdentifierDeclarationOGGtcfc":{"name":"init(configuration:file:scope:)","abstract":"

Initializer.

","parent_name":"DeclaredIdentifiersTrackingVisitor"},"Classes/DeclaredIdentifiersTrackingVisitor.html#/s:13SwiftLintCore34DeclaredIdentifiersTrackingVisitorC18hasSeenDeclaration3forSbSS_tF":{"name":"hasSeenDeclaration(for:)","abstract":"

Indicate whether a given identifier is in scope.

","parent_name":"DeclaredIdentifiersTrackingVisitor"},"Classes/DeclaredIdentifiersTrackingVisitor.html#/s:13SwiftLintCore34DeclaredIdentifiersTrackingVisitorC5visity0A6Syntax0iG12ContinueKindOAE017CodeBlockItemListI0VF":{"name":"visit(_:)","parent_name":"DeclaredIdentifiersTrackingVisitor"},"Classes/DeclaredIdentifiersTrackingVisitor.html#/s:13SwiftLintCore34DeclaredIdentifiersTrackingVisitorC9visitPostyy0A6Syntax017CodeBlockItemListJ0VF":{"name":"visitPost(_:)","parent_name":"DeclaredIdentifiersTrackingVisitor"},"Classes/DeclaredIdentifiersTrackingVisitor.html#/s:13SwiftLintCore34DeclaredIdentifiersTrackingVisitorC9visitPostyy0A6Syntax012VariableDeclJ0VF":{"name":"visitPost(_:)","parent_name":"DeclaredIdentifiersTrackingVisitor"},"Classes/DeclaredIdentifiersTrackingVisitor.html#/s:13SwiftLintCore34DeclaredIdentifiersTrackingVisitorC9visitPostyy0A6Syntax09GuardStmtJ0VF":{"name":"visitPost(_:)","parent_name":"DeclaredIdentifiersTrackingVisitor"},"Classes/DeclaredIdentifiersTrackingVisitor.html#/s:13SwiftLintCore34DeclaredIdentifiersTrackingVisitorC5visity0A6Syntax0iG12ContinueKindOAE011MemberBlockI0VF":{"name":"visit(_:)","parent_name":"DeclaredIdentifiersTrackingVisitor"},"Classes/DeclaredIdentifiersTrackingVisitor.html#/s:13SwiftLintCore34DeclaredIdentifiersTrackingVisitorC9visitPostyy0A6Syntax011MemberBlockJ0VF":{"name":"visitPost(_:)","parent_name":"DeclaredIdentifiersTrackingVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC13configuration4fileACyxGx_AA0aB4FileCtcfc":{"name":"init(configuration:file:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax012AccessorDeclI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax09ActorDeclI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax011CatchClauseI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax09ClassDeclI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax011ClosureExprI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax09DeferStmtI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax06DoStmtI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax08EnumDeclI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax013ExtensionDeclI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax012FunctionDeclI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax07ForStmtI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax09GuardStmtI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax06IfExprI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax015InitializerDeclI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax014PatternBindingI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax019PrecedenceGroupDeclI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax012ProtocolDeclI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax010RepeatStmtI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax010StructDeclI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax010SwitchExprI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax09WhileStmtI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC17collectViolations3foryqd__Sg_t0A6Syntax06BracedJ0Rd__lF":{"name":"collectViolations(for:)","abstract":"

Collects violations for the given braced item. Intended to be specialized by subclasses.

","parent_name":"CodeBlockVisitor"},"Classes/BodyLengthRuleVisitor/Kind.html#/s:13SwiftLintCore21BodyLengthRuleVisitorC4KindO7closureyAEyx_GAGmAA0F0RzlF":{"name":"closure","abstract":"

Closure code blocks.

","parent_name":"Kind"},"Classes/BodyLengthRuleVisitor/Kind.html#/s:13SwiftLintCore21BodyLengthRuleVisitorC4KindO8functionyAEyx_GAGmAA0F0RzlF":{"name":"function","abstract":"

Function body blocks.

","parent_name":"Kind"},"Classes/BodyLengthRuleVisitor/Kind.html#/s:13SwiftLintCore21BodyLengthRuleVisitorC4KindO4typeyAEyx_GAGmAA0F0RzlF":{"name":"type","abstract":"

Type (class, enum, …) member blocks.

","parent_name":"Kind"},"Classes/BodyLengthRuleVisitor/Kind.html":{"name":"Kind","abstract":"

The code block types to check.

","parent_name":"BodyLengthRuleVisitor"},"Classes/BodyLengthRuleVisitor.html#/s:13SwiftLintCore21BodyLengthRuleVisitorC4kind4file13configurationACyxGAC4KindOyx_G_AA0aB4FileCAA27SeverityLevelsConfigurationVyxGtcfc":{"name":"init(kind:file:configuration:)","abstract":"

Initializer.

","parent_name":"BodyLengthRuleVisitor"},"Classes/BodyLengthRuleVisitor.html#/s:13SwiftLintCore21BodyLengthRuleVisitorC9visitPostyy0A6Syntax08EnumDeclJ0VF":{"name":"visitPost(_:)","parent_name":"BodyLengthRuleVisitor"},"Classes/BodyLengthRuleVisitor.html#/s:13SwiftLintCore21BodyLengthRuleVisitorC9visitPostyy0A6Syntax09ClassDeclJ0VF":{"name":"visitPost(_:)","parent_name":"BodyLengthRuleVisitor"},"Classes/BodyLengthRuleVisitor.html#/s:13SwiftLintCore21BodyLengthRuleVisitorC9visitPostyy0A6Syntax010StructDeclJ0VF":{"name":"visitPost(_:)","parent_name":"BodyLengthRuleVisitor"},"Classes/BodyLengthRuleVisitor.html#/s:13SwiftLintCore21BodyLengthRuleVisitorC9visitPostyy0A6Syntax09ActorDeclJ0VF":{"name":"visitPost(_:)","parent_name":"BodyLengthRuleVisitor"},"Classes/BodyLengthRuleVisitor.html#/s:13SwiftLintCore21BodyLengthRuleVisitorC9visitPostyy0A6Syntax011ClosureExprJ0VF":{"name":"visitPost(_:)","parent_name":"BodyLengthRuleVisitor"},"Classes/BodyLengthRuleVisitor.html#/s:13SwiftLintCore21BodyLengthRuleVisitorC9visitPostyy0A6Syntax012FunctionDeclJ0VF":{"name":"visitPost(_:)","parent_name":"BodyLengthRuleVisitor"},"Classes/BodyLengthRuleVisitor.html#/s:13SwiftLintCore21BodyLengthRuleVisitorC9visitPostyy0A6Syntax015InitializerDeclJ0VF":{"name":"visitPost(_:)","parent_name":"BodyLengthRuleVisitor"},"Classes/CodeIndentingRewriter/IndentationStyle.html#/s:13SwiftLintCore21CodeIndentingRewriterC16IndentationStyleO12indentSpacesyAESicAEmF":{"name":"indentSpaces(_:)","abstract":"

Indentation with a number of spaces.

","parent_name":"IndentationStyle"},"Classes/CodeIndentingRewriter/IndentationStyle.html#/s:13SwiftLintCore21CodeIndentingRewriterC16IndentationStyleO14unindentSpacesyAESicAEmF":{"name":"unindentSpaces(_:)","abstract":"

Reverse indentation of a number of spaces.

","parent_name":"IndentationStyle"},"Classes/CodeIndentingRewriter/IndentationStyle.html#/s:13SwiftLintCore21CodeIndentingRewriterC16IndentationStyleO10indentTabsyAESicAEmF":{"name":"indentTabs(_:)","abstract":"

Indentation with a number of tabs

","parent_name":"IndentationStyle"},"Classes/CodeIndentingRewriter/IndentationStyle.html#/s:13SwiftLintCore21CodeIndentingRewriterC16IndentationStyleO12unindentTabsyAESicAEmF":{"name":"unindentTabs(_:)","abstract":"

Reverse indentation of a number of tabs.

","parent_name":"IndentationStyle"},"Classes/CodeIndentingRewriter/IndentationStyle.html":{"name":"IndentationStyle","abstract":"

Style defining whether the rewriter shall indent or unindent and whether it shall use tabs or spaces and","parent_name":"CodeIndentingRewriter"},"Classes/CodeIndentingRewriter.html#/s:13SwiftLintCore21CodeIndentingRewriterC5styleA2C16IndentationStyleO_tcfc":{"name":"init(style:)","abstract":"

Initializer accepting an indentation style.

","parent_name":"CodeIndentingRewriter"},"Classes/CodeIndentingRewriter.html#/s:13SwiftLintCore21CodeIndentingRewriterC5visity0A6Syntax05TokenH0VAGF":{"name":"visit(_:)","parent_name":"CodeIndentingRewriter"},"Classes/ViolationsSyntaxRewriter.html#/s:13SwiftLintCore24ViolationsSyntaxRewriterC13configurationxvp":{"name":"configuration","abstract":"

A rule’s configuration.

","parent_name":"ViolationsSyntaxRewriter"},"Classes/ViolationsSyntaxRewriter.html#/s:13SwiftLintCore24ViolationsSyntaxRewriterC4fileAA0aB4FileCvp":{"name":"file","abstract":"

The file from which the traversed syntax tree stems from.

","parent_name":"ViolationsSyntaxRewriter"},"Classes/ViolationsSyntaxRewriter.html#/s:13SwiftLintCore24ViolationsSyntaxRewriterC17locationConverter0aE0014SourceLocationH0Cvp":{"name":"locationConverter","abstract":"

A converter of positions in the traversed source file.

","parent_name":"ViolationsSyntaxRewriter"},"Classes/ViolationsSyntaxRewriter.html#/s:13SwiftLintCore24ViolationsSyntaxRewriterC15disabledRegionsSay0aE011SourceRangeVGvp":{"name":"disabledRegions","abstract":"

The regions in the traversed file that are disabled by a command.

","parent_name":"ViolationsSyntaxRewriter"},"Classes/ViolationsSyntaxRewriter.html#/s:13SwiftLintCore24ViolationsSyntaxRewriterC19correctionPositionsSay0aE016AbsolutePositionVGvp":{"name":"correctionPositions","abstract":"

Positions in a source file where corrections were applied.

","parent_name":"ViolationsSyntaxRewriter"},"Classes/ViolationsSyntaxRewriter.html#/s:13SwiftLintCore24ViolationsSyntaxRewriterC13configuration4fileACyxGx_AA0aB4FileCtcfc":{"name":"init(configuration:file:)","abstract":"

Initializer for a ViolationsSyntaxRewriter.

","parent_name":"ViolationsSyntaxRewriter"},"Classes/ViolationsSyntaxRewriter.html#/s:13SwiftLintCore24ViolationsSyntaxRewriterC8visitAnyy0aE00E0VSgAGF":{"name":"visitAny(_:)","parent_name":"ViolationsSyntaxRewriter"},"Classes/SwiftLintFile.html#/s:13SwiftLintCore0aB4FileC4file21SourceKittenFramework0D0Cvp":{"name":"file","abstract":"

The underlying SourceKitten file.

","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:13SwiftLintCore0aB4FileC2id10Foundation4UUIDVvp":{"name":"id","abstract":"

The associated unique identifier for this file.

","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:13SwiftLintCore0aB4FileC06isTestD0Sbvp":{"name":"isTestFile","abstract":"

Whether or not this is a file generated for testing purposes.

","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:13SwiftLintCore0aB4FileC9isVirtualSbvp":{"name":"isVirtual","abstract":"

A file is virtual if it is not backed by a filesystem path.

","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:13SwiftLintCore0aB4FileC4file06isTestD00F7VirtualAC21SourceKittenFramework0D0C_S2btcfc":{"name":"init(file:isTestFile:isVirtual:)","abstract":"

Creates a SwiftLintFile with a SourceKitten File.

","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:13SwiftLintCore0aB4FileC4path06isTestD0ACSgSS_Sbtcfc":{"name":"init(path:isTestFile:)","abstract":"

Creates a SwiftLintFile by specifying its path on disk.","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:13SwiftLintCore0aB4FileC20pathDeferringReadingACSS_tcfc":{"name":"init(pathDeferringReading:)","abstract":"

Creates a SwiftLintFile by specifying its path on disk. Unlike the SwiftLintFile(path:) initializer, this","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:13SwiftLintCore0aB4FileC8contents06isTestD0ACSS_Sbtcfc":{"name":"init(contents:isTestFile:)","abstract":"

Creates a SwiftLintFile that is not backed by a file on disk by specifying its contents.

","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:13SwiftLintCore0aB4FileC4pathSSSgvp":{"name":"path","abstract":"

The path on disk for this file.

","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:13SwiftLintCore0aB4FileC8contentsSSvp":{"name":"contents","abstract":"

The file’s contents.

","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:13SwiftLintCore0aB4FileC10stringView21SourceKittenFramework06StringF0Vvp":{"name":"stringView","abstract":"

A string view into the contents of this file optimized for string manipulation operations.

","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:13SwiftLintCore0aB4FileC5linesSay21SourceKittenFramework4LineVGvp":{"name":"lines","abstract":"

The parsed lines for this file’s contents.

","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:SQ2eeoiySbx_xtFZ":{"name":"==(_:_:)","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:SH4hash4intoys6HasherVz_tF":{"name":"hash(into:)","parent_name":"SwiftLintFile"},"Classes/RuleStorage.html#/s:s23CustomStringConvertibleP11descriptionSSvp":{"name":"description","parent_name":"RuleStorage"},"Classes/RuleStorage.html#/s:13SwiftLintCore11RuleStorageCACycfc":{"name":"init()","abstract":"

Creates a RuleStorage with no initial stored data.

","parent_name":"RuleStorage"},"Classes/RuleRegistry.html#/s:13SwiftLintCore12RuleRegistryC6sharedACvpZ":{"name":"shared","abstract":"

Shared rule registry instance.

","parent_name":"RuleRegistry"},"Classes/RuleRegistry.html#/s:13SwiftLintCore12RuleRegistryC4listAA0D4ListVvp":{"name":"list","abstract":"

Rule list associated with this registry. Lazily created, and","parent_name":"RuleRegistry"},"Classes/RuleRegistry.html#/s:13SwiftLintCore12RuleRegistryC8register5rulesySayAA0D0_pXpG_tF":{"name":"register(rules:)","abstract":"

Register rules.

","parent_name":"RuleRegistry"},"Classes/RuleRegistry.html#/s:13SwiftLintCore12RuleRegistryC4rule5forIDAA0D0_pXpSgSS_tF":{"name":"rule(forID:)","abstract":"

Look up a rule for a given ID.

","parent_name":"RuleRegistry"},"Classes/RuleRegistry.html":{"name":"RuleRegistry","abstract":"

Container to register and look up SwiftLint rules.

"},"Classes/RuleStorage.html":{"name":"RuleStorage","abstract":"

A storage mechanism for aggregating the results of CollectingRules.

"},"Classes/SwiftLintFile.html":{"name":"SwiftLintFile","abstract":"

A unit of Swift source code, either on disk or in memory.

"},"Classes/ViolationsSyntaxRewriter.html":{"name":"ViolationsSyntaxRewriter","abstract":"

A SwiftSyntax SyntaxRewriter that produces absolute positions where corrections were applied.

"},"Classes/CodeIndentingRewriter.html":{"name":"CodeIndentingRewriter","abstract":"

Rewriter that indents or unindents a syntax piece including comments and nested"},"Classes/BodyLengthRuleVisitor.html":{"name":"BodyLengthRuleVisitor","abstract":"

Visitor that collection violations of code block lengths.

"},"Classes/CodeBlockVisitor.html":{"name":"CodeBlockVisitor","abstract":"

A visitor that collects style violations for all available code blocks.

"},"Classes/DeclaredIdentifiersTrackingVisitor.html":{"name":"DeclaredIdentifiersTrackingVisitor","abstract":"

A specialized ViolationsSyntaxVisitor that tracks declared identifiers per scope while traversing the AST.

"},"Classes/ViolationsSyntaxVisitor.html":{"name":"ViolationsSyntaxVisitor","abstract":"

A SwiftSyntax SyntaxVisitor that produces absolute positions where violations should be reported.

"},"swift-syntax-dashboard.html":{"name":"Swift Syntax Dashboard"},"accessibility_label_for_image.html":{"name":"accessibility_label_for_image"},"accessibility_trait_for_button.html":{"name":"accessibility_trait_for_button"},"anonymous_argument_in_multiline_closure.html":{"name":"anonymous_argument_in_multiline_closure"},"array_init.html":{"name":"array_init"},"async_without_await.html":{"name":"async_without_await"},"attribute_name_spacing.html":{"name":"attribute_name_spacing"},"attributes.html":{"name":"attributes"},"balanced_xctest_lifecycle.html":{"name":"balanced_xctest_lifecycle"},"blanket_disable_command.html":{"name":"blanket_disable_command"},"block_based_kvo.html":{"name":"block_based_kvo"},"capture_variable.html":{"name":"capture_variable"},"class_delegate_protocol.html":{"name":"class_delegate_protocol"},"closing_brace.html":{"name":"closing_brace"},"closure_body_length.html":{"name":"closure_body_length"},"closure_end_indentation.html":{"name":"closure_end_indentation"},"closure_parameter_position.html":{"name":"closure_parameter_position"},"closure_spacing.html":{"name":"closure_spacing"},"collection_alignment.html":{"name":"collection_alignment"},"colon.html":{"name":"colon"},"comma.html":{"name":"comma"},"comma_inheritance.html":{"name":"comma_inheritance"},"comment_spacing.html":{"name":"comment_spacing"},"compiler_protocol_init.html":{"name":"compiler_protocol_init"},"computed_accessors_order.html":{"name":"computed_accessors_order"},"conditional_returns_on_newline.html":{"name":"conditional_returns_on_newline"},"contains_over_filter_count.html":{"name":"contains_over_filter_count"},"contains_over_filter_is_empty.html":{"name":"contains_over_filter_is_empty"},"contains_over_first_not_nil.html":{"name":"contains_over_first_not_nil"},"contains_over_range_nil_comparison.html":{"name":"contains_over_range_nil_comparison"},"contrasted_opening_brace.html":{"name":"contrasted_opening_brace"},"control_statement.html":{"name":"control_statement"},"convenience_type.html":{"name":"convenience_type"},"custom_rules.html":{"name":"custom_rules"},"cyclomatic_complexity.html":{"name":"cyclomatic_complexity"},"deployment_target.html":{"name":"deployment_target"},"direct_return.html":{"name":"direct_return"},"discarded_notification_center_observer.html":{"name":"discarded_notification_center_observer"},"discouraged_assert.html":{"name":"discouraged_assert"},"discouraged_direct_init.html":{"name":"discouraged_direct_init"},"discouraged_none_name.html":{"name":"discouraged_none_name"},"discouraged_object_literal.html":{"name":"discouraged_object_literal"},"discouraged_optional_boolean.html":{"name":"discouraged_optional_boolean"},"discouraged_optional_collection.html":{"name":"discouraged_optional_collection"},"duplicate_conditions.html":{"name":"duplicate_conditions"},"duplicate_enum_cases.html":{"name":"duplicate_enum_cases"},"duplicate_imports.html":{"name":"duplicate_imports"},"duplicated_key_in_dictionary_literal.html":{"name":"duplicated_key_in_dictionary_literal"},"dynamic_inline.html":{"name":"dynamic_inline"},"empty_collection_literal.html":{"name":"empty_collection_literal"},"empty_count.html":{"name":"empty_count"},"empty_enum_arguments.html":{"name":"empty_enum_arguments"},"empty_parameters.html":{"name":"empty_parameters"},"empty_parentheses_with_trailing_closure.html":{"name":"empty_parentheses_with_trailing_closure"},"empty_string.html":{"name":"empty_string"},"empty_xctest_method.html":{"name":"empty_xctest_method"},"enum_case_associated_values_count.html":{"name":"enum_case_associated_values_count"},"expiring_todo.html":{"name":"expiring_todo"},"explicit_acl.html":{"name":"explicit_acl"},"explicit_enum_raw_value.html":{"name":"explicit_enum_raw_value"},"explicit_init.html":{"name":"explicit_init"},"explicit_self.html":{"name":"explicit_self"},"explicit_top_level_acl.html":{"name":"explicit_top_level_acl"},"explicit_type_interface.html":{"name":"explicit_type_interface"},"extension_access_modifier.html":{"name":"extension_access_modifier"},"fallthrough.html":{"name":"fallthrough"},"fatal_error_message.html":{"name":"fatal_error_message"},"file_header.html":{"name":"file_header"},"file_length.html":{"name":"file_length"},"file_name.html":{"name":"file_name"},"file_name_no_space.html":{"name":"file_name_no_space"},"file_types_order.html":{"name":"file_types_order"},"final_test_case.html":{"name":"final_test_case"},"first_where.html":{"name":"first_where"},"flatmap_over_map_reduce.html":{"name":"flatmap_over_map_reduce"},"for_where.html":{"name":"for_where"},"force_cast.html":{"name":"force_cast"},"force_try.html":{"name":"force_try"},"force_unwrapping.html":{"name":"force_unwrapping"},"function_body_length.html":{"name":"function_body_length"},"function_default_parameter_at_end.html":{"name":"function_default_parameter_at_end"},"function_parameter_count.html":{"name":"function_parameter_count"},"generic_type_name.html":{"name":"generic_type_name"},"ibinspectable_in_extension.html":{"name":"ibinspectable_in_extension"},"identical_operands.html":{"name":"identical_operands"},"identifier_name.html":{"name":"identifier_name"},"implicit_getter.html":{"name":"implicit_getter"},"implicit_return.html":{"name":"implicit_return"},"implicitly_unwrapped_optional.html":{"name":"implicitly_unwrapped_optional"},"inclusive_language.html":{"name":"inclusive_language"},"indentation_width.html":{"name":"indentation_width"},"invalid_swiftlint_command.html":{"name":"invalid_swiftlint_command"},"is_disjoint.html":{"name":"is_disjoint"},"joined_default_parameter.html":{"name":"joined_default_parameter"},"large_tuple.html":{"name":"large_tuple"},"last_where.html":{"name":"last_where"},"leading_whitespace.html":{"name":"leading_whitespace"},"legacy_cggeometry_functions.html":{"name":"legacy_cggeometry_functions"},"legacy_constant.html":{"name":"legacy_constant"},"legacy_constructor.html":{"name":"legacy_constructor"},"legacy_hashing.html":{"name":"legacy_hashing"},"legacy_multiple.html":{"name":"legacy_multiple"},"legacy_nsgeometry_functions.html":{"name":"legacy_nsgeometry_functions"},"legacy_objc_type.html":{"name":"legacy_objc_type"},"legacy_random.html":{"name":"legacy_random"},"let_var_whitespace.html":{"name":"let_var_whitespace"},"line_length.html":{"name":"line_length"},"literal_expression_end_indentation.html":{"name":"literal_expression_end_indentation"},"local_doc_comment.html":{"name":"local_doc_comment"},"lower_acl_than_parent.html":{"name":"lower_acl_than_parent"},"mark.html":{"name":"mark"},"missing_docs.html":{"name":"missing_docs"},"modifier_order.html":{"name":"modifier_order"},"multiline_arguments.html":{"name":"multiline_arguments"},"multiline_arguments_brackets.html":{"name":"multiline_arguments_brackets"},"multiline_function_chains.html":{"name":"multiline_function_chains"},"multiline_literal_brackets.html":{"name":"multiline_literal_brackets"},"multiline_parameters.html":{"name":"multiline_parameters"},"multiline_parameters_brackets.html":{"name":"multiline_parameters_brackets"},"multiple_closures_with_trailing_closure.html":{"name":"multiple_closures_with_trailing_closure"},"nesting.html":{"name":"nesting"},"nimble_operator.html":{"name":"nimble_operator"},"no_empty_block.html":{"name":"no_empty_block"},"no_extension_access_modifier.html":{"name":"no_extension_access_modifier"},"no_fallthrough_only.html":{"name":"no_fallthrough_only"},"no_grouping_extension.html":{"name":"no_grouping_extension"},"no_magic_numbers.html":{"name":"no_magic_numbers"},"no_space_in_method_call.html":{"name":"no_space_in_method_call"},"non_optional_string_data_conversion.html":{"name":"non_optional_string_data_conversion"},"non_overridable_class_declaration.html":{"name":"non_overridable_class_declaration"},"notification_center_detachment.html":{"name":"notification_center_detachment"},"ns_number_init_as_function_reference.html":{"name":"ns_number_init_as_function_reference"},"nslocalizedstring_key.html":{"name":"nslocalizedstring_key"},"nslocalizedstring_require_bundle.html":{"name":"nslocalizedstring_require_bundle"},"nsobject_prefer_isequal.html":{"name":"nsobject_prefer_isequal"},"number_separator.html":{"name":"number_separator"},"object_literal.html":{"name":"object_literal"},"one_declaration_per_file.html":{"name":"one_declaration_per_file"},"opening_brace.html":{"name":"opening_brace"},"operator_usage_whitespace.html":{"name":"operator_usage_whitespace"},"operator_whitespace.html":{"name":"operator_whitespace"},"optional_data_string_conversion.html":{"name":"optional_data_string_conversion"},"optional_enum_case_matching.html":{"name":"optional_enum_case_matching"},"orphaned_doc_comment.html":{"name":"orphaned_doc_comment"},"overridden_super_call.html":{"name":"overridden_super_call"},"override_in_extension.html":{"name":"override_in_extension"},"pattern_matching_keywords.html":{"name":"pattern_matching_keywords"},"period_spacing.html":{"name":"period_spacing"},"prefer_key_path.html":{"name":"prefer_key_path"},"prefer_nimble.html":{"name":"prefer_nimble"},"prefer_self_in_static_references.html":{"name":"prefer_self_in_static_references"},"prefer_self_type_over_type_of_self.html":{"name":"prefer_self_type_over_type_of_self"},"prefer_type_checking.html":{"name":"prefer_type_checking"},"prefer_zero_over_explicit_init.html":{"name":"prefer_zero_over_explicit_init"},"prefixed_toplevel_constant.html":{"name":"prefixed_toplevel_constant"},"private_action.html":{"name":"private_action"},"private_outlet.html":{"name":"private_outlet"},"private_over_fileprivate.html":{"name":"private_over_fileprivate"},"private_subject.html":{"name":"private_subject"},"private_swiftui_state.html":{"name":"private_swiftui_state"},"private_unit_test.html":{"name":"private_unit_test"},"prohibited_interface_builder.html":{"name":"prohibited_interface_builder"},"prohibited_super_call.html":{"name":"prohibited_super_call"},"protocol_property_accessors_order.html":{"name":"protocol_property_accessors_order"},"quick_discouraged_call.html":{"name":"quick_discouraged_call"},"quick_discouraged_focused_test.html":{"name":"quick_discouraged_focused_test"},"quick_discouraged_pending_test.html":{"name":"quick_discouraged_pending_test"},"raw_value_for_camel_cased_codable_enum.html":{"name":"raw_value_for_camel_cased_codable_enum"},"reduce_boolean.html":{"name":"reduce_boolean"},"reduce_into.html":{"name":"reduce_into"},"redundant_discardable_let.html":{"name":"redundant_discardable_let"},"redundant_nil_coalescing.html":{"name":"redundant_nil_coalescing"},"redundant_objc_attribute.html":{"name":"redundant_objc_attribute"},"redundant_optional_initialization.html":{"name":"redundant_optional_initialization"},"redundant_self_in_closure.html":{"name":"redundant_self_in_closure"},"redundant_sendable.html":{"name":"redundant_sendable"},"redundant_set_access_control.html":{"name":"redundant_set_access_control"},"redundant_string_enum_value.html":{"name":"redundant_string_enum_value"},"redundant_type_annotation.html":{"name":"redundant_type_annotation"},"redundant_void_return.html":{"name":"redundant_void_return"},"required_deinit.html":{"name":"required_deinit"},"required_enum_case.html":{"name":"required_enum_case"},"return_arrow_whitespace.html":{"name":"return_arrow_whitespace"},"return_value_from_void_function.html":{"name":"return_value_from_void_function"},"self_binding.html":{"name":"self_binding"},"self_in_property_initialization.html":{"name":"self_in_property_initialization"},"shorthand_argument.html":{"name":"shorthand_argument"},"shorthand_operator.html":{"name":"shorthand_operator"},"shorthand_optional_binding.html":{"name":"shorthand_optional_binding"},"single_test_class.html":{"name":"single_test_class"},"sorted_enum_cases.html":{"name":"sorted_enum_cases"},"sorted_first_last.html":{"name":"sorted_first_last"},"sorted_imports.html":{"name":"sorted_imports"},"statement_position.html":{"name":"statement_position"},"static_operator.html":{"name":"static_operator"},"static_over_final_class.html":{"name":"static_over_final_class"},"strict_fileprivate.html":{"name":"strict_fileprivate"},"strong_iboutlet.html":{"name":"strong_iboutlet"},"superfluous_disable_command.html":{"name":"superfluous_disable_command"},"superfluous_else.html":{"name":"superfluous_else"},"switch_case_alignment.html":{"name":"switch_case_alignment"},"switch_case_on_newline.html":{"name":"switch_case_on_newline"},"syntactic_sugar.html":{"name":"syntactic_sugar"},"test_case_accessibility.html":{"name":"test_case_accessibility"},"todo.html":{"name":"todo"},"toggle_bool.html":{"name":"toggle_bool"},"trailing_closure.html":{"name":"trailing_closure"},"trailing_comma.html":{"name":"trailing_comma"},"trailing_newline.html":{"name":"trailing_newline"},"trailing_semicolon.html":{"name":"trailing_semicolon"},"trailing_whitespace.html":{"name":"trailing_whitespace"},"type_body_length.html":{"name":"type_body_length"},"type_contents_order.html":{"name":"type_contents_order"},"type_name.html":{"name":"type_name"},"typesafe_array_init.html":{"name":"typesafe_array_init"},"unavailable_condition.html":{"name":"unavailable_condition"},"unavailable_function.html":{"name":"unavailable_function"},"unhandled_throwing_task.html":{"name":"unhandled_throwing_task"},"unneeded_break_in_switch.html":{"name":"unneeded_break_in_switch"},"unneeded_override.html":{"name":"unneeded_override"},"unneeded_parentheses_in_closure_argument.html":{"name":"unneeded_parentheses_in_closure_argument"},"unneeded_synthesized_initializer.html":{"name":"unneeded_synthesized_initializer"},"unowned_variable_capture.html":{"name":"unowned_variable_capture"},"untyped_error_in_catch.html":{"name":"untyped_error_in_catch"},"unused_closure_parameter.html":{"name":"unused_closure_parameter"},"unused_control_flow_label.html":{"name":"unused_control_flow_label"},"unused_declaration.html":{"name":"unused_declaration"},"unused_enumerated.html":{"name":"unused_enumerated"},"unused_import.html":{"name":"unused_import"},"unused_optional_binding.html":{"name":"unused_optional_binding"},"unused_parameter.html":{"name":"unused_parameter"},"unused_setter_value.html":{"name":"unused_setter_value"},"valid_ibinspectable.html":{"name":"valid_ibinspectable"},"vertical_parameter_alignment.html":{"name":"vertical_parameter_alignment"},"vertical_parameter_alignment_on_call.html":{"name":"vertical_parameter_alignment_on_call"},"vertical_whitespace.html":{"name":"vertical_whitespace"},"vertical_whitespace_between_cases.html":{"name":"vertical_whitespace_between_cases"},"vertical_whitespace_closing_braces.html":{"name":"vertical_whitespace_closing_braces"},"vertical_whitespace_opening_braces.html":{"name":"vertical_whitespace_opening_braces"},"void_function_in_ternary.html":{"name":"void_function_in_ternary"},"void_return.html":{"name":"void_return"},"weak_delegate.html":{"name":"weak_delegate"},"xct_specific_matcher.html":{"name":"xct_specific_matcher"},"xctfail_message.html":{"name":"xctfail_message"},"yoda_condition.html":{"name":"yoda_condition"},"rule-directory.html":{"name":"Rule Directory"},"Rules.html":{"name":"Rules"},"Guides.html":{"name":"Guides","abstract":"

The following guides are available globally.

"},"Classes.html":{"name":"Classes","abstract":"

The following classes are available globally.

"},"Enums.html":{"name":"Enumerations","abstract":"

The following enumerations are available globally.

"},"Extensions.html":{"name":"Extensions","abstract":"

The following extensions are available globally.

"},"Protocols.html":{"name":"Protocols","abstract":"

The following protocols are available globally.

"},"Structs.html":{"name":"Structures","abstract":"

The following structures are available globally.

"},"Macros.html":{"name":"Macros","abstract":"

The following macros are available globally.

"}} \ No newline at end of file diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/self_binding.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/self_binding.html new file mode 100644 index 000000000..367349a4b --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/self_binding.html @@ -0,0 +1,438 @@ + + + + self_binding Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Self Binding

+ +

Re-bind self to a consistent identifier name.

+ +
    +
  • Identifier: self_binding
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +bind_identifier + +“self” +
  • +
+

Non Triggering Examples

+
if let self = self { return }
+
+
guard let self = self else { return }
+
+
if let this = this { return }
+
+
guard let this = this else { return }
+
+
//
+// bind_identifier: "this"
+//
+
+if let this = self { return }
+
+
+
//
+// bind_identifier: "this"
+//
+
+guard let this = self else { return }
+
+
+

Triggering Examples

+
if let ↓`self` = self { return }
+
+
guard let ↓`self` = self else { return }
+
+
if let ↓this = self { return }
+
+
guard let ↓this = self else { return }
+
+
//
+// bind_identifier: "this"
+//
+
+if let ↓self = self { return }
+
+
+
//
+// bind_identifier: "this"
+//
+
+guard let ↓self = self else { return }
+
+
+
//
+// bind_identifier: "this"
+//
+
+if let ↓self { return }
+
+
+
//
+// bind_identifier: "this"
+//
+
+guard let ↓self else { return }
+
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/self_in_property_initialization.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/self_in_property_initialization.html new file mode 100644 index 000000000..149f9cb7c --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/self_in_property_initialization.html @@ -0,0 +1,420 @@ + + + + self_in_property_initialization Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Self in Property Initialization

+ +

self refers to the unapplied NSObject.self() method, which is likely not expected; make the variable lazy to be able to refer to the current instance or use ClassName.self

+ +
    +
  • Identifier: self_in_property_initialization
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class View: UIView {
+    let button: UIButton = {
+        return UIButton()
+    }()
+}
+
+
class View: UIView {
+    lazy var button: UIButton = {
+        let button = UIButton()
+        button.addTarget(self, action: #selector(didTapButton), for: .touchUpInside)
+        return button
+    }()
+}
+
+
class View: UIView {
+    var button: UIButton = {
+        let button = UIButton()
+        button.addTarget(otherObject, action: #selector(didTapButton), for: .touchUpInside)
+        return button
+    }()
+}
+
+
class View: UIView {
+    private let collectionView: UICollectionView = {
+        let layout = UICollectionViewFlowLayout()
+        let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
+        collectionView.registerReusable(Cell.self)
+
+        return collectionView
+    }()
+}
+
+

Triggering Examples

+
class View: UIView {
+    ↓var button: UIButton = {
+        let button = UIButton()
+        button.addTarget(self, action: #selector(didTapButton), for: .touchUpInside)
+        return button
+    }()
+}
+
+
class View: UIView {
+    ↓let button: UIButton = {
+        let button = UIButton()
+        button.addTarget(self, action: #selector(didTapButton), for: .touchUpInside)
+        return button
+    }()
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/shorthand_argument.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/shorthand_argument.html new file mode 100644 index 000000000..270adabcb --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/shorthand_argument.html @@ -0,0 +1,457 @@ + + + + shorthand_argument Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Shorthand Argument

+ +

Shorthand arguments like $0, $1, etc. in closures can be confusing. Avoid using them too far away from the beginning of the closure. Optionally, while usage of a single shorthand argument is okay, more than one or complex ones with field accesses might increase the risk of obfuscation.

+ +
    +
  • Identifier: shorthand_argument
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +allow_until_line_after_opening_brace + +4 +
    +always_disallow_more_than_one + +false +
    +always_disallow_member_access + +false +
  • +
+

Non Triggering Examples

+
f { $0 }
+
+
f {
+    $0
+  + $1
+  + $2
+}
+
+
f { $0.a + $0.b }
+
+
//
+// allow_until_line_after_opening_brace: 1
+//
+
+f {
+    $0
+  +  g { $0 }
+
+
+

Triggering Examples

+
f {
+    $0
+  + $1
+  + $2
+
+  + ↓$0
+}
+
+
//
+// allow_until_line_after_opening_brace: 5
+//
+
+f {
+    $0
+  + $1
+  + $2
+  +  5
+  + $0
+  + ↓$1
+}
+
+
+
//
+// always_disallow_more_than_one: true
+//
+
+f { ↓$0 + ↓$1 }
+
+
+
//
+// allow_until_line_after_opening_brace: 3
+// always_disallow_member_access: true
+//
+
+f {
+    ↓$0.a
+  + ↓$0.b
+  + $1
+  + ↓$2.c
+}
+
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/shorthand_operator.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/shorthand_operator.html new file mode 100644 index 000000000..bb1305fc5 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/shorthand_operator.html @@ -0,0 +1,413 @@ + + + + shorthand_operator Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Shorthand Operator

+ +

Prefer shorthand operators (+=, -=, *=, /=) over doing the operation and assigning

+ +
    +
  • Identifier: shorthand_operator
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +error +
  • +
+

Non Triggering Examples

+
foo -= 1
+
+
foo += variable
+
+
foo *= bar.method()
+
+
self.foo = foo / 1
+
+
foo = self.foo + 1
+
+
page = ceilf(currentOffset * pageWidth)
+
+
foo = aMethod(foo / bar)
+
+
foo = aMethod(bar + foo)
+
+
public func -= (lhs: inout Foo, rhs: Int) {
+    lhs = lhs - rhs
+}
+
+
var helloWorld = "world!"
+ helloWorld = "Hello, " + helloWorld
+
+
angle = someCheck ? angle : -angle
+
+
seconds = seconds * 60 + value
+
+

Triggering Examples

+
↓foo = foo * 1
+
+
↓foo = foo / aVariable
+
+
↓foo = foo - bar.method()
+
+
↓foo.aProperty = foo.aProperty - 1
+
+
↓self.aProperty = self.aProperty * 1
+
+
↓n = n + i / outputLength
+
+
↓n = n - i / outputLength
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/shorthand_optional_binding.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/shorthand_optional_binding.html new file mode 100644 index 000000000..0b9d722d7 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/shorthand_optional_binding.html @@ -0,0 +1,394 @@ + + + + shorthand_optional_binding Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Shorthand Optional Binding

+ +

Use shorthand syntax for optional binding

+ +
    +
  • Identifier: shorthand_optional_binding
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.7.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
if let i {}
+if let i = a {}
+guard let i = f() else {}
+if var i = i() {}
+if let i = i as? Foo {}
+guard let `self` = self else {}
+while var i { i = nil }
+
+

Triggering Examples

+
if ↓let i = i {}
+if ↓let self = self {}
+if ↓var `self` = `self` {}
+if i > 0, ↓let j = j {}
+if ↓let i = i, ↓var j = j {}
+
+
guard ↓let i = i else {}
+guard ↓let self = self else {}
+guard ↓var `self` = `self` else {}
+guard i > 0, ↓let j = j else {}
+guard ↓let i = i, ↓var j = j else {}
+
+
while ↓var i = i { i = nil }
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/single_test_class.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/single_test_class.html new file mode 100644 index 000000000..053b81bbc --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/single_test_class.html @@ -0,0 +1,411 @@ + + + + single_test_class Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Single Test Class

+ +

Test files should contain a single QuickSpec or XCTestCase class.

+ +
    +
  • Identifier: single_test_class
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +test_parent_classes + +[“QuickSpec”, “XCTestCase”] +
  • +
+

Non Triggering Examples

+
class FooTests {  }
+
+
class FooTests: QuickSpec {  }
+
+
class FooTests: XCTestCase {  }
+
+

Triggering Examples

+
↓class FooTests: QuickSpec {  }
+↓class BarTests: QuickSpec {  }
+
+
↓class FooTests: QuickSpec {  }
+↓class BarTests: QuickSpec {  }
+↓class TotoTests: QuickSpec {  }
+
+
↓class FooTests: XCTestCase {  }
+↓class BarTests: XCTestCase {  }
+
+
↓class FooTests: XCTestCase {  }
+↓class BarTests: XCTestCase {  }
+↓class TotoTests: XCTestCase {  }
+
+
↓class FooTests: QuickSpec {  }
+↓class BarTests: XCTestCase {  }
+
+
↓class FooTests: QuickSpec {  }
+↓class BarTests: XCTestCase {  }
+class TotoTests {  }
+
+
final ↓class FooTests: QuickSpec {  }
+↓class BarTests: XCTestCase {  }
+class TotoTests {  }
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/sorted_enum_cases.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/sorted_enum_cases.html new file mode 100644 index 000000000..524166c0b --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/sorted_enum_cases.html @@ -0,0 +1,450 @@ + + + + sorted_enum_cases Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Sorted Enum Cases

+ +

Enum cases should be sorted

+ +
    +
  • Identifier: sorted_enum_cases
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
enum foo {
+    case a
+    case b
+    case c
+}
+
+
enum foo {
+    case example
+    case exBoyfriend
+}
+
+
enum foo {
+    case a
+    case B
+    case c
+}
+
+
enum foo {
+    case a, b, c
+}
+
+
enum foo {
+    case a
+    case b, c
+}
+
+
enum foo {
+    case a(foo: Foo)
+    case b(String), c
+}
+
+
enum foo {
+    case a
+    case b, C, d
+}
+
+
@frozen
+enum foo {
+    case b
+    case a
+    case c, f, d
+}
+
+

Triggering Examples

+
enum foo {
+    ↓case b
+    ↓case a
+    case c
+}
+
+
enum foo {
+    ↓case B
+    ↓case a
+    case c
+}
+
+
enum foo {
+    case ↓b, ↓a, c
+}
+
+
enum foo {
+    case ↓B, ↓a, c
+}
+
+
enum foo {
+    ↓case b, c
+    ↓case a
+}
+
+
enum foo {
+    case a
+    case b, ↓d, ↓c
+}
+
+
enum foo {
+    case a(foo: Foo)
+    case ↓c, ↓b(String)
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/sorted_first_last.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/sorted_first_last.html new file mode 100644 index 000000000..52f957853 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/sorted_first_last.html @@ -0,0 +1,432 @@ + + + + sorted_first_last Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Min or Max over Sorted First or Last

+ +

Prefer using min() or max() over sorted().first or sorted().last

+ +
    +
  • Identifier: sorted_first_last
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let min = myList.min()
+
+
let min = myList.min(by: { $0 < $1 })
+
+
let min = myList.min(by: >)
+
+
let max = myList.max()
+
+
let max = myList.max(by: { $0 < $1 })
+
+
let message = messages.sorted(byKeyPath: #keyPath(Message.timestamp)).last
+
+
let message = messages.sorted(byKeyPath: "timestamp", ascending: false).first
+
+
myList.sorted().firstIndex(of: key)
+
+
myList.sorted().lastIndex(of: key)
+
+
myList.sorted().firstIndex(where: someFunction)
+
+
myList.sorted().lastIndex(where: someFunction)
+
+
myList.sorted().firstIndex { $0 == key }
+
+
myList.sorted().lastIndex { $0 == key }
+
+
myList.sorted().first(where: someFunction)
+
+
myList.sorted().last(where: someFunction)
+
+
myList.sorted().first { $0 == key }
+
+
myList.sorted().last { $0 == key }
+
+

Triggering Examples

+
↓myList.sorted().first
+
+
↓myList.sorted(by: { $0.description < $1.description }).first
+
+
↓myList.sorted(by: >).first
+
+
↓myList.map { $0 + 1 }.sorted().first
+
+
↓myList.sorted(by: someFunction).first
+
+
↓myList.map { $0 + 1 }.sorted { $0.description < $1.description }.first
+
+
↓myList.sorted().last
+
+
↓myList.sorted().last?.something()
+
+
↓myList.sorted(by: { $0.description < $1.description }).last
+
+
↓myList.map { $0 + 1 }.sorted().last
+
+
↓myList.sorted(by: someFunction).last
+
+
↓myList.map { $0 + 1 }.sorted { $0.description < $1.description }.last
+
+
↓myList.map { $0 + 1 }.sorted { $0.first < $1.first }.last
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/sorted_imports.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/sorted_imports.html new file mode 100644 index 000000000..34f4cefcb --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/sorted_imports.html @@ -0,0 +1,442 @@ + + + + sorted_imports Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Sorted Imports

+ +

Imports should be sorted

+ +
    +
  • Identifier: sorted_imports
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +grouping + +names +
  • +
+

Non Triggering Examples

+
import AAA
+import BBB
+import CCC
+import DDD
+
+
import Alamofire
+import API
+
+
import labc
+import Ldef
+
+
import BBB
+// comment
+import AAA
+import CCC
+
+
@testable import AAA
+import   CCC
+
+
import AAA
+@testable import   CCC
+
+
import EEE.A
+import FFF.B
+#if os(Linux)
+import DDD.A
+import EEE.B
+#else
+import CCC
+import DDD.B
+#endif
+import AAA
+import BBB
+
+

Triggering Examples

+
import AAA
+import ZZZ
+import ↓BBB
+import CCC
+
+
import DDD
+// comment
+import CCC
+import ↓AAA
+
+
@testable import CCC
+import   ↓AAA
+
+
import CCC
+@testable import   ↓AAA
+
+
import FFF.B
+import ↓EEE.A
+#if os(Linux)
+import DDD.A
+import EEE.B
+#else
+import DDD.B
+import ↓CCC
+#endif
+import AAA
+import BBB
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/statement_position.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/statement_position.html new file mode 100644 index 000000000..0117b0ac5 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/statement_position.html @@ -0,0 +1,408 @@ + + + + statement_position Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Statement Position

+ +

Else and catch should be on the same line, one space after the previous declaration

+ +
    +
  • Identifier: statement_position
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +statement_mode + +default +
  • +
+

Non Triggering Examples

+
} else if {
+
+
} else {
+
+
} catch {
+
+
"}else{"
+
+
struct A { let catchphrase: Int }
+let a = A(
+ catchphrase: 0
+)
+
+
struct A { let `catch`: Int }
+let a = A(
+ `catch`: 0
+)
+
+

Triggering Examples

+
↓}else if {
+
+
↓}  else {
+
+
↓}
+catch {
+
+
↓}
+      catch {
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/static_operator.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/static_operator.html new file mode 100644 index 000000000..ceb68f2db --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/static_operator.html @@ -0,0 +1,426 @@ + + + + static_operator Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Static Operator

+ +

Operators should be declared as static functions, not free functions

+ +
    +
  • Identifier: static_operator
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class A: Equatable {
+  static func == (lhs: A, rhs: A) -> Bool {
+    return false
+  }
+
+
class A<T>: Equatable {
+    static func == <T>(lhs: A<T>, rhs: A<T>) -> Bool {
+        return false
+    }
+
+
public extension Array where Element == Rule {
+  static func == (lhs: Array, rhs: Array) -> Bool {
+    if lhs.count != rhs.count { return false }
+    return !zip(lhs, rhs).contains { !$0.0.isEqualTo($0.1) }
+  }
+}
+
+
private extension Optional where Wrapped: Comparable {
+  static func < (lhs: Optional, rhs: Optional) -> Bool {
+    switch (lhs, rhs) {
+    case let (lhs?, rhs?):
+      return lhs < rhs
+    case (nil, _?):
+      return true
+    default:
+      return false
+    }
+  }
+}
+
+

Triggering Examples

+
↓func == (lhs: A, rhs: A) -> Bool {
+  return false
+}
+
+
↓func == <T>(lhs: A<T>, rhs: A<T>) -> Bool {
+  return false
+}
+
+
↓func == (lhs: [Rule], rhs: [Rule]) -> Bool {
+  if lhs.count != rhs.count { return false }
+  return !zip(lhs, rhs).contains { !$0.0.isEqualTo($0.1) }
+}
+
+
private ↓func < <T: Comparable>(lhs: T?, rhs: T?) -> Bool {
+  switch (lhs, rhs) {
+  case let (lhs?, rhs?):
+    return lhs < rhs
+  case (nil, _?):
+    return true
+  default:
+    return false
+  }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/static_over_final_class.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/static_over_final_class.html new file mode 100644 index 000000000..520f80b0f --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/static_over_final_class.html @@ -0,0 +1,418 @@ + + + + static_over_final_class Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Static Over Final Class

+ +

Prefer static over class when the declaration is not allowed to be overridden in child classes due to its context being final. Likewise, the compiler complains about open being used in final classes.

+ +
    +
  • Identifier: static_over_final_class
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class C {
+    static func f() {}
+}
+
+
class C {
+    static var i: Int { 0 }
+}
+
+
class C {
+    static subscript(_: Int) -> Int { 0 }
+}
+
+
class C {
+    class func f() {}
+}
+
+
final class C {}
+
+
final class C {
+    class D {
+      class func f() {}
+    }
+}
+
+

Triggering Examples

+
class C {
+    ↓final class func f() {}
+}
+
+
class C {
+    ↓final class var i: Int { 0 }
+}
+
+
class C {
+    ↓final class subscript(_: Int) -> Int { 0 }
+}
+
+
final class C {
+    ↓class func f() {}
+}
+
+
class C {
+    final class D {
+        ↓class func f() {}
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/strict_fileprivate.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/strict_fileprivate.html new file mode 100644 index 000000000..a224681d0 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/strict_fileprivate.html @@ -0,0 +1,417 @@ + + + + strict_fileprivate Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Strict Fileprivate

+ +

fileprivate should be avoided

+ +
    +
  • Identifier: strict_fileprivate
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
extension String {}
+
+
private extension String {}
+
+
public
+    extension String {
+        var i: Int { 1 }
+    }
+
+
    private enum E {
+        func f() {}
+    }
+
+
    public struct S {
+        internal let i: Int
+    }
+
+
    open class C {
+        private func f() {}
+    }
+
+
    internal actor A {}
+
+

Triggering Examples

+
    ↓fileprivate class C {
+        ↓fileprivate func f() {}
+    }
+
+
    ↓fileprivate extension String {
+        ↓fileprivate var isSomething: Bool { self == "something" }
+    }
+
+
    ↓fileprivate actor A {
+        ↓fileprivate let i = 1
+    }
+
+
    ↓fileprivate struct C {
+        ↓fileprivate(set) var myInt = 4
+    }
+
+
    struct Outter {
+        struct Inter {
+            ↓fileprivate struct Inner {}
+        }
+    }
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/strong_iboutlet.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/strong_iboutlet.html new file mode 100644 index 000000000..fb485b32a --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/strong_iboutlet.html @@ -0,0 +1,392 @@ + + + + strong_iboutlet Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Strong IBOutlet

+ +

@IBOutlets shouldn’t be declared as weak

+ +
    +
  • Identifier: strong_iboutlet
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class ViewController: UIViewController {
+    @IBOutlet var label: UILabel?
+}
+
+
class ViewController: UIViewController {
+    weak var label: UILabel?
+}
+
+

Triggering Examples

+
class ViewController: UIViewController {
+    @IBOutlet ↓weak var label: UILabel?
+}
+
+
class ViewController: UIViewController {
+    @IBOutlet ↓unowned var label: UILabel!
+}
+
+
class ViewController: UIViewController {
+    @IBOutlet ↓weak var textField: UITextField?
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/superfluous_disable_command.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/superfluous_disable_command.html new file mode 100644 index 000000000..8828cbfc4 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/superfluous_disable_command.html @@ -0,0 +1,384 @@ + + + + superfluous_disable_command Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Superfluous Disable Command

+ +

SwiftLint ‘disable’ commands are superfluous when the disabled rule would not have triggered a violation in the disabled region. Use “ - ” if you wish to document a command.

+ +
    +
  • Identifier: superfluous_disable_command
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let abc:Void // swiftlint:disable:this colon
+
+
// swiftlint:disable colon
+let abc:Void
+// swiftlint:enable colon
+
+

Triggering Examples

+
let abc: Void // swiftlint:disable:this colon
+
+
// swiftlint:disable colon
+let abc: Void
+// swiftlint:enable colon
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/superfluous_else.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/superfluous_else.html new file mode 100644 index 000000000..aede262bf --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/superfluous_else.html @@ -0,0 +1,464 @@ + + + + superfluous_else Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Superfluous Else

+ +

Else branches should be avoided when the previous if-block exits the current scope

+ +
    +
  • Identifier: superfluous_else
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
if i > 0 {
+    // comment
+} else if i < 12 {
+    return 2
+} else {
+    return 3
+}
+
+
if i > 0 {
+    let a = 1
+    if a > 1 {
+        // comment
+    } else {
+        return 1
+    }
+    // comment
+} else {
+    return 3
+}
+
+
if i > 0 {
+    if a > 1 {
+        return 1
+    }
+} else {
+    return 3
+}
+
+
for i in list {
+    if i > 12 {
+        // Do nothing
+    } else {
+        continue
+    }
+    if i > 14 {
+        // Do nothing
+    } else if i > 13 {
+        break
+    }
+}
+
+
if #available(iOS 13, *) {
+    return
+} else {
+    deprecatedFunction()
+}
+
+

Triggering Examples

+
if i > 0 {
+    return 1
+    // comment
+} ↓else {
+    return 2
+}
+
+
if i > 0 {
+    return 1
+} ↓else if i < 12 {
+    return 2
+} ↓else if i > 18 {
+    return 3
+}
+
+
if i > 0 {
+    if i < 12 {
+        return 5
+    } ↓else {
+        if i > 11 {
+            return 6
+        } ↓else {
+            return 7
+        }
+    }
+} ↓else if i < 12 {
+    return 2
+} ↓else if i < 24 {
+    return 8
+} ↓else {
+    return 3
+}
+
+
for i in list {
+    if i > 13 {
+        return
+    } ↓else if i > 12 {
+        continue
+    } ↓else if i > 11 {
+        break
+    } ↓else {
+        throw error
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/swift-syntax-dashboard.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/swift-syntax-dashboard.html new file mode 100644 index 000000000..f70856813 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/swift-syntax-dashboard.html @@ -0,0 +1,608 @@ + + + + Swift Syntax Dashboard Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Swift Syntax Dashboard

+ +

Efforts are actively under way to migrate most rules off SourceKit to use SwiftSyntax instead.

+ +

Rules written using SwiftSyntax tend to be significantly faster and have fewer false positives +than rules that use SourceKit to get source structure information.

+ +

23 out of 239 (9%) +of SwiftLint’s linter rules use SourceKit.

+

Rules Using SourceKit

+

Default Rules (6)

+ + +

Opt-in Rules (17)

+ + +

Rules not Using SourceKit

+

Default Rules (94)

+ + +

Opt-in Rules (122)

+ + + +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/switch_case_alignment.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/switch_case_alignment.html new file mode 100644 index 000000000..a5b7a3e70 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/switch_case_alignment.html @@ -0,0 +1,538 @@ + + + + switch_case_alignment Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Switch and Case Statement Alignment

+ +

Case statements should vertically align with their closing brace, or indented if configured otherwise.

+ +
    +
  • Identifier: switch_case_alignment
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +indented_cases + +false +
    +ignore_one_liners + +false +
  • +
+

Non Triggering Examples

+
switch someBool {
+case true: // case 1
+    print('red')
+case false:
+    /*
+    case 2
+    */
+    if case let .someEnum(val) = someFunc() {
+        print('blue')
+    }
+}
+enum SomeEnum {
+    case innocent
+}
+
+
if aBool {
+    switch someBool {
+    case true:
+        print('red')
+    case false:
+        print('blue')
+    }
+}
+
+
switch someInt {
+// comments ignored
+case 0:
+    // zero case
+    print('Zero')
+case 1:
+    print('One')
+default:
+    print('Some other number')
+}
+
+
func f() -> Int {
+    return switch i {
+    case 1: 1
+    default: 2
+    }
+}
+
+
//
+// ignore_one_liners: true
+//
+
+switch i { case .x: 1 default: 0 }
+
+
+
//
+// ignore_one_liners: true
+//
+
+let a = switch i { case .x: 1 default: 0 }
+
+
+

Triggering Examples

+
switch someBool {
+    ↓case true:
+        print("red")
+    ↓case false:
+        print("blue")
+}
+
+
if aBool {
+    switch someBool {
+        ↓case true:
+            print('red')
+        ↓case false:
+            print('blue')
+    }
+}
+
+
switch someInt {
+    ↓case 0:
+        print('Zero')
+    ↓case 1:
+        print('One')
+    ↓default:
+        print('Some other number')
+}
+
+
let a = switch i {
+    ↓case 1: 1
+    ↓default: 2
+}
+
+
switch someBool {
+case true:
+    print('red')
+    ↓case false:
+        print('blue')
+}
+
+
if aBool {
+    switch someBool {
+        ↓case true:
+        print('red')
+    case false:
+    print('blue')
+    }
+}
+
+
let a = switch i {
+case 1: 1
+    ↓default: 2
+}
+
+
switch i { ↓case .x: 1 ↓default: 0 }
+
+
//
+// ignore_one_liners: true
+//
+
+switch i {
+↓case .x: 1 ↓default: 0 }
+
+
+
//
+// ignore_one_liners: true
+//
+
+switch i { ↓case .x: 1 ↓default: 0
+}
+
+
+
//
+// ignore_one_liners: true
+//
+
+switch i
+{ ↓case .x: 1 ↓default: 0 }
+
+
+
//
+// ignore_one_liners: true
+//
+
+let a = switch i {
+case .x: 1 ↓default: 0
+}
+
+
+
//
+// ignore_one_liners: true
+//
+
+let a = switch i {
+↓case .x: 1 ↓default: 0 }
+
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/switch_case_on_newline.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/switch_case_on_newline.html new file mode 100644 index 000000000..db7c23aeb --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/switch_case_on_newline.html @@ -0,0 +1,484 @@ + + + + switch_case_on_newline Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Cases on Newline

+ +

Cases inside a switch should always be on a newline

+ +
    +
  • Identifier: switch_case_on_newline
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
/*case 1: */return true
+
+
//case 1:
+ return true
+
+
let x = [caseKey: value]
+
+
let x = [key: .default]
+
+
if case let .someEnum(value) = aFunction([key: 2]) { }
+
+
guard case let .someEnum(value) = aFunction([key: 2]) { }
+
+
for case let .someEnum(value) = aFunction([key: 2]) { }
+
+
enum Environment {
+ case development
+}
+
+
enum Environment {
+ case development(url: URL)
+}
+
+
enum Environment {
+ case development(url: URL) // staging
+}
+
+
switch foo {
+    case 1:
+ return true
+}
+
+
switch foo {
+    default:
+ return true
+}
+
+
switch foo {
+    case let value:
+ return true
+}
+
+
switch foo {
+    case .myCase: // error from network
+ return true
+}
+
+
switch foo {
+    case let .myCase(value) where value > 10:
+ return false
+}
+
+
switch foo {
+    case let .myCase(value)
+ where value > 10:
+ return false
+}
+
+
switch foo {
+    case let .myCase(code: lhsErrorCode, description: _)
+ where lhsErrorCode > 10:
+return false
+}
+
+
switch foo {
+    case #selector(aFunction(_:)):
+ return false
+}
+
+
do {
+  let loadedToken = try tokenManager.decodeToken(from: response)
+  return loadedToken
+} catch { throw error }
+
+

Triggering Examples

+
switch foo {
+    ↓case 1: return true
+}
+
+
switch foo {
+    ↓case let value: return true
+}
+
+
switch foo {
+    ↓default: return true
+}
+
+
switch foo {
+    ↓case "a string": return false
+}
+
+
switch foo {
+    ↓case .myCase: return false // error from network
+}
+
+
switch foo {
+    ↓case let .myCase(value) where value > 10: return false
+}
+
+
switch foo {
+    ↓case #selector(aFunction(_:)): return false
+}
+
+
switch foo {
+    ↓case let .myCase(value)
+ where value > 10: return false
+}
+
+
switch foo {
+    ↓case .first,
+ .second: return false
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/syntactic_sugar.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/syntactic_sugar.html new file mode 100644 index 000000000..a27945760 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/syntactic_sugar.html @@ -0,0 +1,452 @@ + + + + syntactic_sugar Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Syntactic Sugar

+ +

Shorthand syntactic sugar should be used, i.e. [Int] instead of Array.

+ +
    +
  • Identifier: syntactic_sugar
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let x: [Int]
+
+
let x: [Int: String]
+
+
let x: Int?
+
+
func x(a: [Int], b: Int) -> [Int: Any]
+
+
let x: Int!
+
+
extension Array {
+  func x() { }
+}
+
+
extension Dictionary {
+  func x() { }
+}
+
+
let x: CustomArray<String>
+
+
var currentIndex: Array<OnboardingPage>.Index?
+
+
func x(a: [Int], b: Int) -> Array<Int>.Index
+
+
unsafeBitCast(nonOptionalT, to: Optional<T>.self)
+
+
unsafeBitCast(someType, to: Swift.Array<T>.self)
+
+
IndexingIterator<Array<Dictionary<String, AnyObject>>>.self
+
+
let y = Optional<String>.Type
+
+
type is Optional<String>.Type
+
+
let x: Foo.Optional<String>
+
+
let x = case Optional<Any>.none = obj
+
+
let a = Swift.Optional<String?>.none
+
+

Triggering Examples

+
let x: ↓Array<String>
+
+
let x: ↓Dictionary<Int, String>
+
+
let x: ↓Optional<Int>
+
+
let x: ↓Swift.Array<String>
+
+
func x(a: ↓Array<Int>, b: Int) -> [Int: Any]
+
+
func x(a: ↓Swift.Array<Int>, b: Int) -> [Int: Any]
+
+
func x(a: [Int], b: Int) -> ↓Dictionary<Int, String>
+
+
let x = y as? ↓Array<[String: Any]>
+
+
let x = Box<Array<T>>()
+
+
func x() -> Box<↓Array<T>>
+
+
func x() -> ↓Dictionary<String, Any>?
+
+
typealias Document = ↓Dictionary<String, T?>
+
+
func x(_ y: inout ↓Array<T>)
+
+
let x:↓Dictionary<String, ↓Dictionary<Int, Int>>
+
+
func x() -> Any { return ↓Dictionary<Int, String>()}
+
+
let x = ↓Array<String>.array(of: object)
+
+
let x = ↓Swift.Array<String>.array(of: object)
+
+
@_specialize(where S == ↓Array<Character>)
+public init<S: Sequence>(_ elements: S)
+
+
let dict: [String: Any] = [:]
+_ = dict["key"] as? ↓Optional<String?> ?? Optional<String?>.none
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/test_case_accessibility.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/test_case_accessibility.html new file mode 100644 index 000000000..24da8a33e --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/test_case_accessibility.html @@ -0,0 +1,483 @@ + + + + test_case_accessibility Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Test Case Accessibility

+ +

Test cases should only contain private non-test members

+ +
    +
  • Identifier: test_case_accessibility
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +allowed_prefixes + +[] +
    +test_parent_classes + +[“QuickSpec”, “XCTestCase”] +
  • +
+

Non Triggering Examples

+
let foo: String?
+
+
let foo: String?
+
+class FooTests: XCTestCase {
+    static let allTests: [String] = []
+
+    private let foo: String {
+        let nestedMember = "hi"
+        return nestedMember
+    }
+
+    override static func setUp() {}
+
+    override func setUp() {}
+
+    override func setUpWithError() throws {}
+
+    override static func tearDown() {}
+
+    override func tearDown() {}
+
+    override func tearDownWithError() {}
+
+    override func someFutureXCTestFunction() {
+        super.someFutureXCTestFunction()
+    }
+
+    func testFoo() {
+        XCTAssertTrue(true)
+    }
+
+    func testBar() {
+        func nestedFunc() {}
+    }
+
+    private someFunc(hasParam: Bool) {}
+}
+
+
class FooTests: XCTestCase {
+    private struct MockSomething: Something {}
+}
+
+
class FooTests: XCTestCase {
+    override init() {
+        super.init()
+        let foo = 1
+        var bar = 2
+    }
+}
+
+
//
+// allowed_prefixes: ["allowedPrefix"]
+//
+
+class FooTests: XCTestCase {
+    func allowedPrefixTestFoo() {}
+}
+
+
+
class Foobar {
+    func setUp() {}
+
+    func tearDown() {}
+
+    func testFoo() {}
+}
+
+

Triggering Examples

+
class FooTests: XCTestCase {
+    ↓typealias Bar = Foo.Bar
+
+    ↓var foo: String?
+    ↓let bar: String?
+
+    ↓static func foo() {}
+
+    ↓func setUp(withParam: String) {}
+
+    ↓func foobar() {}
+
+    ↓func not_testBar() {}
+
+    ↓enum Nested {}
+
+    ↓static func testFoo() {}
+
+    ↓static func allTests() {}
+
+    ↓func testFoo(hasParam: Bool) {}
+}
+
+final class BarTests: XCTestCase {
+    ↓class Nested {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/todo.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/todo.html new file mode 100644 index 000000000..8db9e7de7 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/todo.html @@ -0,0 +1,400 @@ + + + + todo Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Todo

+ +

TODOs and FIXMEs should be resolved.

+ +
    +
  • Identifier: todo
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +only + +[TODO, FIXME] +
  • +
+

Non Triggering Examples

+
// notaTODO:
+
+
// notaFIXME:
+
+

Triggering Examples

+
// ↓TODO:
+
+
// ↓FIXME:
+
+
// ↓TODO(note)
+
+
// ↓FIXME(note)
+
+
/* ↓FIXME: */
+
+
/* ↓TODO: */
+
+
/** ↓FIXME: */
+
+
/** ↓TODO: */
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/toggle_bool.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/toggle_bool.html new file mode 100644 index 000000000..e363ea46a --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/toggle_bool.html @@ -0,0 +1,390 @@ + + + + toggle_bool Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Toggle Bool

+ +

Prefer someBool.toggle() over someBool = !someBool

+ +
    +
  • Identifier: toggle_bool
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
isHidden.toggle()
+
+
view.clipsToBounds.toggle()
+
+
func foo() { abc.toggle() }
+
+
view.clipsToBounds = !clipsToBounds
+
+
disconnected = !connected
+
+
result = !result.toggle()
+
+

Triggering Examples

+
↓isHidden = !isHidden
+
+
↓view.clipsToBounds = !view.clipsToBounds
+
+
func foo() { ↓abc = !abc }
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/trailing_closure.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/trailing_closure.html new file mode 100644 index 000000000..ed7fbf42a --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/trailing_closure.html @@ -0,0 +1,428 @@ + + + + trailing_closure Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Trailing Closure

+ +

Trailing closure syntax should be used whenever possible

+ +
    +
  • Identifier: trailing_closure
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +only_single_muted_parameter + +false +
  • +
+

Non Triggering Examples

+
foo.map { $0 + 1 }
+
+
foo.bar()
+
+
foo.reduce(0) { $0 + 1 }
+
+
if let foo = bar.map({ $0 + 1 }) { }
+
+
foo.something(param1: { $0 }, param2: { $0 + 1 })
+
+
offsets.sorted { $0.offset < $1.offset }
+
+
foo.something({ return 1 }())
+
+
foo.something({ return $0 }(1))
+
+
foo.something(0, { return 1 }())
+
+
for x in list.filter({ $0.isValid }) {}
+
+
if list.allSatisfy({ $0.isValid }) {}
+
+
foo(param1: 1, param2: { _ in true }, param3: 0)
+
+
foo(param1: 1, param2: { _ in true }) { $0 + 1 }
+
+
foo(param1: { _ in false }, param2: { _ in true })
+
+
foo(param1: { _ in false }, param2: { _ in true }, param3: { _ in false })
+
+
if f({ true }), g({ true }) {
+    print("Hello")
+}
+
+
for i in h({ [1,2,3] }) {
+    print(i)
+}
+
+

Triggering Examples

+
foo.map(↓{ $0 + 1 })
+
+
foo.reduce(0, combine: ↓{ $0 + 1 })
+
+
offsets.sorted(by: ↓{ $0.offset < $1.offset })
+
+
foo.something(0, ↓{ $0 + 1 })
+
+
foo.something(param1: { _ in true }, param2: 0, param3: ↓{ _ in false })
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/trailing_comma.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/trailing_comma.html new file mode 100644 index 000000000..f2f514e66 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/trailing_comma.html @@ -0,0 +1,430 @@ + + + + trailing_comma Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Trailing Comma

+ +

Trailing commas in arrays and dictionaries should be avoided/enforced.

+ +
    +
  • Identifier: trailing_comma
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +mandatory_comma + +false +
  • +
+

Non Triggering Examples

+
let foo = [1, 2, 3]
+
+
let foo = []
+
+
let foo = [:]
+
+
let foo = [1: 2, 2: 3]
+
+
let foo = [Void]()
+
+
let example = [ 1,
+ 2
+ // 3,
+]
+
+
foo([1: "\(error)"])
+
+
let foo = [Int]()
+
+

Triggering Examples

+
let foo = [1, 2, 3↓,]
+
+
let foo = [1, 2, 3↓, ]
+
+
let foo = [1, 2, 3   ↓,]
+
+
let foo = [1: 2, 2: 3↓, ]
+
+
struct Bar {
+ let foo = [1: 2, 2: 3↓, ]
+}
+
+
let foo = [1, 2, 3↓,] + [4, 5, 6↓,]
+
+
let example = [ 1,
+2↓,
+ // 3,
+]
+
+
let foo = ["אבג", "αβγ", "🇺🇸"↓,]
+
+
class C {
+ #if true
+ func f() {
+ let foo = [1, 2, 3↓,]
+ }
+ #endif
+}
+
+
foo([1: "\(error)"↓,])
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/trailing_newline.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/trailing_newline.html new file mode 100644 index 000000000..a0b4f508e --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/trailing_newline.html @@ -0,0 +1,381 @@ + + + + trailing_newline Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Trailing Newline

+ +

Files should have a single trailing newline

+ +
    +
  • Identifier: trailing_newline
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let a = 0
+
+
+

Triggering Examples

+
let a = 0
+
+
let a = 0
+
+
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/trailing_semicolon.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/trailing_semicolon.html new file mode 100644 index 000000000..fd6f3ca34 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/trailing_semicolon.html @@ -0,0 +1,385 @@ + + + + trailing_semicolon Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Trailing Semicolon

+ +

Lines should not have trailing semicolons

+ +
    +
  • Identifier: trailing_semicolon
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let a = 0
+
+
let a = 0; let b = 0
+
+

Triggering Examples

+
let a = 0↓;
+
+
+
let a = 0↓;
+let b = 1
+
+
let a = 0↓; // a comment
+
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/trailing_whitespace.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/trailing_whitespace.html new file mode 100644 index 000000000..fc3c1c967 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/trailing_whitespace.html @@ -0,0 +1,409 @@ + + + + trailing_whitespace Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Trailing Whitespace

+ +

Lines should not have trailing whitespace

+ +
    +
  • Identifier: trailing_whitespace
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +ignores_empty_lines + +false +
    +ignores_comments + +true +
  • +
+

Non Triggering Examples

+
let name: String
+
+
+
//
+
+
+
// 
+
+
+
let name: String //
+
+
+
let name: String // 
+
+
+

Triggering Examples

+
let name: String 
+
+
+
/* */ let name: String 
+
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/type_body_length.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/type_body_length.html new file mode 100644 index 000000000..585d47807 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/type_body_length.html @@ -0,0 +1,5476 @@ + + + + type_body_length Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Type Body Length

+ +

Type bodies should not span too many lines

+ +
    +
  • Identifier: type_body_length
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: metrics
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +warning + +250 +
    +error + +350 +
  • +
+

Non Triggering Examples

+
class Abc {
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+}
+
+
+
class Abc {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+
+
class Abc {
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+}
+
+
+
class Abc {
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+
+/* this is
+a multiline comment
+*/}
+
+
+
struct Abc {
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+}
+
+
+
struct Abc {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+
+
struct Abc {
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+}
+
+
+
struct Abc {
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+
+/* this is
+a multiline comment
+*/}
+
+
+
enum Abc {
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+}
+
+
+
enum Abc {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+
+
enum Abc {
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+}
+
+
+
enum Abc {
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+
+/* this is
+a multiline comment
+*/}
+
+
+
actor Abc {
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+}
+
+
+
actor Abc {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+
+
actor Abc {
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+}
+
+
+
actor Abc {
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+
+/* this is
+a multiline comment
+*/}
+
+
+

Triggering Examples

+
↓class Abc {
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+}
+
+
+
↓struct Abc {
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+}
+
+
+
↓enum Abc {
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+}
+
+
+
↓actor Abc {
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+}
+
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/type_contents_order.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/type_contents_order.html new file mode 100644 index 000000000..7eebdf230 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/type_contents_order.html @@ -0,0 +1,605 @@ + + + + type_contents_order Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Type Contents Order

+ +

Specifies the order of subtypes, properties, methods & more within a type.

+ +
    +
  • Identifier: type_contents_order
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +order + +[[case], [type_alias, associated_type], [subtype], [type_property], [instance_property], [ib_inspectable], [ib_outlet], [initializer], [type_method], [view_life_cycle_method], [ib_action], [other_method], [subscript], [deinitializer]] +
  • +
+

Non Triggering Examples

+
class TestViewController: UIViewController {
+// Type Aliases
+typealias CompletionHandler = ((TestEnum) -> Void)
+
+// Subtypes
+class TestClass {
+    // 10 lines
+}
+
+struct TestStruct {
+    // 3 lines
+}
+
+enum TestEnum {
+    // 5 lines
+}
+
+// Type Properties
+static let cellIdentifier: String = "AmazingCell"
+
+// Instance Properties
+var shouldLayoutView1: Bool!
+weak var delegate: TestViewControllerDelegate?
+private var hasLayoutedView1: Bool = false
+private var hasLayoutedView2: Bool = false
+
+private var hasAnyLayoutedView: Bool {
+     return hasLayoutedView1 || hasLayoutedView2
+}
+
+// IBOutlets
+@IBOutlet private var view1: UIView!
+@IBOutlet private var view2: UIView!
+
+// Initializers
+override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
+    super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
+}
+
+required init?(coder aDecoder: NSCoder) {
+    fatalError("init(coder:) has not been implemented")
+}
+
+// Type Methods
+static func makeViewController() -> TestViewController {
+    // some code
+}
+
+// View Life-Cycle Methods
+override func viewDidLoad() {
+    super.viewDidLoad()
+
+    view1.setNeedsLayout()
+    view1.layoutIfNeeded()
+    hasLayoutedView1 = true
+}
+
+override func willMove(toParent parent: UIViewController?) {
+    super.willMove(toParent: parent)
+    if parent == nil {
+        viewModel.willMoveToParent()
+    }
+}
+
+override func viewDidLayoutSubviews() {
+    super.viewDidLayoutSubviews()
+
+    view2.setNeedsLayout()
+    view2.layoutIfNeeded()
+    hasLayoutedView2 = true
+}
+
+override func viewIsAppearing(_ animated: Bool) {
+    super.viewIsAppearing(animated)
+}
+
+// IBActions
+@IBAction func goNextButtonPressed() {
+    goToNextVc()
+    delegate?.didPressTrackedButton()
+}
+
+// Other Methods
+func goToNextVc() { /* TODO */ }
+
+func goToInfoVc() { /* TODO */ }
+
+func goToRandomVc() {
+    let viewCtrl = getRandomVc()
+    present(viewCtrl, animated: true)
+}
+
+private func getRandomVc() -> UIViewController { return UIViewController() }
+
+// Subscripts
+subscript(_ someIndexThatIsNotEvenUsed: Int) -> String {
+    get {
+        return "This is just a test"
+    }
+
+    set {
+        log.warning("Just a test", newValue)
+    }
+}
+
+deinit {
+    log.debug("deinit")
+},
+}
+
+

Triggering Examples

+
class TestViewController: UIViewController {
+    // Subtypes
+    ↓class TestClass {
+        // 10 lines
+    }
+
+    // Type Aliases
+    typealias CompletionHandler = ((TestEnum) -> Void)
+}
+
+
class TestViewController: UIViewController {
+    // Stored Type Properties
+    ↓static let cellIdentifier: String = "AmazingCell"
+
+    // Subtypes
+    class TestClass {
+        // 10 lines
+    }
+}
+
+
class TestViewController: UIViewController {
+    // Stored Instance Properties
+    ↓var shouldLayoutView1: Bool!
+
+    // Stored Type Properties
+    static let cellIdentifier: String = "AmazingCell"
+}
+
+
class TestViewController: UIViewController {
+    // IBOutlets
+    @IBOutlet private ↓var view1: UIView!
+
+    // Computed Instance Properties
+    private var hasAnyLayoutedView: Bool {
+         return hasLayoutedView1 || hasLayoutedView2
+    }
+}
+
+
class TestViewController: UIViewController {
+
+    // deinitializer
+    ↓deinit {
+        log.debug("deinit")
+    }
+
+    // Initializers
+    override ↓init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
+        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
+    }
+
+    // IBOutlets
+    @IBOutlet private var view1: UIView!
+    @IBOutlet private var view2: UIView!
+}
+
+
class TestViewController: UIViewController {
+    // View Life-Cycle Methods
+    override ↓func viewDidLoad() {
+        super.viewDidLoad()
+
+        view1.setNeedsLayout()
+        view1.layoutIfNeeded()
+        hasLayoutedView1 = true
+    }
+
+    // Type Methods
+    static func makeViewController() -> TestViewController {
+        // some code
+    }
+}
+
+
class TestViewController: UIViewController {
+    // IBActions
+    @IBAction ↓func goNextButtonPressed() {
+        goToNextVc()
+        delegate?.didPressTrackedButton()
+    }
+
+    // View Life-Cycle Methods
+    override func viewDidLoad() {
+        super.viewDidLoad()
+
+        view1.setNeedsLayout()
+        view1.layoutIfNeeded()
+        hasLayoutedView1 = true
+    }
+}
+
+
class TestViewController: UIViewController {
+    // Other Methods
+    ↓func goToNextVc() { /* TODO */ }
+
+    // IBActions
+    @IBAction func goNextButtonPressed() {
+        goToNextVc()
+        delegate?.didPressTrackedButton()
+    }
+}
+
+
class TestViewController: UIViewController {
+    // Subscripts
+    ↓subscript(_ someIndexThatIsNotEvenUsed: Int) -> String {
+        get {
+            return "This is just a test"
+        }
+
+        set {
+            log.warning("Just a test", newValue)
+        }
+    }
+
+    // MARK: Other Methods
+    func goToNextVc() { /* TODO */ }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/type_name.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/type_name.html new file mode 100644 index 000000000..eff3586a4 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/type_name.html @@ -0,0 +1,536 @@ + + + + type_name Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Type Name

+ +

Type name should only contain alphanumeric characters, start with an uppercase character and span between 3 and 40 characters in length. +Private types may start with an underscore.

+ +
    +
  • Identifier: type_name
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +min_length + + + + + + + + + + + + + + + +
    KeyValue
    +warning + +3 +
    +error + +0 +
    +
    +max_length + + + + + + + + + + + + + + + +
    KeyValue
    +warning + +40 +
    +error + +1000 +
    +
    +excluded + +[] +
    +allowed_symbols + +[] +
    +unallowed_symbols_severity + +error +
    +validates_start_with_lowercase + +error +
    +validate_protocols + +true +
  • +
+

Non Triggering Examples

+
class MyType {}
+
+
private struct _MyType {}
+
+
enum AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA {}
+
+
typealias Foo = Void
+
+
private typealias Foo = Void
+
+
protocol Foo {
+  associatedtype Bar
+}
+
+
protocol Foo {
+  associatedtype Bar: Equatable
+}
+
+
enum MyType {
+case value
+}
+
+
//
+// validate_protocols: false
+//
+
+protocol P {}
+
+
+
struct SomeStruct {
+  enum `Type` {
+    case x, y, z
+  }
+}
+
+

Triggering Examples

+
class ↓myType {}
+
+
enum ↓_MyType {}
+
+
private struct ↓MyType_ {}
+
+
struct ↓My {}
+
+
struct ↓AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA {}
+
+
class ↓MyView_Previews
+
+
private struct ↓_MyView_Previews
+
+
typealias ↓X = Void
+
+
private typealias ↓Foo_Bar = Void
+
+
private typealias ↓foo = Void
+
+
typealias ↓AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA = Void
+
+
protocol Foo {
+  associatedtype ↓X
+}
+
+
protocol Foo {
+  associatedtype ↓Foo_Bar: Equatable
+}
+
+
protocol Foo {
+  associatedtype ↓AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+}
+
+
protocol ↓X {}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/typesafe_array_init.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/typesafe_array_init.html new file mode 100644 index 000000000..f988ee84a --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/typesafe_array_init.html @@ -0,0 +1,400 @@ + + + + typesafe_array_init Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Type-safe Array Init

+ +

Prefer using Array(seq) over seq.map { $0 } to convert a sequence into an Array

+ +
    +
  • Identifier: typesafe_array_init
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: Yes
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
enum MyError: Error {}
+let myResult: Result<String, MyError> = .success("")
+let result: Result<Any, MyError> = myResult.map { $0 }
+
+
struct IntArray {
+    let elements = [1, 2, 3]
+    func map<T>(_ transformer: (Int) throws -> T) rethrows -> [T] {
+        try elements.map(transformer)
+    }
+}
+let ints = IntArray()
+let intsCopy = ints.map { $0 }
+
+

Triggering Examples

+
func f<Seq: Sequence>(s: Seq) -> [Seq.Element] {
+    s.↓map({ $0 })
+}
+
+
func f(array: [Int]) -> [Int] {
+    array.↓map { $0 }
+}
+
+
let myInts = [1, 2, 3].↓map { return $0 }
+
+
struct Generator: Sequence, IteratorProtocol {
+    func next() -> Int? { nil }
+}
+let array = Generator().↓map { i in i }
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unavailable_condition.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unavailable_condition.html new file mode 100644 index 000000000..9750c48a7 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unavailable_condition.html @@ -0,0 +1,410 @@ + + + + unavailable_condition Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unavailable Condition

+ +

Use #unavailable/#available instead of #available/#unavailable with an empty body.

+ +
    +
  • Identifier: unavailable_condition
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.6.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
if #unavailable(iOS 13) {
+  loadMainWindow()
+}
+
+
if #available(iOS 9.0, *) {
+  doSomething()
+} else {
+  legacyDoSomething()
+}
+
+
if #available(macOS 11.0, *) {
+   // Do nothing
+} else if #available(macOS 10.15, *) {
+   print("do some stuff")
+}
+
+

Triggering Examples

+
if ↓#available(iOS 14.0) {
+
+} else {
+  oldIos13TrackingLogic(isEnabled: ASIdentifierManager.shared().isAdvertisingTrackingEnabled)
+}
+
+
if ↓#available(iOS 14.0) {
+  // we don't need to do anything here
+} else {
+  oldIos13TrackingLogic(isEnabled: ASIdentifierManager.shared().isAdvertisingTrackingEnabled)
+}
+
+
if ↓#available(iOS 13, *) {} else {
+  loadMainWindow()
+}
+
+
if ↓#unavailable(iOS 13) {
+  // Do nothing
+} else if i < 2 {
+  loadMainWindow()
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unavailable_function.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unavailable_function.html new file mode 100644 index 000000000..cb0d49e08 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unavailable_function.html @@ -0,0 +1,421 @@ + + + + unavailable_function Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unavailable Function

+ +

Unimplemented functions should be marked as unavailable

+ +
    +
  • Identifier: unavailable_function
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class ViewController: UIViewController {
+  @available(*, unavailable)
+  public required init?(coder aDecoder: NSCoder) {
+    preconditionFailure("init(coder:) has not been implemented")
+  }
+}
+
+
func jsonValue(_ jsonString: String) -> NSObject {
+   let data = jsonString.data(using: .utf8)!
+   let result = try! JSONSerialization.jsonObject(with: data, options: [])
+   if let dict = (result as? [String: Any])?.bridge() {
+    return dict
+   } else if let array = (result as? [Any])?.bridge() {
+    return array
+   }
+   fatalError()
+}
+
+
func resetOnboardingStateAndCrash() -> Never {
+    resetUserDefaults()
+    // Crash the app to re-start the onboarding flow.
+    fatalError("Onboarding re-start crash.")
+}
+
+

Triggering Examples

+
class ViewController: UIViewController {
+  public required ↓init?(coder aDecoder: NSCoder) {
+    fatalError("init(coder:) has not been implemented")
+  }
+}
+
+
class ViewController: UIViewController {
+  public required ↓init?(coder aDecoder: NSCoder) {
+    let reason = "init(coder:) has not been implemented"
+    fatalError(reason)
+  }
+}
+
+
class ViewController: UIViewController {
+  public required ↓init?(coder aDecoder: NSCoder) {
+    preconditionFailure("init(coder:) has not been implemented")
+  }
+}
+
+
↓func resetOnboardingStateAndCrash() {
+    resetUserDefaults()
+    // Crash the app to re-start the onboarding flow.
+    fatalError("Onboarding re-start crash.")
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unhandled_throwing_task.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unhandled_throwing_task.html new file mode 100644 index 000000000..077549c45 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unhandled_throwing_task.html @@ -0,0 +1,512 @@ + + + + unhandled_throwing_task Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unhandled Throwing Task

+ +

Errors thrown inside this task are not handled, which may be unexpected. Handle errors inside the task, or use try await to access the Tasks value and handle errors. See this forum thread for more details: https://forums.swift.org/t/task-initializer-with-throwing-closure-swallows-error/56066

+ +
    +
  • Identifier: unhandled_throwing_task
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +error +
  • +
+

Non Triggering Examples

+
Task<Void, Never> {
+  try await myThrowingFunction()
+}
+
+
Task {
+  try? await myThrowingFunction()
+}
+
+
Task {
+  try! await myThrowingFunction()
+}
+
+
Task<Void, String> {
+  let text = try myThrowingFunction()
+  return text
+}
+
+
Task {
+  do {
+    try myThrowingFunction()
+  } catch let e {
+    print(e)
+  }
+}
+
+
func someFunction() throws {
+  Task {
+    anotherFunction()
+    do {
+      try myThrowingFunction()
+    } catch {
+      print(error)
+    }
+  }
+
+  try something()
+}
+
+
let task = Task {
+  try await myThrowingFunction()
+}
+
+
var task = Task {
+  try await myThrowingFunction()
+}
+
+
try await Task {
+  try await myThrowingFunction()
+}.value
+
+
executor.task = Task {
+  try await isolatedOpen(.init(executor.asUnownedSerialExecutor()))
+}
+
+
let result = await Task {
+  throw CancellationError()
+}.result
+
+
func makeTask() -> Task<String, Error> {
+  return Task {
+    try await someThrowingFunction()
+  }
+}
+
+
func makeTask() -> Task<String, Error> {
+  // Implicit return
+  Task {
+    try await someThrowingFunction()
+  }
+}
+
+
Task {
+  return Result {
+      try someThrowingFunc()
+  }
+}
+
+

Triggering Examples

+
↓Task {
+  try await myThrowingFunction()
+}
+
+
↓Task {
+  let text = try myThrowingFunction()
+  return text
+}
+
+
↓Task {
+  do {
+    try myThrowingFunction()
+  }
+}
+
+
↓Task {
+  do {
+    try myThrowingFunction()
+  } catch let e as FooError {
+    print(e)
+  }
+}
+
+
↓Task {
+  do {
+    throw FooError.bar
+  }
+}
+
+
↓Task {
+  throw FooError.bar
+}
+
+
↓Task<_, _> {
+  throw FooError.bar
+}
+
+
↓Task<Void,_> {
+  throw FooError.bar
+}
+
+
↓Task {
+  do {
+    try foo()
+  } catch {
+    try bar()
+  }
+}
+
+
↓Task {
+  do {
+    try foo()
+  } catch {
+    throw BarError()
+  }
+}
+
+
func doTask() {
+  ↓Task {
+    try await someThrowingFunction()
+  }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unneeded_break_in_switch.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unneeded_break_in_switch.html new file mode 100644 index 000000000..83ee26693 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unneeded_break_in_switch.html @@ -0,0 +1,433 @@ + + + + unneeded_break_in_switch Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unneeded Break in Switch

+ +

Avoid using unneeded break statements

+ +
    +
  • Identifier: unneeded_break_in_switch
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
switch foo {
+case .bar:
+    break
+}
+
+
switch foo {
+default:
+    break
+}
+
+
switch foo {
+case .bar:
+    for i in [0, 1, 2] { break }
+}
+
+
switch foo {
+case .bar:
+    if true { break }
+}
+
+
switch foo {
+case .bar:
+    something()
+}
+
+
let items = [Int]()
+for item in items {
+    if bar() {
+        do {
+            try foo()
+        } catch {
+            bar()
+            break
+        }
+    }
+}
+
+

Triggering Examples

+
switch foo {
+case .bar:
+    something()
+    ↓break
+}
+
+
switch foo {
+case .bar:
+    something()
+    ↓break // comment
+}
+
+
switch foo {
+default:
+    something()
+    ↓break
+}
+
+
switch foo {
+case .foo, .foo2 where condition:
+    something()
+    ↓break
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unneeded_override.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unneeded_override.html new file mode 100644 index 000000000..2acc7155a --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unneeded_override.html @@ -0,0 +1,545 @@ + + + + unneeded_override Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unneeded Overridden Functions

+ +

Remove overridden functions that don’t do anything except call their super

+ +
    +
  • Identifier: unneeded_override
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +affect_initializers + +false +
  • +
+

Non Triggering Examples

+
class Foo {
+    override func bar() {
+        super.bar()
+        print("hi")
+    }
+}
+
+
class Foo {
+    @available(*, unavailable)
+    override func bar() {
+        super.bar()
+    }
+}
+
+
class Foo {
+    @objc override func bar() {
+        super.bar()
+    }
+}
+
+
class Foo {
+    override func bar() {
+        super.bar()
+        super.bar()
+    }
+}
+
+
class Foo {
+    override func bar() throws {
+        // Doing a different variation of 'try' changes behavior
+        try! super.bar()
+    }
+}
+
+
class Foo {
+    override func bar() throws {
+        // Doing a different variation of 'try' changes behavior
+        try? super.bar()
+    }
+}
+
+
class Foo {
+    override func bar() async throws {
+        // Doing a different variation of 'try' changes behavior
+        await try! super.bar()
+    }
+}
+
+
class Foo {
+    override func bar(arg: Bool) {
+        // Flipping the argument changes behavior
+        super.bar(arg: !arg)
+    }
+}
+
+
class Foo {
+    override func bar(_ arg: Int) {
+        // Changing the argument changes behavior
+        super.bar(arg + 1)
+    }
+}
+
+
class Foo {
+    override func bar(arg: Int) {
+        // Changing the argument changes behavior
+        super.bar(arg: arg.var)
+    }
+}
+
+
class Foo {
+    override func bar(_ arg: Int) {
+        // Not passing arguments because they have default values changes behavior
+        super.bar()
+    }
+}
+
+
class Foo {
+    override func bar(arg: Int, _ arg3: Bool) {
+        // Calling a super function with different argument labels changes behavior
+        super.bar(arg2: arg, arg3: arg3)
+    }
+}
+
+
class Foo {
+    override func bar(animated: Bool, completion: () -> Void) {
+        super.bar(animated: animated) {
+            // This likely changes behavior
+        }
+    }
+}
+
+
class Foo {
+    override func bar(animated: Bool, completion: () -> Void) {
+        super.bar(animated: animated, completion: {
+            // This likely changes behavior
+        })
+    }
+}
+
+
class Baz: Foo {
+    // A default argument might be a change
+    override func bar(value: String = "Hello") {
+        super.bar(value: value)
+    }
+}
+
+
class C {
+    override func foo() {
+        super.foo {}
+    }
+    override func bar(_ c: () -> Void) {
+        super.bar {}
+    }
+    override func baz(_ c: () -> Void) {
+        super.baz({})
+    }
+    override func qux(c: () -> Void) {
+        super.qux(c: {})
+    }
+}
+
+

Triggering Examples

+
class Foo {
+    ↓override func bar() {
+        super.bar()
+    }
+}
+
+
class Foo {
+    ↓override func bar() {
+        return super.bar()
+    }
+}
+
+
class Foo {
+    ↓override func bar() {
+        super.bar()
+        // comments don't affect this
+    }
+}
+
+
class Foo {
+    ↓override func bar() async {
+        await super.bar()
+    }
+}
+
+
class Foo {
+    ↓override func bar() throws {
+        try super.bar()
+        // comments don't affect this
+    }
+}
+
+
class Foo {
+    ↓override func bar(arg: Bool) throws {
+        try super.bar(arg: arg)
+    }
+}
+
+
class Foo {
+    ↓override func bar(animated: Bool, completion: () -> Void) {
+        super.bar(animated: animated, completion: completion)
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unneeded_parentheses_in_closure_argument.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unneeded_parentheses_in_closure_argument.html new file mode 100644 index 000000000..49d7f7814 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unneeded_parentheses_in_closure_argument.html @@ -0,0 +1,416 @@ + + + + unneeded_parentheses_in_closure_argument Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unneeded Parentheses in Closure Argument

+ +

Parentheses are not needed when declaring closure arguments

+ +
    +
  • Identifier: unneeded_parentheses_in_closure_argument
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let foo = { (bar: Int) in }
+
+
let foo = { bar, _  in }
+
+
let foo = { bar in }
+
+
let foo = { bar -> Bool in return true }
+
+
DispatchQueue.main.async { () -> Void in
+    doSomething()
+}
+
+

Triggering Examples

+
call(arg: { ↓(bar) in })
+
+
call(arg: { ↓(bar, _) in })
+
+
let foo = { ↓(bar) -> Bool in return true }
+
+
foo.map { ($0, $0) }.forEach { ↓(x, y) in }
+
+
foo.bar { [weak self] ↓(x, y) in }
+
+
[].first { ↓(temp) in
+    [].first { ↓(temp) in
+        [].first { ↓(temp) in
+            _ = temp
+            return false
+        }
+        return false
+    }
+    return false
+}
+
+
[].first { temp in
+    [].first { ↓(temp) in
+        [].first { ↓(temp) in
+            _ = temp
+            return false
+        }
+        return false
+    }
+    return false
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unneeded_synthesized_initializer.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unneeded_synthesized_initializer.html new file mode 100644 index 000000000..27362cc81 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unneeded_synthesized_initializer.html @@ -0,0 +1,702 @@ + + + + unneeded_synthesized_initializer Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unneeded Synthesized Initializer

+ +

Default or memberwise initializers that will be automatically synthesized do not need to be manually defined.

+ +
    +
  • Identifier: unneeded_synthesized_initializer
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
struct Foo {
+    let bar: String
+
+    // Synthesized initializer would not be private.
+    private init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
struct Foo {
+    var bar: String
+
+    // Synthesized initializer would not be private.
+    private init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
struct Foo {
+    let bar: String
+
+    // Synthesized initializer would not be fileprivate.
+    fileprivate init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
struct Foo {
+    let bar: String
+
+    // Synthesized initializer would not prepend "foo".
+    init(bar: String) {
+        self.bar = "foo" + bar
+    }
+}
+
+
internal struct Foo {
+    let bar: String
+
+    // Failable initializer
+    init?(bar: String) {
+        self.bar = bar
+    }
+}
+
+
internal struct Foo {
+    let bar: String
+
+    // Initializer throws
+    init(bar: String) throws {
+        self.bar = bar
+    }
+}
+
+
internal struct Foo {
+    let bar: String
+
+    // Different argument labels
+    init(_ bar: String) {
+        self.bar = bar
+    }
+}
+
+
internal struct Foo {
+    var bar: String = "foo"
+
+    // Different default values
+    init(bar: String = "bar") {
+        self.bar = bar
+    }
+}
+
+
internal struct Foo {
+    private static var bar: String
+
+    // var is static
+    init(bar: String) {
+        Self.bar = bar
+    }
+}
+
+
internal struct Foo {
+    private var bar: String
+
+    // var is private
+    init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
internal struct Foo {
+    fileprivate var bar: String
+
+    // var is fileprivate
+    init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
struct Foo {
+    var foo: String
+    var bar: String
+
+    // init has no body
+    init(foo: String, bar: String) {
+    }
+}
+
+
struct Foo {
+    var foo: String
+    var bar: String
+
+    // foo is not initialized
+    init(foo: String, bar: String) {
+        self.bar = bar
+    }
+}
+
+
struct Foo {
+    var foo: String
+    var bar: String
+
+    // Ordering of args is different from properties.
+    init(bar: String, foo: String) {
+        self.foo = foo
+        self.bar = bar
+    }
+}
+
+
@frozen
+public struct Field {
+    @usableFromInline
+    let index: Int
+
+    @usableFromInline
+    let parent: Metadata
+
+    @inlinable // inlinable
+    init(index: Int, parent: Metadata) {
+       self.index = index
+       self.parent = parent
+    }
+}
+
+
internal struct Foo {
+    var bar: String = ""
+    var baz: Int = 0
+
+    // These initializers must be declared.
+    init() { }
+
+    init(bar: String = "", baz: Int = 0) {
+        self.bar = bar
+        self.baz = baz
+    }
+
+    // Because manually declared initializers block
+    // synthesization.
+    init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
struct Foo {
+    init() {
+        print("perform side effect")
+    }
+}
+
+
struct Foo {
+    var bar: Int = 0
+
+    init(bar: Int = 0) {
+        self.bar = bar
+        print("perform side effect")
+    }
+}
+
+
struct Foo {
+    var bar: Int
+
+    init(@Clamped bar: Int) {
+        self.bar = bar
+    }
+}
+
+
struct Foo {
+    let bar: Int
+
+    init(bar: Int) {
+        self.bar = bar
+    }
+    init?() {
+        return nil
+    }
+}
+
+
struct Foo {
+    @available(*, unavailable)
+    init() {}
+}
+
+

Triggering Examples

+
struct Foo {
+    let bar: String
+
+   ↓init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
struct Foo {
+    var bar: String
+
+   ↓init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
private struct Foo {
+    let bar: String
+
+   ↓init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
fileprivate struct Foo {
+    let bar: String
+
+   ↓init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
internal struct Foo {
+    fileprivate var bar: String
+
+   ↓fileprivate init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
internal struct Foo {
+    private var bar: String
+
+   ↓private init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
struct Foo {
+    var foo: String
+    var bar: String
+
+   ↓init(foo: String, bar: String) {
+        self.foo = foo
+        self.bar = bar
+    }
+}
+
+
internal struct Foo {
+    var bar: String
+
+   ↓internal init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
struct Foo {
+    var bar: String = ""
+
+   ↓init() {
+        // Empty initializer will be generated automatically
+        // when all vars have default values.
+    }
+}
+
+
struct Foo {
+    var bar: String = ""
+
+   ↓init() {
+        // Empty initializer
+    }
+
+   ↓init(bar: String = "") {
+        self.bar = bar
+    }
+}
+
+
struct Foo {
+    var bar = ""
+
+   ↓init(bar: String = "") {
+        self.bar = bar
+    }
+}
+
+
struct Outer {
+    struct Inner {
+        let prop: Int
+
+       ↓init(prop: Int) {
+            self.prop = prop
+        }
+    }
+}
+
+
class Foo {
+    struct Bar {
+        let baz: Int
+
+       ↓init(baz: Int) {
+            self.baz = baz
+        }
+    }
+}
+
+
struct Foo {
+    let i: Int
+    struct Bar {
+        let j: Int
+        ↓init(j: Int) {
+            self.j = j
+        }
+    }
+    ↓init(i: Int) {
+        self.i = i
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unowned_variable_capture.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unowned_variable_capture.html new file mode 100644 index 000000000..998814048 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unowned_variable_capture.html @@ -0,0 +1,398 @@ + + + + unowned_variable_capture Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unowned Variable Capture

+ +

Prefer capturing references as weak to avoid potential crashes

+ +
    +
  • Identifier: unowned_variable_capture
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
foo { [weak self] in _ }
+
+
foo { [weak self] param in _ }
+
+
foo { [weak bar] in _ }
+
+
foo { [weak bar] param in _ }
+
+
foo { bar in _ }
+
+
foo { $0 }
+
+
final class First {}
+final class Second {
+    unowned var value: First
+    init(value: First) {
+        self.value = value
+    }
+}
+
+

Triggering Examples

+
foo { [↓unowned self] in _ }
+
+
foo { [↓unowned bar] in _ }
+
+
foo { [bar, ↓unowned self] in _ }
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/untyped_error_in_catch.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/untyped_error_in_catch.html new file mode 100644 index 000000000..fd4d28fc5 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/untyped_error_in_catch.html @@ -0,0 +1,427 @@ + + + + untyped_error_in_catch Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Untyped Error in Catch

+ +

Catch statements should not declare error variables without type casting

+ +
    +
  • Identifier: untyped_error_in_catch
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
do {
+  try foo()
+} catch {}
+
+
do {
+  try foo()
+} catch Error.invalidOperation {
+} catch {}
+
+
do {
+  try foo()
+} catch let error as MyError {
+} catch {}
+
+
do {
+  try foo()
+} catch var error as MyError {
+} catch {}
+
+
do {
+    try something()
+} catch let e where e.code == .fileError {
+    // can be ignored
+} catch {
+    print(error)
+}
+
+

Triggering Examples

+
do {
+  try foo()
+} ↓catch var error {}
+
+
do {
+  try foo()
+} ↓catch let error {}
+
+
do {
+  try foo()
+} ↓catch let someError {}
+
+
do {
+  try foo()
+} ↓catch var someError {}
+
+
do {
+  try foo()
+} ↓catch let e {}
+
+
do {
+  try foo()
+} ↓catch(let error) {}
+
+
do {
+  try foo()
+} ↓catch (let error) {}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unused_closure_parameter.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unused_closure_parameter.html new file mode 100644 index 000000000..ed7e3ed93 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unused_closure_parameter.html @@ -0,0 +1,485 @@ + + + + unused_closure_parameter Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unused Closure Parameter

+ +

Unused parameter in a closure should be replaced with _

+ +
    +
  • Identifier: unused_closure_parameter
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
[1, 2].map { $0 + 1 }
+
+
[1, 2].map({ $0 + 1 })
+
+
[1, 2].map { number in
+ number + 1 
+}
+
+
[1, 2].map { _ in
+ 3 
+}
+
+
[1, 2].something { number, idx in
+ return number * idx
+}
+
+
let isEmpty = [1, 2].isEmpty()
+
+
violations.sorted(by: { lhs, rhs in 
+ return lhs.location > rhs.location
+})
+
+
rlmConfiguration.migrationBlock.map { rlmMigration in
+    return { migration, schemaVersion in
+        rlmMigration(migration.rlmMigration, schemaVersion)
+    }
+}
+
+
genericsFunc { (a: Type, b) in
+    a + b
+}
+
+
var label: UILabel = { (lbl: UILabel) -> UILabel in
+    lbl.backgroundColor = .red
+    return lbl
+}(UILabel())
+
+
hoge(arg: num) { num in
+    return num
+}
+
+
({ (manager: FileManager) in
+  print(manager)
+})(FileManager.default)
+
+
withPostSideEffect { input in
+    if true { print("\(input)") }
+}
+
+
viewModel?.profileImage.didSet(weak: self) { (self, profileImage) in
+    self.profileImageView.image = profileImage
+}
+
+
let failure: Failure = { task, error in
+    observer.sendFailed(error, task)
+}
+
+
List($names) { $name in
+    Text(name)
+}
+
+
List($names) { $name in
+    TextField($name)
+}
+
+
_ = ["a"].filter { `class` in `class`.hasPrefix("a") }
+
+
let closure: (Int) -> Void = { `foo` in _ = foo }
+
+
let closure: (Int) -> Void = { foo in _ = `foo` }
+
+

Triggering Examples

+
[1, 2].map { ↓number in
+ return 3 }
+
+
[1, 2].map { ↓number in
+ return numberWithSuffix }
+
+
[1, 2].map { ↓number in
+ return 3 // number }
+
+
[1, 2].map { ↓number in
+ return 3 "number" }
+
+
[1, 2].something { number, ↓idx in
+ return number }
+
+
genericsFunc { (↓number: TypeA, idx: TypeB) in return idx }
+
+
let c: (Int) -> Void = { foo in _ = .foo }
+
+
hoge(arg: num) { ↓num in
+}
+
+
fooFunc { ↓아 in }
+
+
func foo () {
+ bar { ↓number in return 3 }
+
+
viewModel?.profileImage.didSet(weak: self) { (↓self, profileImage) in
+    profileImageView.image = profileImage
+}
+
+
let failure: Failure = { ↓task, error in
+    observer.sendFailed(error)
+}
+
+
List($names) { ↓$name in
+    Text("Foo")
+}
+
+
let class1 = "a"
+_ = ["a"].filter { ↓`class` in `class1`.hasPrefix("a") }
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unused_control_flow_label.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unused_control_flow_label.html new file mode 100644 index 000000000..b1b7c585f --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unused_control_flow_label.html @@ -0,0 +1,415 @@ + + + + unused_control_flow_label Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unused Control Flow Label

+ +

Unused control flow label should be removed

+ +
    +
  • Identifier: unused_control_flow_label
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
loop: while true { break loop }
+
+
loop: while true { continue loop }
+
+
loop:
+    while true { break loop }
+
+
while true { break }
+
+
loop: for x in array { break loop }
+
+
label: switch number {
+case 1: print("1")
+case 2: print("2")
+default: break label
+}
+
+
loop: repeat {
+    if x == 10 {
+        break loop
+    }
+} while true
+
+

Triggering Examples

+
↓loop: while true { break }
+
+
↓loop: while true { break loop1 }
+
+
↓loop: while true { break outerLoop }
+
+
↓loop: for x in array { break }
+
+
↓label: switch number {
+case 1: print("1")
+case 2: print("2")
+default: break
+}
+
+
↓loop: repeat {
+    if x == 10 {
+        break
+    }
+} while true
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unused_declaration.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unused_declaration.html new file mode 100644 index 000000000..a4fa99521 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unused_declaration.html @@ -0,0 +1,667 @@ + + + + unused_declaration Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unused Declaration

+ +

Declarations should be referenced at least once within all files linted

+ +
    +
  • Identifier: unused_declaration
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: Yes
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +error +
    +include_public_and_open + +false +
    +related_usrs_to_skip + +[“s:7SwiftUI15PreviewProviderP”] +
  • +
+

Non Triggering Examples

+
let kConstant = 0
+_ = kConstant
+
+
enum Change<T> {
+  case insert(T)
+  case delete(T)
+}
+
+extension Sequence {
+  func deletes<T>() -> [T] where Element == Change<T> {
+    return compactMap { operation in
+      if case .delete(let value) = operation {
+        return value
+      } else {
+        return nil
+      }
+    }
+  }
+}
+
+let changes = [Change.insert(0), .delete(0)]
+_ = changes.deletes()
+
+
struct Item: Codable {}
+struct ResponseModel: Codable {
+    let items: [Item]
+
+    enum CodingKeys: String, CodingKey {
+        case items = "ResponseItems"
+    }
+}
+
+_ = ResponseModel(items: [Item()]).items
+
+
class ResponseModel {
+    @objc func foo() {
+    }
+}
+_ = ResponseModel()
+
+
public func foo() {}
+
+
protocol Foo {}
+
+extension Foo {
+    func bar() {}
+}
+
+struct MyStruct: Foo {}
+MyStruct().bar()
+
+
import XCTest
+class MyTests: XCTestCase {
+    func testExample() {}
+}
+
+
import XCTest
+open class BestTestCase: XCTestCase {}
+class MyTests: BestTestCase {
+    func testExample() {}
+}
+
+
    struct S {
+        var i: Int? = nil
+        func f() {
+            if let i { print(i) }
+        }
+    }
+    S().f()
+
+
enum Component {
+  case string(StaticString)
+  indirect case array([Component])
+  indirect case optional(Component?)
+}
+
+@resultBuilder
+struct ComponentBuilder {
+  static func buildBlock(_ components: Component...) -> Component {
+    return .array(components)
+  }
+
+  static func buildExpression(_ string: StaticString) -> Component {
+    return .string(string)
+  }
+
+  static func buildOptional(_ component: Component?) -> Component {
+    return .optional(component)
+  }
+
+  static func buildEither(first component: Component) -> Component {
+    return component
+  }
+
+  static func buildEither(second component: Component) -> Component {
+    return component
+  }
+
+  static func buildArray(_ components: [Component]) -> Component {
+    return .array(components)
+  }
+
+  static func buildLimitedAvailability(_ component: Component) -> Component {
+    return component
+  }
+
+  static func buildFinalResult(_ component: Component) -> Component {
+    return component
+  }
+
+  static func buildPartialBlock(first component: Component) -> Component {
+    return component
+  }
+
+  static func buildPartialBlock(accumulated component: Component, next: Component) -> Component {
+    return component
+  }
+}
+
+func acceptComponentBuilder(@ComponentBuilder _ body: () -> Component) {
+  print(body())
+}
+
+acceptComponentBuilder {
+  "hello"
+}
+
+
import Cocoa
+
+@NSApplicationMain
+final class AppDelegate: NSObject, NSApplicationDelegate {
+    func applicationWillFinishLaunching(_ notification: Notification) {}
+    func applicationWillBecomeActive(_ notification: Notification) {}
+}
+
+
import Foundation
+
+public final class Foo: NSObject {
+    @IBAction private func foo() {}
+}
+
+
import Foundation
+
+public final class Foo: NSObject {
+    @objc func foo() {}
+}
+
+
import Foundation
+
+public final class Foo: NSObject {
+    @IBInspectable private var innerPaddingWidth: Int {
+        set { self.backgroundView.innerPaddingWidth = newValue }
+        get { return self.backgroundView.innerPaddingWidth }
+    }
+}
+
+
import Foundation
+
+public final class Foo: NSObject {
+    @IBOutlet private var bar: NSObject! {
+        set { fatalError() }
+        get { fatalError() }
+    }
+
+    @IBOutlet private var baz: NSObject! {
+        willSet { print("willSet") }
+    }
+
+    @IBOutlet private var buzz: NSObject! {
+        didSet { print("didSet") }
+    }
+}
+
+

Triggering Examples

+
let ↓kConstant = 0
+
+
struct Item {}
+struct ↓ResponseModel: Codable {
+    let ↓items: [Item]
+
+    enum ↓CodingKeys: String {
+        case items = "ResponseItems"
+    }
+}
+
+
class ↓ResponseModel {
+    func ↓foo() {
+    }
+}
+
+
//
+// include_public_and_open: true
+//
+
+public func ↓foo() {}
+
+
+
protocol Foo {
+    func ↓bar1()
+}
+
+extension Foo {
+    func bar1() {}
+    func ↓bar2() {}
+}
+
+struct MyStruct: Foo {}
+_ = MyStruct()
+
+
import XCTest
+class ↓MyTests: NSObject {
+    func ↓testExample() {}
+}
+
+
enum Component {
+  case string(StaticString)
+  indirect case array([Component])
+  indirect case optional(Component?)
+}
+
+struct ComponentBuilder {
+  func ↓buildExpression(_ string: StaticString) -> Component {
+    return .string(string)
+  }
+
+  func ↓buildBlock(_ components: Component...) -> Component {
+    return .array(components)
+  }
+
+  func ↓buildIf(_ value: Component?) -> Component {
+    return .optional(value)
+  }
+
+  static func ↓buildABear(_ components: Component...) -> Component {
+    return .array(components)
+  }
+}
+
+_ = ComponentBuilder()
+
+
protocol ↓Foo {}
+extension Foo {}
+
+
class ↓C<T> {}
+extension C<Int> {}
+
+
import Cocoa
+
+@NSApplicationMain
+final class AppDelegate: NSObject, NSApplicationDelegate {
+    func ↓appWillFinishLaunching(_ notification: Notification) {}
+    func applicationWillBecomeActive(_ notification: Notification) {}
+}
+
+
import Cocoa
+
+final class ↓AppDelegate: NSObject, NSApplicationDelegate {
+    func applicationWillFinishLaunching(_ notification: Notification) {}
+    func applicationWillBecomeActive(_ notification: Notification) {}
+}
+
+
import Foundation
+
+public final class Foo: NSObject {
+    @IBOutlet var ↓bar: NSObject!
+}
+
+
import Foundation
+
+public final class Foo: NSObject {
+    @IBInspectable var ↓bar: String!
+}
+
+
import Foundation
+
+final class Foo: NSObject {}
+final class ↓Bar {
+    var ↓foo = Foo()
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unused_enumerated.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unused_enumerated.html new file mode 100644 index 000000000..261cd00cd --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unused_enumerated.html @@ -0,0 +1,435 @@ + + + + unused_enumerated Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unused Enumerated

+ +

When the index or the item is not used, .enumerated() can be removed.

+ +
    +
  • Identifier: unused_enumerated
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
for (idx, foo) in bar.enumerated() { }
+
+
for (_, foo) in bar.enumerated().something() { }
+
+
for (_, foo) in bar.something() { }
+
+
for foo in bar.enumerated() { }
+
+
for foo in bar { }
+
+
for (idx, _) in bar.enumerated().something() { }
+
+
for (idx, _) in bar.something() { }
+
+
for idx in bar.indices { }
+
+
for (section, (event, _)) in data.enumerated() {}
+
+
list.enumerated().map { idx, elem in "\(idx): \(elem)" }
+
+
list.enumerated().map { $0 + $1 }
+
+
list.enumerated().something().map { _, elem in elem }
+
+
list.enumerated().map { ($0.offset, $0.element) }
+
+
list.enumerated().map { ($0.0, $0.1) }
+
+
list.enumerated().map {
+    $1.enumerated().forEach { print($0, $1) }
+    return $0
+}
+
+

Triggering Examples

+
for (↓_, foo) in bar.enumerated() { }
+
+
for (↓_, foo) in abc.bar.enumerated() { }
+
+
for (↓_, foo) in abc.something().enumerated() { }
+
+
for (idx, ↓_) in bar.enumerated() { }
+
+
list.enumerated().map { idx, ↓_ in idx }
+
+
list.enumerated().map { ↓_, elem in elem }
+
+
list.↓enumerated().forEach { print($0) }
+
+
list.↓enumerated().map { $1 }
+
+
list.enumerated().map {
+    $1.↓enumerated().forEach { print($1) }
+    return $0
+}
+
+
list.↓enumerated().map {
+    $1.enumerated().forEach { print($0, $1) }
+    return 1
+}
+
+
list.↓enumerated().forEach {
+    let (i, _) = $0
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unused_import.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unused_import.html new file mode 100644 index 000000000..f12571173 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unused_import.html @@ -0,0 +1,454 @@ + + + + unused_import Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unused Import

+ +

All imported modules should be required to make the file compile

+ +
    +
  • Identifier: unused_import
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: Yes
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +require_explicit_imports + +false +
    +allowed_transitive_imports + +[] +
    +always_keep_imports + +[] +
  • +
+

Non Triggering Examples

+
import Dispatch // This is used
+dispatchMain()
+
+
@testable import Dispatch
+dispatchMain()
+
+
import Foundation
+@objc
+class A {}
+
+
import UnknownModule
+func foo(error: Swift.Error) {}
+
+
@_exported import UnknownModule
+
+
import Foundation
+let 👨‍👩‍👧‍👦 = #selector(NSArray.contains(_:))
+👨‍👩‍👧‍👦 == 👨‍👩‍👧‍👦
+
+
//
+// allowed_transitive_imports: [Foundation: ["CoreFoundation"]]
+//
+
+import Foundation
+enum E {
+    static let min: CGFloat = 44
+}
+
+
+

Triggering Examples

+
↓import Dispatch
+struct A {
+  static func dispatchMain() {}
+}
+A.dispatchMain()
+
+
↓import Foundation // This is unused
+struct A {
+  static func dispatchMain() {}
+}
+A.dispatchMain()
+↓import Dispatch
+
+
+
↓import Foundation
+dispatchMain()
+
+
↓import Foundation
+// @objc
+class A {}
+
+
↓import Foundation
+import UnknownModule
+func foo(error: Swift.Error) {}
+
+
↓import Swift
+↓import SwiftShims
+func foo(error: Swift.Error) {}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unused_optional_binding.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unused_optional_binding.html new file mode 100644 index 000000000..226fb6346 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unused_optional_binding.html @@ -0,0 +1,410 @@ + + + + unused_optional_binding Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unused Optional Binding

+ +

Prefer != nil over let _ =

+ +
    +
  • Identifier: unused_optional_binding
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +ignore_optional_try + +false +
  • +
+

Non Triggering Examples

+
if let bar = Foo.optionalValue {}
+
+
if let (_, second) = getOptionalTuple() {}
+
+
if let (_, asd, _) = getOptionalTuple(), let bar = Foo.optionalValue {}
+
+
if foo() { let _ = bar() }
+
+
if foo() { _ = bar() }
+
+
if case .some(_) = self {}
+
+
if let point = state.find({ _ in true }) {}
+
+

Triggering Examples

+
if let ↓_ = Foo.optionalValue {}
+
+
if let a = Foo.optionalValue, let ↓_ = Foo.optionalValue2 {}
+
+
guard let a = Foo.optionalValue, let ↓_ = Foo.optionalValue2 {}
+
+
if let (first, second) = getOptionalTuple(), let ↓_ = Foo.optionalValue {}
+
+
if let (first, _) = getOptionalTuple(), let ↓_ = Foo.optionalValue {}
+
+
if let (_, second) = getOptionalTuple(), let ↓_ = Foo.optionalValue {}
+
+
if let ↓(_, _, _) = getOptionalTuple(), let bar = Foo.optionalValue {}
+
+
func foo() { if let ↓_ = bar {} }
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unused_parameter.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unused_parameter.html new file mode 100644 index 000000000..cb24ef88c --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unused_parameter.html @@ -0,0 +1,449 @@ + + + + unused_parameter Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unused Parameter

+ +

Other than unused local variable declarations, unused function/initializer/subscript parameters are not marked by the Swift compiler. Since unused parameters are code smells, they should either be removed or replaced/shadowed by a wildcard ‘_’ to indicate that they are being deliberately disregarded.

+ +
    +
  • Identifier: unused_parameter
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func f(a: Int) {
+    _ = a
+}
+
+
func f(case: Int) {
+    _ = `case`
+}
+
+
func f(a _: Int) {}
+
+
func f(_: Int) {}
+
+
func f(a: Int, b c: String) {
+    func g() {
+        _ = a
+        _ = c
+    }
+}
+
+
func f(a: Int, c: Int) -> Int {
+    struct S {
+        let b = 1
+        func f(a: Int, b: Int = 2) -> Int { a + b }
+    }
+    return a + c
+}
+
+
func f(a: Int?) {
+    if let a {}
+}
+
+
func f(a: Int) {
+    let a = a
+    return a
+}
+
+
func f(`operator`: Int) -> Int { `operator` }
+
+

Triggering Examples

+
func f(↓a: Int) {}
+
+
func f(↓a: Int, b ↓c: String) {}
+
+
func f(↓a: Int, b ↓c: String) {
+    func g(a: Int, ↓b: Double) {
+        _ = a
+    }
+}
+
+
struct S {
+    let a: Int
+
+    init(a: Int, ↓b: Int) {
+        func f(↓a: Int, b: Int) -> Int { b }
+        self.a = f(a: a, b: 0)
+    }
+}
+
+
struct S {
+    subscript(a: Int, ↓b: Int) {
+        func f(↓a: Int, b: Int) -> Int { b }
+        return f(a: a, b: 0)
+    }
+}
+
+
func f(↓a: Int, ↓b: Int, c: Int) -> Int {
+    struct S {
+        let b = 1
+        func f(a: Int, ↓c: Int = 2) -> Int { a + b }
+    }
+    return S().f(a: c)
+}
+
+
func f(↓a: Int, c: String) {
+    let a = 1
+    return a + c
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unused_setter_value.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unused_setter_value.html new file mode 100644 index 000000000..b715d35ab --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/unused_setter_value.html @@ -0,0 +1,461 @@ + + + + unused_setter_value Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unused Setter Value

+ +

Setter value is not used

+ +
    +
  • Identifier: unused_setter_value
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
var aValue: String {
+    get {
+        return Persister.shared.aValue
+    }
+    set {
+        Persister.shared.aValue = newValue
+    }
+}
+
+
var aValue: String {
+    set {
+        Persister.shared.aValue = newValue
+    }
+    get {
+        return Persister.shared.aValue
+    }
+}
+
+
var aValue: String {
+    get {
+        return Persister.shared.aValue
+    }
+    set(value) {
+        Persister.shared.aValue = value
+    }
+}
+
+
override var aValue: String {
+ get {
+     return Persister.shared.aValue
+ }
+ set { }
+}
+
+

Triggering Examples

+
var aValue: String {
+    get {
+        return Persister.shared.aValue
+    }
+    ↓set {
+        Persister.shared.aValue = aValue
+    }
+}
+
+
var aValue: String {
+    ↓set {
+        Persister.shared.aValue = aValue
+    }
+    get {
+        return Persister.shared.aValue
+    }
+}
+
+
var aValue: String {
+    get {
+        return Persister.shared.aValue
+    }
+    ↓set {
+        Persister.shared.aValue = aValue
+    }
+}
+
+
var aValue: String {
+    get {
+        let newValue = Persister.shared.aValue
+        return newValue
+    }
+    ↓set {
+        Persister.shared.aValue = aValue
+    }
+}
+
+
var aValue: String {
+    get {
+        return Persister.shared.aValue
+    }
+    ↓set(value) {
+        Persister.shared.aValue = aValue
+    }
+}
+
+
override var aValue: String {
+    get {
+        return Persister.shared.aValue
+    }
+    ↓set {
+        Persister.shared.aValue = aValue
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/valid_ibinspectable.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/valid_ibinspectable.html new file mode 100644 index 000000000..3f4fc1b5c --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/valid_ibinspectable.html @@ -0,0 +1,448 @@ + + + + valid_ibinspectable Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Valid IBInspectable

+ +

@IBInspectable should be applied to variables only, have its type explicit and be of a supported type

+ +
    +
  • Identifier: valid_ibinspectable
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class Foo {
+  @IBInspectable private var x: Int
+}
+
+
class Foo {
+  @IBInspectable private var x: String?
+}
+
+
class Foo {
+  @IBInspectable private var x: String!
+}
+
+
class Foo {
+  @IBInspectable private var count: Int = 0
+}
+
+
class Foo {
+  private var notInspectable = 0
+}
+
+
class Foo {
+  private let notInspectable: Int
+}
+
+
class Foo {
+  private let notInspectable: UInt8
+}
+
+
extension Foo {
+    @IBInspectable var color: UIColor {
+        set {
+            self.bar.textColor = newValue
+        }
+
+        get {
+            return self.bar.textColor
+        }
+    }
+}
+
+
class Foo {
+    @IBInspectable var borderColor: UIColor? = nil {
+        didSet {
+            updateAppearance()
+        }
+    }
+}
+
+

Triggering Examples

+
class Foo {
+  @IBInspectable private ↓let count: Int
+}
+
+
class Foo {
+  @IBInspectable private ↓var insets: UIEdgeInsets
+}
+
+
class Foo {
+  @IBInspectable private ↓var count = 0
+}
+
+
class Foo {
+  @IBInspectable private ↓var count: Int?
+}
+
+
class Foo {
+  @IBInspectable private ↓var count: Int!
+}
+
+
class Foo {
+  @IBInspectable private ↓var count: Optional<Int>
+}
+
+
class Foo {
+  @IBInspectable private ↓var x: Optional<String>
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/vertical_parameter_alignment.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/vertical_parameter_alignment.html new file mode 100644 index 000000000..7ee457069 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/vertical_parameter_alignment.html @@ -0,0 +1,437 @@ + + + + vertical_parameter_alignment Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Vertical Parameter Alignment

+ +

Function parameters should be aligned vertically if they’re in multiple lines in a declaration

+ +
    +
  • Identifier: vertical_parameter_alignment
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func validateFunction(_ file: SwiftLintFile, kind: SwiftDeclarationKind,
+                      dictionary: SourceKittenDictionary) { }
+
+
func validateFunction(_ file: SwiftLintFile, kind: SwiftDeclarationKind,
+                      dictionary: SourceKittenDictionary) -> [StyleViolation]
+
+
func foo(bar: Int)
+
+
func foo(bar: Int) -> String
+
+
func validateFunction(_ file: SwiftLintFile, kind: SwiftDeclarationKind,
+                      dictionary: SourceKittenDictionary)
+                      -> [StyleViolation]
+
+
func validateFunction(
+   _ file: SwiftLintFile, kind: SwiftDeclarationKind,
+   dictionary: SourceKittenDictionary) -> [StyleViolation]
+
+
func validateFunction(
+   _ file: SwiftLintFile, kind: SwiftDeclarationKind,
+   dictionary: SourceKittenDictionary
+) -> [StyleViolation]
+
+
func regex(_ pattern: String,
+           options: NSRegularExpression.Options = [.anchorsMatchLines,
+                                                   .dotMatchesLineSeparators]) -> NSRegularExpression
+
+
func foo(a: Void,
+         b: [String: String] =
+         [:]) {
+}
+
+
func foo(data: (size: CGSize,
+                identifier: String)) {}
+
+
func foo(data: Data,
+         @ViewBuilder content: @escaping (Data.Element.IdentifiedValue) -> Content) {}
+
+
class A {
+    init(bar: Int)
+}
+
+
class A {
+    init(foo: Int,
+         bar: String)
+}
+
+

Triggering Examples

+
func validateFunction(_ file: SwiftLintFile, kind: SwiftDeclarationKind,
+                  ↓dictionary: SourceKittenDictionary) { }
+
+
func validateFunction(_ file: SwiftLintFile, kind: SwiftDeclarationKind,
+                       ↓dictionary: SourceKittenDictionary) { }
+
+
func validateFunction(_ file: SwiftLintFile,
+                  ↓kind: SwiftDeclarationKind,
+                  ↓dictionary: SourceKittenDictionary) { }
+
+
func foo(data: Data,
+            ↓@ViewBuilder content: @escaping (Data.Element.IdentifiedValue) -> Content) {}
+
+
class A {
+    init(data: Data,
+                ↓@ViewBuilder content: @escaping (Data.Element.IdentifiedValue) -> Content) {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/vertical_parameter_alignment_on_call.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/vertical_parameter_alignment_on_call.html new file mode 100644 index 000000000..6ebc136e5 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/vertical_parameter_alignment_on_call.html @@ -0,0 +1,460 @@ + + + + vertical_parameter_alignment_on_call Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Vertical Parameter Alignment on Call

+ +

Function parameters should be aligned vertically if they’re in multiple lines in a method call

+ +
    +
  • Identifier: vertical_parameter_alignment_on_call
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
foo(param1: 1, param2: bar
+    param3: false, param4: true)
+
+
foo(param1: 1, param2: bar)
+
+
foo(param1: 1, param2: bar
+    param3: false,
+    param4: true)
+
+
foo(
+   param1: 1
+) { _ in }
+
+
UIView.animate(withDuration: 0.4, animations: {
+    blurredImageView.alpha = 1
+}, completion: { _ in
+    self.hideLoading()
+})
+
+
UIView.animate(withDuration: 0.4, animations: {
+    blurredImageView.alpha = 1
+},
+completion: { _ in
+    self.hideLoading()
+})
+
+
UIView.animate(withDuration: 0.4, animations: {
+    blurredImageView.alpha = 1
+} { _ in
+    self.hideLoading()
+}
+
+
foo(param1: 1, param2: { _ in },
+    param3: false, param4: true)
+
+
foo({ _ in
+       bar()
+   },
+   completion: { _ in
+       baz()
+   }
+)
+
+
foo(param1: 1, param2: [
+   0,
+   1
+], param3: 0)
+
+
myFunc(foo: 0,
+       bar: baz == 0)
+
+
UIViewPropertyAnimator.runningPropertyAnimator(
+    withDuration: 2.0,
+    delay: 0.0,
+    options: [.curveEaseIn]
+) {
+    // animations
+} completion: { _ in
+    // completion
+}
+
+

Triggering Examples

+
foo(param1: 1, param2: bar,
+                ↓param3: false, param4: true)
+
+
foo(param1: 1, param2: bar,
+ ↓param3: false, param4: true)
+
+
foo(param1: 1, param2: bar,
+       ↓param3: false,
+       ↓param4: true)
+
+
foo(param1: 1,
+       ↓param2: { _ in })
+
+
foo(param1: 1,
+    param2: { _ in
+}, param3: 2,
+ ↓param4: 0)
+
+
foo(param1: 1, param2: { _ in },
+       ↓param3: false, param4: true)
+
+
myFunc(foo: 0,
+        ↓bar: baz == 0)
+
+
myFunc(foo: 0, bar:
+        baz == 0, ↓baz: true)
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/vertical_whitespace.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/vertical_whitespace.html new file mode 100644 index 000000000..7e56d6975 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/vertical_whitespace.html @@ -0,0 +1,413 @@ + + + + vertical_whitespace Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Vertical Whitespace

+ +

Limit vertical whitespace to a single empty line.

+ +
    +
  • Identifier: vertical_whitespace
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +max_empty_lines + +1 +
  • +
+

Non Triggering Examples

+
let abc = 0
+
+
+
let abc = 0
+
+
+
+
/* bcs 
+
+
+
+*/
+
+
// bca 
+
+
+
+

Triggering Examples

+
let aaaa = 0
+
+
+
+
+
struct AAAA {}
+
+
+
+
+
+
class BBBB {}
+
+
+
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/vertical_whitespace_between_cases.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/vertical_whitespace_between_cases.html new file mode 100644 index 000000000..551a70406 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/vertical_whitespace_between_cases.html @@ -0,0 +1,482 @@ + + + + vertical_whitespace_between_cases Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Vertical Whitespace Between Cases

+ +

Include a single empty line between switch cases

+ +
    +
  • Identifier: vertical_whitespace_between_cases
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
switch x {
+
+case 0..<5:
+    print("x is low")
+
+case 5..<10:
+    print("x is high")
+
+default:
+    print("x is invalid")
+
+@unknown default:
+    print("x is out of this world")
+}
+
+
switch x {
+case .valid:
+    print("multiple ...")
+    print("... lines")
+
+case .invalid:
+    print("multiple ...")
+    print("... lines")
+}
+
+
switch x {
+case .valid:
+    print("x is valid")
+
+case .invalid:
+    print("x is invalid")
+}
+
+
switch x {
+case 0..<5:
+    print("x is low")
+
+case 5..<10:
+    print("x is high")
+
+default:
+    print("x is invalid")
+}
+
+
switch x {
+case 0..<5:
+    print("x is valid")
+
+default:
+    print("x is invalid")
+}
+
+
switch x {
+case 0..<5:
+    return "x is valid"
+
+default:
+    return "x is invalid"
+
+@unknown default:
+    print("x is out of this world")
+}
+
+
switch x {
+case 0..<5: print("x is low")
+case 5..<10: print("x is high")
+default: print("x is invalid")
+@unknown default: print("x is out of this world")
+}
+
+
switch x {    
+case 1:    
+    print("one")    
+
+default:    
+    print("not one")    
+}    
+
+

Triggering Examples

+
switch x {
+case .valid:
+    print("multiple ...")
+    print("... lines")
+↓case .invalid:
+    print("multiple ...")
+    print("... lines")
+}
+
+
switch x {
+case .valid:
+    print("x is valid")
+↓case .invalid:
+    print("x is invalid")
+}
+
+
switch x {
+case 0..<5:
+    print("x is valid")
+↓default:
+    print("x is invalid")
+}
+
+
switch x {
+case 0..<5:
+    return "x is valid"
+↓default:
+    return "x is invalid"
+↓@unknown default:
+    print("x is out of this world")
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/vertical_whitespace_closing_braces.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/vertical_whitespace_closing_braces.html new file mode 100644 index 000000000..a5cf5a031 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/vertical_whitespace_closing_braces.html @@ -0,0 +1,510 @@ + + + + vertical_whitespace_closing_braces Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Vertical Whitespace before Closing Braces

+ +

Don’t include vertical whitespace (empty line) before closing braces

+ +
    +
  • Identifier: vertical_whitespace_closing_braces
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +only_enforce_before_trivial_lines + +false +
  • +
+

Non Triggering Examples

+
[
+1,
+2,
+3
+]
+
+
do {
+  print("x is 5")
+}
+
+
do {
+  print("x is 5")
+}
+
+
do {
+  print("x is 5")
+}
+
+
foo(
+    x: 5,
+    y:6
+)
+
+
func foo() {
+  run(5) { x in
+    print(x)
+  }
+}
+
+
//
+// only_enforce_before_trivial_lines: true
+//
+
+print([
+  1
+])
+
+
+
//
+// only_enforce_before_trivial_lines: true
+//
+
+print([foo {
+  var sum = 0
+  for i in 1...5 { sum += i }
+  return sum
+
+}, foo {
+  var mul = 1
+  for i in 1...5 { mul *= i }
+  return mul
+}])
+
+
+
[1, 2].map { $0 }.filter { true }
+
+
[1, 2].map { $0 }.filter { num in true }
+
+
/*
+    class X {
+
+        let x = 5
+
+    }
+*/
+
+

Triggering Examples

+
[
+1,
+2,
+3
+↓
+]
+
+
do {
+  print("x is 5")
+↓
+
+}
+
+
do {
+  print("x is 5")
+↓
+
+}
+
+
do {
+  print("x is 5")
+↓
+}
+
+
foo(
+    x: 5,
+    y:6
+↓
+)
+
+
func foo() {
+  run(5) { x in
+    print(x)
+  }
+↓
+}
+
+
//
+// only_enforce_before_trivial_lines: true
+//
+
+print([
+  1
+↓
+])
+
+
+
//
+// only_enforce_before_trivial_lines: true
+//
+
+print([foo {
+  var sum = 0
+  for i in 1...5 { sum += i }
+  return sum
+
+}, foo {
+  var mul = 1
+  for i in 1...5 { mul *= i }
+  return mul
+↓
+}])
+
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/vertical_whitespace_opening_braces.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/vertical_whitespace_opening_braces.html new file mode 100644 index 000000000..7e605c495 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/vertical_whitespace_opening_braces.html @@ -0,0 +1,486 @@ + + + + vertical_whitespace_opening_braces Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Vertical Whitespace after Opening Braces

+ +

Don’t include vertical whitespace (empty line) after opening braces

+ +
    +
  • Identifier: vertical_whitespace_opening_braces
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
/*
+    class X {
+
+        let x = 5
+
+    }
+*/
+
+
// [1, 2].map { $0 }.filter { num in true }
+
+
KingfisherManager.shared.retrieveImage(with: url, options: nil, progressBlock: nil) { image, _, _, _ in
+    guard let img = image else { return }
+}
+
+
[
+1,
+2,
+3
+]
+
+
[1, 2].map { $0 }.filter { num in true }
+
+
[1, 2].map { $0 }.foo()
+
+
class X {
+  struct Y {
+    class Z {
+    }
+  }
+}
+
+
foo(
+  x: 5,
+  y:6
+)
+
+
foo({ }) { _ in
+  self.dismiss(animated: false, completion: {
+  })
+}
+
+
func foo() {
+  run(5) { x in
+    print(x)
+  }
+}
+
+
if x == 5 {
+  print("x is 5")
+}
+
+
if x == 5 {
+  print("x is 5")
+}
+
+
struct MyStruct {
+  let x = 5
+}
+
+

Triggering Examples

+
KingfisherManager.shared.retrieveImage(with: url, options: nil, progressBlock: nil) { image, _, _, _ in
+↓
+    guard let img = image else { return }
+}
+
+
[
+↓
+1,
+2,
+3
+]
+
+
class X {
+  struct Y {
+↓
+    class Z {
+    }
+  }
+}
+
+
foo(
+↓
+  x: 5,
+  y:6
+)
+
+
foo({ }) { _ in
+↓
+  self.dismiss(animated: false, completion: {
+  })
+}
+
+
func foo() {
+↓
+  run(5) { x in
+    print(x)
+  }
+}
+
+
if x == 5 {
+↓
+
+  print("x is 5")
+}
+
+
if x == 5 {
+↓
+  print("x is 5")
+}
+
+
struct MyStruct {
+↓
+  let x = 5
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/void_function_in_ternary.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/void_function_in_ternary.html new file mode 100644 index 000000000..27034bb7e --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/void_function_in_ternary.html @@ -0,0 +1,451 @@ + + + + void_function_in_ternary Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Void Function in Ternary

+ +

Using ternary to call Void functions should be avoided

+ +
    +
  • Identifier: void_function_in_ternary
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.1.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let result = success ? foo() : bar()
+
+
if success {
+    askQuestion()
+} else {
+    exit()
+}
+
+
var price: Double {
+    return hasDiscount ? calculatePriceWithDiscount() : calculateRegularPrice()
+}
+
+
foo(x == 2 ? a() : b())
+
+
chevronView.image = collapsed ? .icon(.mediumChevronDown) : .icon(.mediumChevronUp)
+
+
array.map { elem in
+    elem.isEmpty() ? .emptyValue() : .number(elem)
+}
+
+
func compute(data: [Int]) -> Int {
+    data.isEmpty ? 0 : expensiveComputation(data)
+}
+
+
var value: Int {
+    mode == .fast ? fastComputation() : expensiveComputation()
+}
+
+
var value: Int {
+    get {
+        mode == .fast ? fastComputation() : expensiveComputation()
+    }
+}
+
+
subscript(index: Int) -> Int {
+    get {
+        index == 0 ? defaultValue() : compute(index)
+    }
+
+
subscript(index: Int) -> Int {
+    index == 0 ? defaultValue() : compute(index)
+
+

Triggering Examples

+
success ↓? askQuestion() : exit()
+
+
perform { elem in
+    elem.isEmpty() ↓? .emptyValue() : .number(elem)
+    return 1
+}
+
+
DispatchQueue.main.async {
+    self.sectionViewModels[section].collapsed.toggle()
+    self.sectionViewModels[section].collapsed
+        ↓? self.tableView.deleteRows(at: [IndexPath(row: 0, section: section)], with: .automatic)
+        : self.tableView.insertRows(at: [IndexPath(row: 0, section: section)], with: .automatic)
+    self.tableView.scrollToRow(at: IndexPath(row: NSNotFound, section: section), at: .top, animated: true)
+}
+
+
subscript(index: Int) -> Int {
+    index == 0 ↓? something() : somethingElse(index)
+    return index
+
+
var value: Int {
+    mode == .fast ↓? something() : somethingElse()
+    return 0
+}
+
+
var value: Int {
+    get {
+        mode == .fast ↓? something() : somethingElse()
+        return 0
+    }
+}
+
+
subscript(index: Int) -> Int {
+    get {
+        index == 0 ↓? something() : somethingElse(index)
+        return index
+    }
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/void_return.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/void_return.html new file mode 100644 index 000000000..183bd81f0 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/void_return.html @@ -0,0 +1,416 @@ + + + + void_return Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Void Return

+ +

Prefer -> Void over -> ()

+ +
    +
  • Identifier: void_return
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let abc: () -> Void = {}
+
+
let abc: () -> (VoidVoid) = {}
+
+
func foo(completion: () -> Void)
+
+
let foo: (ConfigurationTests) -> () throws -> Void
+
+
let foo: (ConfigurationTests) ->   () throws -> Void
+
+
let foo: (ConfigurationTests) ->() throws -> Void
+
+
let foo: (ConfigurationTests) -> () -> Void
+
+
let foo: () -> () async -> Void
+
+
let foo: () -> () async throws -> Void
+
+
let foo: () -> () async -> Void
+
+
func foo() -> () async throws -> Void {}
+
+
func foo() async throws -> () async -> Void { return {} }
+
+
func foo() -> () async -> Int { 1 }
+
+

Triggering Examples

+
let abc: () -> ↓() = {}
+
+
let abc: () -> ↓(Void) = {}
+
+
let abc: () -> ↓(   Void ) = {}
+
+
func foo(completion: () -> ↓())
+
+
func foo(completion: () -> ↓(   ))
+
+
func foo(completion: () -> ↓(Void))
+
+
let foo: (ConfigurationTests) -> () throws -> ↓()
+
+
func foo() async -> ↓()
+
+
func foo() async throws -> ↓()
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/weak_delegate.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/weak_delegate.html new file mode 100644 index 000000000..c88dc5ba0 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/weak_delegate.html @@ -0,0 +1,453 @@ + + + + weak_delegate Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Weak Delegate

+ +

Delegates should be weak to avoid reference cycles

+ +
    +
  • Identifier: weak_delegate
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class Foo {
+  weak var delegate: SomeProtocol?
+}
+
+
class Foo {
+  weak var someDelegate: SomeDelegateProtocol?
+}
+
+
class Foo {
+  weak var delegateScroll: ScrollDelegate?
+}
+
+
class Foo {
+  var scrollHandler: ScrollDelegate?
+}
+
+
func foo() {
+  var delegate: SomeDelegate
+}
+
+
class Foo {
+  var delegateNotified: Bool?
+}
+
+
protocol P {
+ var delegate: AnyObject? { get set }
+}
+
+
class Foo {
+ protocol P {
+ var delegate: AnyObject? { get set }
+}
+}
+
+
class Foo {
+ var computedDelegate: ComputedDelegate {
+ return bar() 
+} 
+}
+
+
class Foo {
+    var computedDelegate: ComputedDelegate {
+        get {
+            return bar()
+        }
+   }
+
+
struct Foo {
+ @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate 
+}
+
+
struct Foo {
+ @NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate 
+}
+
+
struct Foo {
+ @WKExtensionDelegateAdaptor(ExtensionDelegate.self) var extensionDelegate 
+}
+
+
class Foo {
+    func makeDelegate() -> SomeDelegate {
+        let delegate = SomeDelegate()
+        return delegate
+    }
+}
+
+

Triggering Examples

+
class Foo {
+  ↓var delegate: SomeProtocol?
+}
+
+
class Foo {
+  ↓var scrollDelegate: ScrollDelegate?
+}
+
+
class Foo {
+    ↓var delegate: SomeProtocol? {
+        didSet {
+            print("Updated delegate")
+        }
+   }
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/xct_specific_matcher.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/xct_specific_matcher.html new file mode 100644 index 000000000..d3e77e9bd --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/xct_specific_matcher.html @@ -0,0 +1,560 @@ + + + + xct_specific_matcher Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

XCTest Specific Matcher

+ +

Prefer specific XCTest matchers over XCTAssertEqual and XCTAssertNotEqual.

+ +
    +
  • Identifier: xct_specific_matcher
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +matchers + +[one-argument-asserts, two-argument-asserts] +
  • +
+

Non Triggering Examples

+
XCTAssert(foo
+
+
XCTAssertFalse(foo)
+
+
XCTAssertTrue(foo)
+
+
XCTAssertNil(foo)
+
+
XCTAssertNotNil(foo)
+
+
XCTAssertEqual(foo, 2)
+
+
XCTAssertNotEqual(foo, "false")
+
+
XCTAssertEqual(foo, [1, 2, 3, true])
+
+
XCTAssertEqual(foo, [1, 2, 3, false])
+
+
XCTAssertEqual(foo, [1, 2, 3, nil])
+
+
XCTAssertEqual(foo, [true, nil, true, nil])
+
+
XCTAssertEqual([1, 2, 3, true], foo)
+
+
XCTAssertEqual([1, 2, 3, false], foo)
+
+
XCTAssertEqual([1, 2, 3, nil], foo)
+
+
XCTAssertEqual([true, nil, true, nil], foo)
+
+
XCTAssertEqual(2, foo)
+
+
XCTAssertNotEqual("false"), foo)
+
+
XCTAssertEqual(false, foo?.bar)
+
+
XCTAssertEqual(true, foo?.bar)
+
+
XCTAssert(    foo  )
+
+
XCTAssertFalse(  foo  )
+
+
XCTAssertTrue(  foo  )
+
+
XCTAssertNil(  foo  )
+
+
XCTAssertNotNil(  foo  )
+
+
XCTAssertEqual(  foo  , 2  )
+
+
XCTAssertNotEqual(  foo, "false")
+
+
XCTAssertEqual(foo?.bar, false)
+
+
XCTAssertEqual(foo?.bar, true)
+
+
XCTAssertNil(foo?.bar)
+
+
XCTAssertNotNil(foo?.bar)
+
+
XCTAssertEqual(foo?.bar, 2)
+
+
XCTAssertNotEqual(foo?.bar, "false")
+
+
XCTAssertEqual(foo?.bar, toto())
+
+
XCTAssertEqual(foo?.bar, .toto(.zoo))
+
+
XCTAssertEqual(toto(), foo?.bar)
+
+
XCTAssertEqual(.toto(.zoo), foo?.bar)
+
+
XCTAssert(foo.self == bar)
+
+
XCTAssertTrue(type(of: foo) != Int.self)
+
+
XCTAssertTrue(a == (1, 3, 5)
+
+

Triggering Examples

+
↓XCTAssertEqual(foo, true)
+
+
↓XCTAssertEqual(foo, false)
+
+
↓XCTAssertEqual(foo, nil)
+
+
↓XCTAssertNotEqual(foo, true)
+
+
↓XCTAssertNotEqual(foo, false)
+
+
↓XCTAssertNotEqual(foo, nil)
+
+
↓XCTAssertEqual(true, foo)
+
+
↓XCTAssertEqual(false, foo)
+
+
↓XCTAssertEqual(nil, foo)
+
+
↓XCTAssertNotEqual(true, foo)
+
+
↓XCTAssertNotEqual(false, foo)
+
+
↓XCTAssertNotEqual(nil, foo)
+
+
↓XCTAssertEqual(foo, true, "toto")
+
+
↓XCTAssertEqual(foo, false, "toto")
+
+
↓XCTAssertEqual(foo, nil, "toto")
+
+
↓XCTAssertNotEqual(foo, true, "toto")
+
+
↓XCTAssertNotEqual(foo, false, "toto")
+
+
↓XCTAssertNotEqual(foo, nil, "toto")
+
+
↓XCTAssertEqual(true, foo, "toto")
+
+
↓XCTAssertEqual(false, foo, "toto")
+
+
↓XCTAssertEqual(nil, foo, "toto")
+
+
↓XCTAssertNotEqual(true, foo, "toto")
+
+
↓XCTAssertNotEqual(false, foo, "toto")
+
+
↓XCTAssertNotEqual(nil, foo, "toto")
+
+
↓XCTAssertEqual(foo,true)
+
+
↓XCTAssertEqual( foo , false )
+
+
↓XCTAssertEqual(  foo  ,  nil  )
+
+
↓XCTAssertEqual(true, [1, 2, 3, true].hasNumbers())
+
+
↓XCTAssertEqual([1, 2, 3, true].hasNumbers(), true)
+
+
↓XCTAssertEqual(foo?.bar, nil)
+
+
↓XCTAssertNotEqual(foo?.bar, nil)
+
+
↓XCTAssertEqual(nil, true)
+
+
↓XCTAssertEqual(nil, false)
+
+
↓XCTAssertEqual(true, nil)
+
+
↓XCTAssertEqual(false, nil)
+
+
↓XCTAssertEqual(nil, nil)
+
+
↓XCTAssertEqual(true, true)
+
+
↓XCTAssertEqual(false, false)
+
+
↓XCTAssert(foo == bar)
+
+
↓XCTAssertTrue(   foo  ==   bar  )
+
+
↓XCTAssertFalse(1 == foo)
+
+
↓XCTAssert(foo == bar, "toto")
+
+
↓XCTAssert(foo != bar)
+
+
↓XCTAssertTrue(   foo  !=   bar  )
+
+
↓XCTAssertFalse(1 != foo)
+
+
↓XCTAssert(foo != bar, "toto")
+
+
↓XCTAssert(  foo   ==  nil)
+
+
↓XCTAssert(nil == foo
+
+
↓XCTAssertTrue(  foo   !=  nil)
+
+
↓XCTAssertFalse(nil != foo
+
+
↓XCTAssert(foo == nil, "toto")
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/xctfail_message.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/xctfail_message.html new file mode 100644 index 000000000..e298dd076 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/xctfail_message.html @@ -0,0 +1,388 @@ + + + + xctfail_message Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

XCTFail Message

+ +

An XCTFail call should include a description of the assertion

+ +
    +
  • Identifier: xctfail_message
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func testFoo() {
+  XCTFail("bar")
+}
+
+
func testFoo() {
+  XCTFail(bar)
+}
+
+

Triggering Examples

+
func testFoo() {
+  ↓XCTFail()
+}
+
+
func testFoo() {
+  ↓XCTFail("")
+}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/Documents/yoda_condition.html b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/yoda_condition.html new file mode 100644 index 000000000..d1d1d8139 --- /dev/null +++ b/docsets/SwiftLintCore.docset/Contents/Resources/Documents/yoda_condition.html @@ -0,0 +1,410 @@ + + + + yoda_condition Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Yoda Condition

+ +

The constant literal should be placed on the right-hand side of the comparison operator

+ +
    +
  • Identifier: yoda_condition
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
if foo == 42 {}
+
+
if foo <= 42.42 {}
+
+
guard foo >= 42 else { return }
+
+
guard foo != "str str" else { return }
+
+
while foo < 10 { }
+
+
while foo > 1 { }
+
+
while foo + 1 == 2 {}
+
+
if optionalValue?.property ?? 0 == 2 {}
+
+
if foo == nil {}
+
+
if flags & 1 == 1 {}
+
+

Triggering Examples

+
if ↓42 == foo {}
+
+
if ↓42.42 >= foo {}
+
+
guard ↓42 <= foo else { return }
+
+
guard ↓"str str" != foo else { return }
+
+
while ↓10 > foo { }
+
+
while ↓1 < foo { }
+
+
if ↓nil == foo {}
+
+
while ↓1 > i + 5 {}
+
+
if ↓200 <= i && i <= 299 || ↓600 <= i {}
+
+ +
+
+ + +
+
+ + + diff --git a/docsets/SwiftLintCore.docset/Contents/Resources/docSet.dsidx b/docsets/SwiftLintCore.docset/Contents/Resources/docSet.dsidx new file mode 100644 index 000000000..afc76aa85 Binary files /dev/null and b/docsets/SwiftLintCore.docset/Contents/Resources/docSet.dsidx differ diff --git a/docsets/SwiftLintCore.tgz b/docsets/SwiftLintCore.tgz new file mode 100644 index 000000000..d0ccba761 Binary files /dev/null and b/docsets/SwiftLintCore.tgz differ diff --git a/docsets/SwiftLintCore.xml b/docsets/SwiftLintCore.xml new file mode 100644 index 000000000..dd2dac3e7 --- /dev/null +++ b/docsets/SwiftLintCore.xml @@ -0,0 +1 @@ +0.57.1https://realm.github.io/SwiftLint/docsets/SwiftLintCore.tgz diff --git a/duplicate_conditions.html b/duplicate_conditions.html new file mode 100644 index 000000000..42b549463 --- /dev/null +++ b/duplicate_conditions.html @@ -0,0 +1,494 @@ + + + + duplicate_conditions Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Duplicate Conditions

+ +

Duplicate sets of conditions in the same branch instruction should be avoided

+ +
    +
  • Identifier: duplicate_conditions
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +error +
  • +
+

Non Triggering Examples

+
if x < 5 {
+    foo()
+} else if y == "s" {
+    bar()
+}
+
+
if x < 5 {
+    foo()
+}
+if x < 5 {
+    bar()
+}
+
+
if x < 5, y == "s" {
+    foo()
+} else if x < 5 {
+    bar()
+}
+
+
switch x {
+case "a":
+    foo()
+    bar()
+}
+
+
switch x {
+case "a" where y == "s":
+    foo()
+case "a" where y == "t":
+    bar()
+}
+
+
if let x = maybeAbc {
+    foo()
+} else if let x = maybePqr {
+    bar()
+}
+
+
if let x = maybeAbc, let z = x.maybeY {
+    foo()
+} else if let x = maybePqr, let z = x.maybeY {
+    bar()
+}
+
+
if case .p = x {
+    foo()
+} else if case .q = x {
+    bar()
+}
+
+
if true {
+    if true { foo() }
+}
+
+

Triggering Examples

+
if ↓x < 5 {
+    foo()
+} else if y == "s" {
+    bar()
+} else if ↓x < 5 {
+    baz()
+}
+
+
if z {
+    if ↓x < 5 {
+        foo()
+    } else if y == "s" {
+        bar()
+    } else if ↓x < 5 {
+        baz()
+    }
+}
+
+
if ↓x < 5, y == "s" {
+    foo()
+} else if x < 10 {
+    bar()
+} else if ↓y == "s", x < 5 {
+    baz()
+}
+
+
switch x {
+case ↓"a", "b":
+    foo()
+case "c", ↓"a":
+    bar()
+}
+
+
switch x {
+case ↓"a" where y == "s":
+    foo()
+case ↓"a" where y == "s":
+    bar()
+}
+
+
if ↓let xyz = maybeXyz {
+    foo()
+} else if ↓let xyz = maybeXyz {
+    bar()
+}
+
+
if ↓let x = maybeAbc, let z = x.maybeY {
+    foo()
+} else if ↓let x = maybeAbc, let z = x.maybeY {
+    bar()
+}
+
+
if ↓#available(macOS 10.15, *) {
+    foo()
+} else if ↓#available(macOS 10.15, *) {
+    bar()
+}
+
+
if ↓case .p = x {
+    foo()
+} else if ↓case .p = x {
+    bar()
+}
+
+
if ↓x < 5 {}
+else if ↓x < 5 {}
+else if ↓x < 5 {}
+
+ +
+
+ + +
+
+ + + diff --git a/duplicate_enum_cases.html b/duplicate_enum_cases.html new file mode 100644 index 000000000..faae28f5b --- /dev/null +++ b/duplicate_enum_cases.html @@ -0,0 +1,408 @@ + + + + duplicate_enum_cases Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Duplicate Enum Cases

+ +

Enum shouldn’t contain multiple cases with the same name

+ +
    +
  • Identifier: duplicate_enum_cases
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +error +
  • +
+

Non Triggering Examples

+
enum PictureImport {
+    case addImage(image: UIImage)
+    case addData(data: Data)
+}
+
+
enum A {
+    case add(image: UIImage)
+}
+enum B {
+    case add(image: UIImage)
+}
+
+
enum Tag: String {
+#if CONFIG_A
+    case value = "CONFIG_A"
+#elseif CONFIG_B
+    case value = "CONFIG_B"
+#else
+    case value = "CONFIG_DEFAULT"
+#endif
+}
+
+
enum Target {
+#if os(iOS)
+  case file
+#else
+  case file(URL)
+#endif
+}
+
+

Triggering Examples

+
enum PictureImport {
+    case ↓add(image: UIImage)
+    case addURL(url: URL)
+    case ↓add(data: Data)
+}
+
+ +
+
+ + +
+
+ + + diff --git a/duplicate_imports.html b/duplicate_imports.html new file mode 100644 index 000000000..8cc1dd064 --- /dev/null +++ b/duplicate_imports.html @@ -0,0 +1,479 @@ + + + + duplicate_imports Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Duplicate Imports

+ +

Imports should be unique

+ +
    +
  • Identifier: duplicate_imports
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
import A
+import B
+import C
+
+
import A.B
+import A.C
+
+
@_implementationOnly import A
+@_implementationOnly import B
+
+
@testable import A
+@testable import B
+
+
#if DEBUG
+    @testable import KsApi
+#else
+    import KsApi
+#endif
+
+
import A // module
+import B // module
+
+
#if TEST
+func test() {
+}
+
+
import Foo
+@testable import struct Foo.Bar
+
+

Triggering Examples

+
@_implementationOnly import A
+↓@_implementationOnly import A
+
+
+
@testable import A
+↓@testable import A
+
+
+
@testable import Foo
+import struct Foo.Bar
+
+
import A
+#if DEBUG
+    @testable import KsApi
+#else
+    import KsApi
+#endif
+↓import A
+
+
+
import A
+↓import class A.Foo
+
+
+
import A
+↓import enum A.Foo
+
+
+
import A
+↓import func A.Foo
+
+
+
import A
+↓import let A.Foo
+
+
+
import A
+↓import protocol A.Foo
+
+
+
import A
+↓import struct A.Foo
+
+
+
import A
+↓import typealias A.Foo
+
+
+
import A
+↓import var A.Foo
+
+
+
import A.B
+↓import A.B.C
+
+
+
import Foundation
+import Dispatch
+↓import Foundation
+
+
+
import Foundation
+↓import Foundation
+↓import Foundation
+
+
+
import Foundation
+↓import Foundation.NSString
+
+
+
↓import A.B.C
+import A.B
+
+
+
↓import Foundation.NSString
+import Foundation
+
+
+ +
+
+ + +
+
+ + + diff --git a/duplicated_key_in_dictionary_literal.html b/duplicated_key_in_dictionary_literal.html new file mode 100644 index 000000000..5b4bb2ffd --- /dev/null +++ b/duplicated_key_in_dictionary_literal.html @@ -0,0 +1,426 @@ + + + + duplicated_key_in_dictionary_literal Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Duplicated Key in Dictionary Literal

+ +

Dictionary literals with duplicated keys will crash at runtime

+ +
    +
  • Identifier: duplicated_key_in_dictionary_literal
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
[
+    1: "1",
+    2: "2"
+]
+
+
[
+    "1": 1,
+    "2": 2
+]
+
+
[
+    foo: "1",
+    bar: "2"
+]
+
+
[
+    UUID(): "1",
+    UUID(): "2"
+]
+
+
[
+    #line: "1",
+    #line: "2"
+]
+
+

Triggering Examples

+
[
+    1: "1",
+    2: "2",
+    ↓1: "one"
+]
+
+
[
+    "1": 1,
+    "2": 2,
+    ↓"2": 2
+]
+
+
[
+    foo: "1",
+    bar: "2",
+    baz: "3",
+    ↓foo: "4",
+    zaz: "5"
+]
+
+
[
+    .one: "1",
+    .two: "2",
+    .three: "3",
+    ↓.one: "1",
+    .four: "4",
+    .five: "5"
+]
+
+ +
+
+ + +
+
+ + + diff --git a/dynamic_inline.html b/dynamic_inline.html new file mode 100644 index 000000000..dcf2b2baf --- /dev/null +++ b/dynamic_inline.html @@ -0,0 +1,404 @@ + + + + dynamic_inline Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Dynamic Inline

+ +

Avoid using ‘dynamic’ and ‘@inline(__always)’ together

+ +
    +
  • Identifier: dynamic_inline
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +error +
  • +
+

Non Triggering Examples

+
class C {
+dynamic func f() {}}
+
+
class C {
+@inline(__always) func f() {}}
+
+
class C {
+@inline(never) dynamic func f() {}}
+
+

Triggering Examples

+
class C {
+@inline(__always) dynamic ↓func f() {}
+}
+
+
class C {
+@inline(__always) public dynamic ↓func f() {}
+}
+
+
class C {
+@inline(__always) dynamic internal ↓func f() {}
+}
+
+
class C {
+@inline(__always)
+dynamic ↓func f() {}
+}
+
+
class C {
+@inline(__always)
+dynamic
+↓func f() {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/empty_collection_literal.html b/empty_collection_literal.html new file mode 100644 index 000000000..38605f22b --- /dev/null +++ b/empty_collection_literal.html @@ -0,0 +1,396 @@ + + + + empty_collection_literal Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Empty Collection Literal

+ +

Prefer checking isEmpty over comparing collection to an empty array or dictionary literal

+ +
    +
  • Identifier: empty_collection_literal
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
myArray = []
+
+
myArray.isEmpty
+
+
!myArray.isEmpty
+
+
myDict = [:]
+
+

Triggering Examples

+
myArray↓ == []
+
+
myArray↓ != []
+
+
myArray↓ == [ ]
+
+
myDict↓ == [:]
+
+
myDict↓ != [:]
+
+
myDict↓ == [: ]
+
+
myDict↓ == [ :]
+
+
myDict↓ == [ : ]
+
+ +
+
+ + +
+
+ + + diff --git a/empty_count.html b/empty_count.html new file mode 100644 index 000000000..04b109839 --- /dev/null +++ b/empty_count.html @@ -0,0 +1,422 @@ + + + + empty_count Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Empty Count

+ +

Prefer checking isEmpty over comparing count to zero

+ +
    +
  • Identifier: empty_count
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +error +
    +only_after_dot + +false +
  • +
+

Non Triggering Examples

+
var count = 0
+
+
[Int]().isEmpty
+
+
[Int]().count > 1
+
+
[Int]().count == 1
+
+
[Int]().count == 0xff
+
+
[Int]().count == 0b01
+
+
[Int]().count == 0o07
+
+
discount == 0
+
+
order.discount == 0
+
+
let rule = #Rule(Tips.Event(id: "someTips")) { $0.donations.count == 0 }
+
+

Triggering Examples

+
[Int]().↓count == 0
+
+
0 == [Int]().↓count
+
+
[Int]().↓count==0
+
+
[Int]().↓count > 0
+
+
[Int]().↓count != 0
+
+
[Int]().↓count == 0x0
+
+
[Int]().↓count == 0x00_00
+
+
[Int]().↓count == 0b00
+
+
[Int]().↓count == 0o00
+
+
↓count == 0
+
+
#ExampleMacro { $0.list.↓count == 0 }
+
+ +
+
+ + +
+
+ + + diff --git a/empty_enum_arguments.html b/empty_enum_arguments.html new file mode 100644 index 000000000..f04129472 --- /dev/null +++ b/empty_enum_arguments.html @@ -0,0 +1,487 @@ + + + + empty_enum_arguments Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Empty Enum Arguments

+ +

Arguments can be omitted when matching enums with associated values if they are not used

+ +
    +
  • Identifier: empty_enum_arguments
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
switch foo {
+case .bar: break
+}
+
+
switch foo {
+case .bar(let x): break
+}
+
+
switch foo {
+case let .bar(x): break
+}
+
+
switch (foo, bar) {
+case (_, _): break
+}
+
+
switch foo {
+case "bar".uppercased(): break
+}
+
+
switch (foo, bar) {
+case (_, _) where !something: break
+}
+
+
switch foo {
+case (let f as () -> String)?: break
+}
+
+
switch foo {
+case .bar(Baz()): break
+}
+
+
switch foo {
+case .bar(.init()): break
+}
+
+
switch foo {
+default: break
+}
+
+
if case .bar = foo {
+}
+
+
guard case .bar = foo else {
+}
+
+
if foo == .bar() {}
+
+
guard foo == .bar() else { return }
+
+
if case .appStore = self.appInstaller, !UIDevice.isSimulator() {
+    viewController.present(self, animated: false)
+} else {
+    UIApplication.shared.open(self.appInstaller.url)
+}
+
+
let updatedUserNotificationSettings = deepLink.filter { nav in
+    guard case .settings(.notifications(_, nil)) = nav else { return false }
+    return true
+}
+
+

Triggering Examples

+
switch foo {
+case .bar↓(_): break
+}
+
+
switch foo {
+case .bar↓(): break
+}
+
+
switch foo {
+case .bar↓(_), .bar2↓(_): break
+}
+
+
switch foo {
+case .bar↓() where method() > 2: break
+}
+
+
switch foo {
+case .bar(.baz↓()): break
+}
+
+
switch foo {
+case .bar(.baz↓(_)): break
+}
+
+
func example(foo: Foo) {
+    switch foo {
+    case .bar↓(_):
+        break
+    }
+}
+
+
if case .bar↓(_) = foo {
+}
+
+
guard case .bar↓(_) = foo else {
+}
+
+
if case .bar↓() = foo {
+}
+
+
guard case .bar↓() = foo else {
+}
+
+
if case .appStore↓(_) = self.appInstaller, !UIDevice.isSimulator() {
+    viewController.present(self, animated: false)
+} else {
+    UIApplication.shared.open(self.appInstaller.url)
+}
+
+
let updatedUserNotificationSettings = deepLink.filter { nav in
+    guard case .settings(.notifications↓(_, _)) = nav else { return false }
+    return true
+}
+
+ +
+
+ + +
+
+ + + diff --git a/empty_parameters.html b/empty_parameters.html new file mode 100644 index 000000000..d9e67b2d0 --- /dev/null +++ b/empty_parameters.html @@ -0,0 +1,392 @@ + + + + empty_parameters Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Empty Parameters

+ +

Prefer () -> over Void ->

+ +
    +
  • Identifier: empty_parameters
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let abc: () -> Void = {}
+
+
func foo(completion: () -> Void)
+
+
func foo(completion: () throws -> Void)
+
+
let foo: (ConfigurationTests) -> Void throws -> Void)
+
+
let foo: (ConfigurationTests) ->   Void throws -> Void)
+
+
let foo: (ConfigurationTests) ->Void throws -> Void)
+
+

Triggering Examples

+
let abc: ↓(Void) -> Void = {}
+
+
func foo(completion: ↓(Void) -> Void)
+
+
func foo(completion: ↓(Void) throws -> Void)
+
+
let foo: ↓(Void) -> () throws -> Void)
+
+ +
+
+ + +
+
+ + + diff --git a/empty_parentheses_with_trailing_closure.html b/empty_parentheses_with_trailing_closure.html new file mode 100644 index 000000000..b785bb1a0 --- /dev/null +++ b/empty_parentheses_with_trailing_closure.html @@ -0,0 +1,406 @@ + + + + empty_parentheses_with_trailing_closure Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Empty Parentheses with Trailing Closure

+ +

When using trailing closures, empty parentheses should be avoided after the method call

+ +
    +
  • Identifier: empty_parentheses_with_trailing_closure
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
[1, 2].map { $0 + 1 }
+
+
[1, 2].map({ $0 + 1 })
+
+
[1, 2].reduce(0) { $0 + $1 }
+
+
[1, 2].map { number in
+ number + 1 
+}
+
+
let isEmpty = [1, 2].isEmpty()
+
+
UIView.animateWithDuration(0.3, animations: {
+   self.disableInteractionRightView.alpha = 0
+}, completion: { _ in
+   ()
+})
+
+

Triggering Examples

+
[1, 2].map↓() { $0 + 1 }
+
+
[1, 2].map↓( ) { $0 + 1 }
+
+
[1, 2].map↓() { number in
+ number + 1 
+}
+
+
[1, 2].map↓(  ) { number in
+ number + 1 
+}
+
+
func foo() -> [Int] {
+    return [1, 2].map↓() { $0 + 1 }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/empty_string.html b/empty_string.html new file mode 100644 index 000000000..6d9141703 --- /dev/null +++ b/empty_string.html @@ -0,0 +1,390 @@ + + + + empty_string Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Empty String

+ +

Prefer checking isEmpty over comparing string to an empty string literal

+ +
    +
  • Identifier: empty_string
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
myString.isEmpty
+
+
!myString.isEmpty
+
+
"""
+foo==
+"""
+
+

Triggering Examples

+
myString↓ == ""
+
+
myString↓ != ""
+
+
myString↓==""
+
+
myString↓ == #""#
+
+
myString↓ == ##""##
+
+ +
+
+ + +
+
+ + + diff --git a/empty_xctest_method.html b/empty_xctest_method.html new file mode 100644 index 000000000..29c15bbea --- /dev/null +++ b/empty_xctest_method.html @@ -0,0 +1,519 @@ + + + + empty_xctest_method Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Empty XCTest Method

+ +

Empty XCTest method should be avoided

+ +
    +
  • Identifier: empty_xctest_method
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +test_parent_classes + +[“QuickSpec”, “XCTestCase”] +
  • +
+

Non Triggering Examples

+
class TotoTests: XCTestCase {
+    var foobar: Foobar?
+
+    override func setUp() {
+        super.setUp()
+        foobar = Foobar()
+    }
+
+    override func setUpWithError() throws {
+        foobar = nil
+    }
+
+    override func tearDown() {
+        foobar = nil
+        super.tearDown()
+    }
+
+    func testFoo() {
+        XCTAssertTrue(foobar?.foo)
+    }
+
+    func testBar() {
+        // comment...
+
+        XCTAssertFalse(foobar?.bar)
+
+        // comment...
+    }
+
+    func testBaz() {
+        _ = 4 + 4
+    }
+}
+
+
class Foobar {
+    func setUp() {}
+
+    func tearDown() {}
+
+    func testFoo() {}
+}
+
+
class TotoTests: XCTestCase {
+    func setUp(with object: Foobar) {}
+
+    func tearDown(object: Foobar) {}
+
+    func testFoo(_ foo: Foobar) {}
+
+    func testBar(bar: (String) -> Int) {}
+}
+
+
class TotoTests: XCTestCase {
+    func testFoo() { XCTAssertTrue(foobar?.foo) }
+
+    func testBar() { XCTAssertFalse(foobar?.bar) }
+}
+
+
class TotoTests: XCTestCase {
+    override class var runsForEachTargetApplicationUIConfiguration: Bool { true }
+
+    static var allTests = [("testFoo", testFoo)]
+
+    func testFoo() { XCTAssert(true) }
+}
+
+

Triggering Examples

+
class TotoTests: XCTestCase {
+    override ↓func setUp() {
+    }
+
+    override ↓func tearDown() {
+
+    }
+
+    ↓func testFoo() {
+
+
+    }
+
+    ↓func testBar() {
+
+
+
+    }
+
+    func helperFunction() {
+    }
+}
+
+
class TotoTests: XCTestCase {
+    override ↓func setUp() {}
+
+    override ↓func tearDown() {}
+
+    ↓func testFoo() {}
+
+    func helperFunction() {}
+}
+
+
class TotoTests: XCTestCase {
+    override ↓func setUp() {
+        // comment...
+    }
+
+    override ↓func tearDown() {
+        // comment...
+        // comment...
+    }
+
+    ↓func testFoo() {
+        // comment...
+
+        // comment...
+
+        // comment...
+    }
+
+    ↓func testBar() {
+        /*
+         * comment...
+         *
+         * comment...
+         *
+         * comment...
+         */
+    }
+
+    func helperFunction() {
+    }
+}
+
+
class FooTests: XCTestCase {
+    override ↓func setUp() {}
+}
+
+class BarTests: XCTestCase {
+    ↓func testFoo() {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/enum_case_associated_values_count.html b/enum_case_associated_values_count.html new file mode 100644 index 000000000..1ae8ce9c8 --- /dev/null +++ b/enum_case_associated_values_count.html @@ -0,0 +1,398 @@ + + + + enum_case_associated_values_count Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Enum Case Associated Values Count

+ +

The number of associated values in an enum case should be low.

+ +
    +
  • Identifier: enum_case_associated_values_count
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: metrics
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +warning + +5 +
    +error + +6 +
  • +
+

Non Triggering Examples

+
enum Employee {
+    case fullTime(name: String, retirement: Date, designation: String, contactNumber: Int)
+    case partTime(name: String, age: Int, contractEndDate: Date)
+}
+
+
enum Barcode {
+    case upc(Int, Int, Int, Int)
+}
+
+

Triggering Examples

+
enum Employee {
+    case ↓fullTime(name: String, retirement: Date, age: Int, designation: String, contactNumber: Int)
+    case ↓partTime(name: String, contractEndDate: Date, age: Int, designation: String, contactNumber: Int)
+}
+
+
enum Barcode {
+    case ↓upc(Int, Int, Int, Int, Int, Int)
+}
+
+ +
+
+ + +
+
+ + + diff --git a/expiring_todo.html b/expiring_todo.html new file mode 100644 index 000000000..23c32ab88 --- /dev/null +++ b/expiring_todo.html @@ -0,0 +1,470 @@ + + + + expiring_todo Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Expiring Todo

+ +

TODOs and FIXMEs should be resolved prior to their expiry date.

+ +
    +
  • Identifier: expiring_todo
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +approaching_expiry_severity + +warning +
    +expired_severity + +error +
    +bad_formatting_severity + +error +
    +approaching_expiry_threshold + +15 +
    +date_delimiters + + + + + + + + + + + + + + + +
    KeyValue
    +opening + +“[” +
    +closing + +“]” +
    +
    +date_format + +“MM/dd/yyyy” +
    +date_separator + +“/” +
  • +
+

Non Triggering Examples

+
// notaTODO:
+
+
// notaFIXME:
+
+
// TODO: [12/31/9999]
+
+
// TODO(note)
+
+
// FIXME(note)
+
+
/* FIXME: */
+
+
/* TODO: */
+
+
/** FIXME: */
+
+
/** TODO: */
+
+

Triggering Examples

+
// TODO: [↓10/14/2019]
+
+
// FIXME: [↓10/14/2019]
+
+
// FIXME: [↓1/14/2019]
+
+
// FIXME: [↓10/14/2019]
+
+
// TODO: [↓9999/14/10]
+
+ +
+
+ + +
+
+ + + diff --git a/explicit_acl.html b/explicit_acl.html new file mode 100644 index 000000000..b7d147a53 --- /dev/null +++ b/explicit_acl.html @@ -0,0 +1,473 @@ + + + + explicit_acl Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Explicit ACL

+ +

All declarations should specify Access Control Level keywords explicitly

+ +
    +
  • Identifier: explicit_acl
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
internal enum A {}
+
+
public final class B {}
+
+
private struct C {}
+
+
internal enum A { internal enum B {} }
+
+
internal final class Foo {}
+
+
internal
+class Foo {
+  private let bar = 5
+}
+
+
internal func a() { let a =  }
+
+
private func a() { func innerFunction() { } }
+
+
private enum Foo { enum Bar { } }
+
+
private struct C { let d = 5 }
+
+
internal protocol A {
+  func b()
+}
+
+
internal protocol A {
+  var b: Int
+}
+
+
internal class A { deinit {} }
+
+
extension A: Equatable {}
+
+
extension A {}
+
+
extension Foo {
+    internal func bar() {}
+}
+
+
internal enum Foo {
+    case bar
+}
+
+
extension Foo {
+    public var isValid: Bool {
+        let result = true
+        return result
+    }
+}
+
+
extension Foo {
+    private var isValid: Bool {
+        get {
+            return true
+        }
+        set(newValue) {
+            print(newValue)
+        }
+    }
+}
+
+
private extension Foo {
+    var isValid: Bool { true }
+    struct S {
+        let b = 2
+    }
+}
+
+

Triggering Examples

+
↓enum A {}
+
+
final ↓class B {}
+
+
internal struct C { ↓let d = 5 }
+
+
public struct C { private(set) ↓var d = 5 }
+
+
internal struct C { static ↓let d = 5 }
+
+
public struct C { ↓let d = 5 }
+
+
public struct C { ↓init() }
+
+
static ↓func a() {}
+
+
internal let a = 0
+↓func b() {}
+
+
extension Foo {
+    ↓func bar() {}
+    static ↓func baz() {}
+}
+
+
public extension E {
+    let a = 1
+    struct S {
+        ↓let b = 2
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/explicit_enum_raw_value.html b/explicit_enum_raw_value.html new file mode 100644 index 000000000..36299eab6 --- /dev/null +++ b/explicit_enum_raw_value.html @@ -0,0 +1,424 @@ + + + + explicit_enum_raw_value Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Explicit Enum Raw Value

+ +

Enums should be explicitly assigned their raw values

+ +
    +
  • Identifier: explicit_enum_raw_value
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
enum Numbers {
+  case int(Int)
+  case short(Int16)
+}
+
+
enum Numbers: Int {
+  case one = 1
+  case two = 2
+}
+
+
enum Numbers: Double {
+  case one = 1.1
+  case two = 2.2
+}
+
+
enum Numbers: String {
+  case one = "one"
+  case two = "two"
+}
+
+
protocol Algebra {}
+enum Numbers: Algebra {
+  case one
+}
+
+

Triggering Examples

+
enum Numbers: Int {
+  case one = 10, ↓two, three = 30
+}
+
+
enum Numbers: NSInteger {
+  case ↓one
+}
+
+
enum Numbers: String {
+  case ↓one
+  case ↓two
+}
+
+
enum Numbers: String {
+   case ↓one, two = "two"
+}
+
+
enum Numbers: Decimal {
+  case ↓one, ↓two
+}
+
+
enum Outer {
+    enum Numbers: Decimal {
+      case ↓one, ↓two
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/explicit_init.html b/explicit_init.html new file mode 100644 index 000000000..f72a63e01 --- /dev/null +++ b/explicit_init.html @@ -0,0 +1,430 @@ + + + + explicit_init Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Explicit Init

+ +

Explicitly calling .init() should be avoided

+ +
    +
  • Identifier: explicit_init
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +include_bare_init + +false +
  • +
+

Non Triggering Examples

+
import Foundation
+class C: NSObject {
+    override init() {
+        super.init()
+    }
+}
+
+
struct S {
+    let n: Int
+}
+extension S {
+    init() {
+        self.init(n: 1)
+    }
+}
+
+
[1].flatMap(String.init)
+
+
[String.self].map { $0.init(1) }
+
+
[String.self].map { type in type.init(1) }
+
+
Observable.zip(obs1, obs2, resultSelector: MyType.init).asMaybe()
+
+
_ = GleanMetrics.Tabs.someType.init()
+
+
Observable.zip(
+  obs1,
+  obs2,
+  resultSelector: MyType.init
+).asMaybe()
+
+

Triggering Examples

+
[1].flatMap{String↓.init($0)}
+
+
[String.self].map { Type in Type↓.init(1) }
+
+
func foo() -> [String] {
+    return [1].flatMap { String↓.init($0) }
+}
+
+
_ = GleanMetrics.Tabs.GroupedTabExtra↓.init()
+
+
_ = Set<KsApi.Category>↓.init()
+
+
Observable.zip(
+  obs1,
+  obs2,
+  resultSelector: { MyType↓.init($0, $1) }
+).asMaybe()
+
+ +
+
+ + +
+
+ + + diff --git a/explicit_self.html b/explicit_self.html new file mode 100644 index 000000000..39d5bf028 --- /dev/null +++ b/explicit_self.html @@ -0,0 +1,443 @@ + + + + explicit_self Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Explicit Self

+ +

Instance variables and functions should be explicitly accessed with ‘self.’

+ +
    +
  • Identifier: explicit_self
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: Yes
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
struct A {
+    func f1() {}
+    func f2() {
+        self.f1()
+    }
+}
+
+
struct A {
+    let p1: Int
+    func f1() {
+        _ = self.p1
+    }
+}
+
+
@propertyWrapper
+struct Wrapper<Value> {
+    let wrappedValue: Value
+    var projectedValue: [Value] {
+        [self.wrappedValue]
+    }
+}
+struct A {
+    @Wrapper var p1: Int
+    func f1() {
+        self.$p1
+        self._p1
+    }
+}
+func f1() {
+    A(p1: 10).$p1
+}
+
+

Triggering Examples

+
struct A {
+    func f1() {}
+    func f2() {
+        ↓f1()
+    }
+}
+
+
struct A {
+    let p1: Int
+    func f1() {
+        _ = ↓p1
+    }
+}
+
+
struct A {
+    func f1(a b: Int) {}
+    func f2() {
+        ↓f1(a: 0)
+    }
+}
+
+
@propertyWrapper
+struct Wrapper<Value> {
+    let wrappedValue: Value
+    var projectedValue: [Value] {
+        [self.wrappedValue]
+    }
+}
+struct A {
+    @Wrapper var p1: Int
+    func f1() {
+        ↓$p1
+        ↓_p1
+    }
+}
+func f1() {
+    A(p1: 10).$p1
+}
+
+ +
+
+ + +
+
+ + + diff --git a/explicit_top_level_acl.html b/explicit_top_level_acl.html new file mode 100644 index 000000000..09a7dfd25 --- /dev/null +++ b/explicit_top_level_acl.html @@ -0,0 +1,403 @@ + + + + explicit_top_level_acl Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Explicit Top Level ACL

+ +

Top-level declarations should specify Access Control Level keywords explicitly

+ +
    +
  • Identifier: explicit_top_level_acl
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
internal enum A {}
+
+
public final class B {}
+
+
private struct S1 {
+    struct S2 {}
+}
+
+
internal enum A { enum B {} }
+
+
internal final actor Foo {}
+
+
internal typealias Foo = Bar
+
+
internal func a() {}
+
+
extension A: Equatable {}
+
+
extension A {}
+
+

Triggering Examples

+
↓enum A {}
+
+
final ↓class B {}
+
+
↓protocol P {}
+
+
↓func a() {}
+
+
internal let a = 0
+↓func b() {}
+
+ +
+
+ + +
+
+ + + diff --git a/explicit_type_interface.html b/explicit_type_interface.html new file mode 100644 index 000000000..15348af32 --- /dev/null +++ b/explicit_type_interface.html @@ -0,0 +1,428 @@ + + + + explicit_type_interface Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Explicit Type Interface

+ +

Properties should have a type interface

+ +
    +
  • Identifier: explicit_type_interface
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +excluded + +[] +
    +allow_redundancy + +false +
  • +
+

Non Triggering Examples

+
class Foo {
+  var myVar: Int? = 0
+}
+
+
class Foo {
+  let myVar: Int? = 0, s: String = ""
+}
+
+
class Foo {
+  static var myVar: Int? = 0
+}
+
+
class Foo {
+  class var myVar: Int? = 0
+}
+
+

Triggering Examples

+
class Foo {
+  var ↓myVar = 0
+}
+
+
class Foo {
+  let ↓mylet = 0
+}
+
+
class Foo {
+  static var ↓myStaticVar = 0
+}
+
+
class Foo {
+  class var ↓myClassVar = 0
+}
+
+
class Foo {
+  let ↓myVar = Int(0), ↓s = ""
+}
+
+
class Foo {
+  let ↓myVar = Set<Int>(0)
+}
+
+ +
+
+ + +
+
+ + + diff --git a/extension_access_modifier.html b/extension_access_modifier.html new file mode 100644 index 000000000..57ea7af8f --- /dev/null +++ b/extension_access_modifier.html @@ -0,0 +1,503 @@ + + + + extension_access_modifier Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Extension Access Modifier

+ +

Prefer to use extension access modifiers

+ +
    +
  • Identifier: extension_access_modifier
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
extension Foo: SomeProtocol {
+  public var bar: Int { return 1 }
+}
+
+
extension Foo {
+  private var bar: Int { return 1 }
+  public var baz: Int { return 1 }
+}
+
+
extension Foo {
+  private var bar: Int { return 1 }
+  public func baz() {}
+}
+
+
extension Foo {
+  var bar: Int { return 1 }
+  var baz: Int { return 1 }
+}
+
+
extension Foo {
+  var bar: Int { return 1 }
+  internal var baz: Int { return 1 }
+}
+
+
internal extension Foo {
+  var bar: Int { return 1 }
+  var baz: Int { return 1 }
+}
+
+
public extension Foo {
+  var bar: Int { return 1 }
+  var baz: Int { return 1 }
+}
+
+
public extension Foo {
+  var bar: Int { return 1 }
+  internal var baz: Int { return 1 }
+}
+
+
extension Foo {
+  private var bar: Int { return 1 }
+  private var baz: Int { return 1 }
+}
+
+
extension Foo {
+  open var bar: Int { return 1 }
+  open var baz: Int { return 1 }
+}
+
+
extension Foo {
+    func setup() {}
+    public func update() {}
+}
+
+
private extension Foo {
+  private var bar: Int { return 1 }
+  var baz: Int { return 1 }
+}
+
+
extension Foo {
+  internal private(set) var bar: Int {
+    get { Foo.shared.bar }
+    set { Foo.shared.bar = newValue }
+  }
+}
+
+
extension Foo {
+  private(set) internal var bar: Int {
+    get { Foo.shared.bar }
+    set { Foo.shared.bar = newValue }
+  }
+}
+
+
public extension Foo {
+  private(set) var value: Int { 1 }
+}
+
+

Triggering Examples

+
↓extension Foo {
+   public var bar: Int { return 1 }
+   public var baz: Int { return 1 }
+}
+
+
↓extension Foo {
+   public var bar: Int { return 1 }
+   public func baz() {}
+}
+
+
public extension Foo {
+  ↓public func bar() {}
+  ↓public func baz() {}
+}
+
+
↓extension Foo {
+   public var bar: Int {
+      let value = 1
+      return value
+   }
+
+   public var baz: Int { return 1 }
+}
+
+
↓extension Array where Element: Equatable {
+    public var unique: [Element] {
+        var uniqueValues = [Element]()
+        for item in self where !uniqueValues.contains(item) {
+            uniqueValues.append(item)
+        }
+        return uniqueValues
+    }
+}
+
+
↓extension Foo {
+   #if DEBUG
+   public var bar: Int {
+      let value = 1
+      return value
+   }
+   #endif
+
+   public var baz: Int { return 1 }
+}
+
+
public extension Foo {
+  ↓private func bar() {}
+  ↓private func baz() {}
+}
+
+
↓extension Foo {
+  private(set) public var value: Int { 1 }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/fallthrough.html b/fallthrough.html new file mode 100644 index 000000000..c646b5bb9 --- /dev/null +++ b/fallthrough.html @@ -0,0 +1,384 @@ + + + + fallthrough Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Fallthrough

+ +

Fallthrough should be avoided

+ +
    +
  • Identifier: fallthrough
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
switch foo {
+case .bar, .bar2, .bar3:
+  something()
+}
+
+

Triggering Examples

+
switch foo {
+case .bar:
+  ↓fallthrough
+case .bar2:
+  something()
+}
+
+ +
+
+ + +
+
+ + + diff --git a/fatal_error_message.html b/fatal_error_message.html new file mode 100644 index 000000000..c180b85db --- /dev/null +++ b/fatal_error_message.html @@ -0,0 +1,388 @@ + + + + fatal_error_message Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Fatal Error Message

+ +

A fatalError call should have a message

+ +
    +
  • Identifier: fatal_error_message
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func foo() {
+  fatalError("Foo")
+}
+
+
func foo() {
+  fatalError(x)
+}
+
+

Triggering Examples

+
func foo() {
+  ↓fatalError("")
+}
+
+
func foo() {
+  ↓fatalError()
+}
+
+ +
+
+ + +
+
+ + + diff --git a/file_header.html b/file_header.html new file mode 100644 index 000000000..36888e391 --- /dev/null +++ b/file_header.html @@ -0,0 +1,392 @@ + + + + file_header Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

File Header

+ +

Header comments should be consistent with project patterns. The SWIFTLINT_CURRENT_FILENAME placeholder can optionally be used in the required and forbidden patterns. It will be replaced by the real file name.

+ +
    +
  • Identifier: file_header
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let foo = "Copyright"
+
+
let foo = 2 // Copyright
+
+
let foo = 2
+ // Copyright
+
+

Triggering Examples

+
// ↓Copyright
+
+
//
+// ↓Copyright
+
+
//
+//  FileHeaderRule.swift
+//  SwiftLint
+//
+//  Created by Marcelo Fabri on 27/11/16.
+//  ↓Copyright © 2016 Realm. All rights reserved.
+//
+
+ +
+
+ + +
+
+ + + diff --git a/file_length.html b/file_length.html new file mode 100644 index 000000000..35fc1f5ba --- /dev/null +++ b/file_length.html @@ -0,0 +1,1999 @@ + + + + file_length Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

File Length

+ +

Files should not span too many lines.

+ +
    +
  • Identifier: file_length
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: metrics
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +warning + +400 +
    +error + +1000 +
    +ignore_comment_only_lines + +false +
  • +
+

Non Triggering Examples

+
print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+
+
+

Triggering Examples

+
print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+
+
+
print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+print("swiftlint")
+//
+
+
+
print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+print("swiftlint")
+
+
+
+ +
+
+ + +
+
+ + + diff --git a/file_name.html b/file_name.html new file mode 100644 index 000000000..e8163a596 --- /dev/null +++ b/file_name.html @@ -0,0 +1,410 @@ + + + + file_name Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

File Name

+ +

File name should match a type or extension declared in the file (if any)

+ +
    +
  • Identifier: file_name
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +excluded + +[“LinuxMain.swift”, “main.swift”] +
    +prefix_pattern + +“” +
    +suffix_pattern + +“+.*” +
    +nested_type_separator + +“.” +
    +require_fully_qualified_names + +false +
  • +
+ +
+
+ + +
+
+ + + diff --git a/file_name_no_space.html b/file_name_no_space.html new file mode 100644 index 000000000..1c8a33da0 --- /dev/null +++ b/file_name_no_space.html @@ -0,0 +1,378 @@ + + + + file_name_no_space Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

File Name no Space

+ +

File name should not contain any whitespace

+ +
    +
  • Identifier: file_name_no_space
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +excluded + +[] +
  • +
+ +
+
+ + +
+
+ + + diff --git a/file_types_order.html b/file_types_order.html new file mode 100644 index 000000000..e29a07d31 --- /dev/null +++ b/file_types_order.html @@ -0,0 +1,585 @@ + + + + file_types_order Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

File Types Order

+ +

Specifies how the types within a file should be ordered.

+ +
    +
  • Identifier: file_types_order
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +order + +[[supporting_type], [main_type], [extension], [preview_provider], [library_content_provider]] +
  • +
+

Non Triggering Examples

+
// Supporting Types
+protocol TestViewControllerDelegate {
+    func didPressTrackedButton()
+}
+
+// Main Type
+class TestViewController: UIViewController {
+    // Type Aliases
+    typealias CompletionHandler = ((TestEnum) -> Void)
+
+    // Subtypes
+    class TestClass {
+        // 10 lines
+    }
+
+    struct TestStruct {
+        // 3 lines
+    }
+
+    enum TestEnum {
+        // 5 lines
+    }
+
+    // Stored Type Properties
+    static let cellIdentifier: String = "AmazingCell"
+
+    // Stored Instance Properties
+    var shouldLayoutView1: Bool!
+    weak var delegate: TestViewControllerDelegate?
+    private var hasLayoutedView1: Bool = false
+    private var hasLayoutedView2: Bool = false
+
+    // Computed Instance Properties
+    private var hasAnyLayoutedView: Bool {
+         return hasLayoutedView1 || hasLayoutedView2
+    }
+
+    // IBOutlets
+    @IBOutlet private var view1: UIView!
+    @IBOutlet private var view2: UIView!
+
+    // Initializers
+    override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
+        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
+    }
+
+    required init?(coder aDecoder: NSCoder) {
+        fatalError("init(coder:) has not been implemented")
+    }
+
+    // Type Methods
+    static func makeViewController() -> TestViewController {
+        // some code
+    }
+
+    // Life-Cycle Methods
+    override func viewDidLoad() {
+        super.viewDidLoad()
+    }
+
+    override func viewDidLayoutSubviews() {
+        super.viewDidLayoutSubviews()
+    }
+
+    // IBActions
+    @IBAction func goNextButtonPressed() {
+        goToNextVc()
+        delegate?.didPressTrackedButton()
+    }
+
+    @objc
+    func goToRandomVcButtonPressed() {
+        goToRandomVc()
+    }
+
+    // MARK: Other Methods
+    func goToNextVc() { /* TODO */ }
+
+    func goToInfoVc() { /* TODO */ }
+
+    func goToRandomVc() {
+        let viewCtrl = getRandomVc()
+        present(viewCtrl, animated: true)
+    }
+
+    private func getRandomVc() -> UIViewController { return UIViewController() }
+
+    // Subscripts
+    subscript(_ someIndexThatIsNotEvenUsed: Int) -> String {
+        get {
+            return "This is just a test"
+        }
+
+        set {
+            log.warning("Just a test", newValue)
+        }
+    }
+}
+
+// Extensions
+extension TestViewController: UITableViewDataSource {
+    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        return 1
+    }
+}
+
+
// Only extensions
+extension Foo {}
+extension Bar {
+}
+
+
// Main Type
+struct ContentView: View {
+    var body: some View {
+        Text("Hello, World!")
+    }
+}
+
+// Preview Provider
+struct ContentView_Previews: PreviewProvider {
+    static var previews: some View { ContentView() }
+}
+
+// Library Content Provider
+struct ContentView_LibraryContent: LibraryContentProvider {
+    var views: [LibraryItem] {
+        LibraryItem(ContentView())
+    }
+}
+
+

Triggering Examples

+
↓class TestViewController: UIViewController {}
+
+// Supporting Types
+protocol TestViewControllerDelegate {
+    func didPressTrackedButton()
+}
+
+
// Extensions
+↓extension TestViewController: UITableViewDataSource {
+    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        return 1
+    }
+}
+
+class TestViewController: UIViewController {}
+
+
// Supporting Types
+protocol TestViewControllerDelegate {
+    func didPressTrackedButton()
+}
+
+↓class TestViewController: UIViewController {}
+
+// Supporting Types
+protocol TestViewControllerDelegate {
+    func didPressTrackedButton()
+}
+
+
// Supporting Types
+protocol TestViewControllerDelegate {
+    func didPressTrackedButton()
+}
+
+// Extensions
+↓extension TestViewController: UITableViewDataSource {
+    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        return 1
+    }
+}
+
+class TestViewController: UIViewController {}
+
+// Extensions
+extension TestViewController: UITableViewDataSource {
+    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        return 1
+    }
+}
+
+
// Preview Provider
+↓struct ContentView_Previews: PreviewProvider {
+    static var previews: some View { ContentView() }
+}
+
+// Main Type
+struct ContentView: View {
+    var body: some View {
+        Text("Hello, World!")
+    }
+}
+
+
// Library Content Provider
+↓struct ContentView_LibraryContent: LibraryContentProvider {
+    var views: [LibraryItem] {
+        LibraryItem(ContentView())
+    }
+}
+
+// Main Type
+struct ContentView: View {
+    var body: some View {
+        Text("Hello, World!")
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/final_test_case.html b/final_test_case.html new file mode 100644 index 000000000..cc48dcca1 --- /dev/null +++ b/final_test_case.html @@ -0,0 +1,406 @@ + + + + final_test_case Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Final Test Case

+ +

Test cases should be final

+ +
    +
  • Identifier: final_test_case
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +test_parent_classes + +[“QuickSpec”, “XCTestCase”] +
  • +
+

Non Triggering Examples

+
final class Test: XCTestCase {}
+
+
open class Test: XCTestCase {}
+
+
public final class Test: QuickSpec {}
+
+
class Test: MyTestCase {}
+
+
//
+// test_parent_classes: ["MyTestCase", "QuickSpec", "XCTestCase"]
+//
+
+struct Test: MyTestCase {}
+
+
+

Triggering Examples

+
class ↓Test: XCTestCase {}
+
+
public class ↓Test: QuickSpec {}
+
+
//
+// test_parent_classes: ["MyTestCase", "QuickSpec", "XCTestCase"]
+//
+
+class ↓Test: MyTestCase {}
+
+
+ +
+
+ + +
+
+ + + diff --git a/first_where.html b/first_where.html new file mode 100644 index 000000000..447626659 --- /dev/null +++ b/first_where.html @@ -0,0 +1,405 @@ + + + + first_where Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

First Where

+ +

Prefer using .first(where:) over .filter { }.first in collections

+ +
    +
  • Identifier: first_where
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
kinds.filter(excludingKinds.contains).isEmpty && kinds.first == .identifier
+
+
myList.first(where: { $0 % 2 == 0 })
+
+
match(pattern: pattern).filter { $0.first == .identifier }
+
+
(myList.filter { $0 == 1 }.suffix(2)).first
+
+
collection.filter("stringCol = '3'").first
+
+
realm?.objects(User.self).filter(NSPredicate(format: "email ==[c] %@", email)).first
+
+
if let pause = timeTracker.pauses.filter("beginDate < %@", beginDate).first { print(pause) }
+
+

Triggering Examples

+
↓myList.filter { $0 % 2 == 0 }.first
+
+
↓myList.filter({ $0 % 2 == 0 }).first
+
+
↓myList.map { $0 + 1 }.filter({ $0 % 2 == 0 }).first
+
+
↓myList.map { $0 + 1 }.filter({ $0 % 2 == 0 }).first?.something()
+
+
↓myList.filter(someFunction).first
+
+
↓myList.filter({ $0 % 2 == 0 })
+.first
+
+
(↓myList.filter { $0 == 1 }).first
+
+
↓myListOfDict.filter { dict in dict["1"] }.first
+
+
↓myListOfDict.filter { $0["someString"] }.first
+
+ +
+
+ + +
+
+ + + diff --git a/flatmap_over_map_reduce.html b/flatmap_over_map_reduce.html new file mode 100644 index 000000000..07da0cbaf --- /dev/null +++ b/flatmap_over_map_reduce.html @@ -0,0 +1,378 @@ + + + + flatmap_over_map_reduce Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Flat Map over Map Reduce

+ +

Prefer flatMap over map followed by reduce([], +)

+ +
    +
  • Identifier: flatmap_over_map_reduce
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let foo = bar.map { $0.count }.reduce(0, +)
+
+
let foo = bar.flatMap { $0.array }
+
+

Triggering Examples

+
let foo = ↓bar.map { $0.array }.reduce([], +)
+
+ +
+
+ + +
+
+ + + diff --git a/for_where.html b/for_where.html new file mode 100644 index 000000000..4019ae279 --- /dev/null +++ b/for_where.html @@ -0,0 +1,472 @@ + + + + for_where Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Prefer For-Where

+ +

where clauses are preferred over a single if inside a for

+ +
    +
  • Identifier: for_where
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +allow_for_as_filter + +false +
  • +
+

Non Triggering Examples

+
for user in users where user.id == 1 { }
+
+
for user in users {
+  if let id = user.id { }
+}
+
+
for user in users {
+  if var id = user.id { }
+}
+
+
for user in users {
+  if user.id == 1 { } else { }
+}
+
+
for user in users {
+  if user.id == 1 {
+  } else if user.id == 2 { }
+}
+
+
for user in users {
+  if user.id == 1 { }
+  print(user)
+}
+
+
for user in users {
+  let id = user.id
+  if id == 1 { }
+}
+
+
for user in users {
+  if user.id == 1 { }
+  return true
+}
+
+
for user in users {
+  if user.id == 1 && user.age > 18 { }
+}
+
+
for user in users {
+  if user.id == 1, user.age > 18 { }
+}
+
+
for (index, value) in array.enumerated() {
+  if case .valueB(_) = value {
+    return index
+  }
+}
+
+
//
+// allow_for_as_filter: true
+//
+
+for user in users {
+  if user.id == 1 { return true }
+}
+
+
+
//
+// allow_for_as_filter: true
+//
+
+for user in users {
+  if user.id == 1 {
+    let derivedValue = calculateValue(from: user)
+    return derivedValue != 0
+  }
+}
+
+
+

Triggering Examples

+
for user in users {
+  ↓if user.id == 1 { return true }
+}
+
+
for subview in subviews {
+    ↓if !(subview is UIStackView) {
+        subview.removeConstraints(subview.constraints)
+        subview.removeFromSuperview()
+    }
+}
+
+
//
+// allow_for_as_filter: true
+//
+
+for subview in subviews {
+    ↓if !(subview is UIStackView) {
+        subview.removeConstraints(subview.constraints)
+        subview.removeFromSuperview()
+    }
+}
+
+
+ +
+
+ + +
+
+ + + diff --git a/force_cast.html b/force_cast.html new file mode 100644 index 000000000..2d6c8ea43 --- /dev/null +++ b/force_cast.html @@ -0,0 +1,376 @@ + + + + force_cast Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Force Cast

+ +

Force casts should be avoided

+ +
    +
  • Identifier: force_cast
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +error +
  • +
+

Non Triggering Examples

+
NSNumber() as? Int
+
+

Triggering Examples

+
NSNumber() ↓as! Int
+
+ +
+
+ + +
+
+ + + diff --git a/force_try.html b/force_try.html new file mode 100644 index 000000000..c61cb474f --- /dev/null +++ b/force_try.html @@ -0,0 +1,380 @@ + + + + force_try Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Force Try

+ +

Force tries should be avoided

+ +
    +
  • Identifier: force_try
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +error +
  • +
+

Non Triggering Examples

+
func a() throws {}
+do {
+  try a()
+} catch {}
+
+

Triggering Examples

+
func a() throws {}
+↓try! a()
+
+ +
+
+ + +
+
+ + + diff --git a/force_unwrapping.html b/force_unwrapping.html new file mode 100644 index 000000000..7397b0fb1 --- /dev/null +++ b/force_unwrapping.html @@ -0,0 +1,450 @@ + + + + force_unwrapping Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Force Unwrapping

+ +

Force unwrapping should be avoided

+ +
    +
  • Identifier: force_unwrapping
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
if let url = NSURL(string: query)
+
+
navigationController?.pushViewController(viewController, animated: true)
+
+
let s as! Test
+
+
try! canThrowErrors()
+
+
let object: Any!
+
+
@IBOutlet var constraints: [NSLayoutConstraint]!
+
+
setEditing(!editing, animated: true)
+
+
navigationController.setNavigationBarHidden(!navigationController.navigationBarHidden, animated: true)
+
+
if addedToPlaylist && (!self.selectedFilters.isEmpty || self.searchBar?.text?.isEmpty == false) {}
+
+
print("\(xVar)!")
+
+
var test = (!bar)
+
+
var a: [Int]!
+
+
private var myProperty: (Void -> Void)!
+
+
func foo(_ options: [AnyHashable: Any]!) {
+
+
func foo() -> [Int]!
+
+
func foo() -> [AnyHashable: Any]!
+
+
func foo() -> [Int]! { return [] }
+
+
return self
+
+

Triggering Examples

+
let url = NSURL(string: query)↓!
+
+
navigationController↓!.pushViewController(viewController, animated: true)
+
+
let unwrapped = optional↓!
+
+
return cell↓!
+
+
let url = NSURL(string: "http://www.google.com")↓!
+
+
let dict = ["Boooo": "👻"]
+func bla() -> String {
+    return dict["Boooo"]↓!
+}
+
+
let dict = ["Boooo": "👻"]
+func bla() -> String {
+    return dict["Boooo"]↓!.contains("B")
+}
+
+
let a = dict["abc"]↓!.contains("B")
+
+
dict["abc"]↓!.bar("B")
+
+
if dict["a"]↓!↓!↓!↓! {}
+
+
var foo: [Bool]! = dict["abc"]↓!
+
+
realm.objects(SwiftUTF8Object.self).filter("%K == %@", "柱нǢкƱаم👍", utf8TestString).first↓!
+
+
context("abc") {
+  var foo: [Bool]! = dict["abc"]↓!
+}
+
+
open var computed: String { return foo.bar↓! }
+
+
return self↓!
+
+
[1, 3, 5, 6].first { $0.isMultiple(of: 2) }↓!
+
+
map["a"]↓!↓!
+
+ +
+
+ + +
+
+ + + diff --git a/function_body_length.html b/function_body_length.html new file mode 100644 index 000000000..9c331145f --- /dev/null +++ b/function_body_length.html @@ -0,0 +1,378 @@ + + + + function_body_length Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Function Body Length

+ +

Function bodies should not span too many lines

+ +
    +
  • Identifier: function_body_length
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: metrics
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +warning + +50 +
    +error + +100 +
  • +
+ +
+
+ + +
+
+ + + diff --git a/function_default_parameter_at_end.html b/function_default_parameter_at_end.html new file mode 100644 index 000000000..abcecc898 --- /dev/null +++ b/function_default_parameter_at_end.html @@ -0,0 +1,433 @@ + + + + function_default_parameter_at_end Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Function Default Parameter at End

+ +

Prefer to locate parameters with defaults toward the end of the parameter list

+ +
    +
  • Identifier: function_default_parameter_at_end
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +ignore_first_isolation_inheritance_parameter + +true +
  • +
+

Non Triggering Examples

+
func foo(baz: String, bar: Int = 0) {}
+
+
func foo(x: String, y: Int = 0, z: CGFloat = 0) {}
+
+
func foo(bar: String, baz: Int = 0, z: () -> Void) {}
+
+
func foo(bar: String, z: () -> Void, baz: Int = 0) {}
+
+
func foo(bar: Int = 0) {}
+
+
func foo() {}
+
+
class A: B {
+  override func foo(bar: Int = 0, baz: String) {}
+
+
func foo(bar: Int = 0, completion: @escaping CompletionHandler) {}
+
+
func foo(a: Int, b: CGFloat = 0) {
+  let block = { (error: Error?) in }
+}
+
+
func foo(a: String, b: String? = nil,
+         c: String? = nil, d: @escaping AlertActionHandler = { _ in }) {}
+
+
override init?(for date: Date = Date(), coordinate: CLLocationCoordinate2D) {}
+
+
func handleNotification(_ userInfo: NSDictionary,
+                        userInteraction: Bool = false,
+                        completionHandler: ((UIBackgroundFetchResult) -> Void)?) {}
+
+
func write(withoutNotifying tokens: [NotificationToken] =  {}, _ block: (() throws -> Int)) {}
+
+
func foo(bar: Int, baz: Int = 0, z: () -> Void) {}
+
+
func foo(bar: Int, baz: Int = 0, z: () -> Void, x: Int = 0) {}
+
+
func foo(isolation: isolated (any Actor)? = #isolation, bar: String) {}
+
+

Triggering Examples

+
func foo(↓bar: Int = 0, baz: String) {}
+
+
private func foo(↓bar: Int = 0, baz: String) {}
+
+
public init?(↓for date: Date = Date(), coordinate: CLLocationCoordinate2D) {}
+
+
func foo(bar: Int, ↓baz: Int = 0, z: () -> Void, x: Int) {}
+
+
//
+// ignore_first_isolation_inheritance_parameter: false
+//
+
+func foo(isolation: isolated (any Actor)? = #isolation, bar: String) {}
+
+
+ +
+
+ + +
+
+ + + diff --git a/function_parameter_count.html b/function_parameter_count.html new file mode 100644 index 000000000..73542318f --- /dev/null +++ b/function_parameter_count.html @@ -0,0 +1,419 @@ + + + + function_parameter_count Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Function Parameter Count

+ +

Number of function parameters should be low.

+ +
    +
  • Identifier: function_parameter_count
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: metrics
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +warning + +5 +
    +error + +8 +
    +ignores_default_parameters + +true +
  • +
+

Non Triggering Examples

+
init(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}
+
+
init (a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}
+
+
`init`(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}
+
+
init?(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}
+
+
init?<T>(a: T, b: Int, c: Int, d: Int, e: Int, f: Int) {}
+
+
init?<T: String>(a: T, b: Int, c: Int, d: Int, e: Int, f: Int) {}
+
+
func f2(p1: Int, p2: Int) { }
+
+
func f(a: Int, b: Int, c: Int, d: Int, x: Int = 42) {}
+
+
func f(a: [Int], b: Int, c: Int, d: Int, f: Int) -> [Int] {
+    let s = a.flatMap { $0 as? [String: Int] } ?? []}}
+
+
override func f(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}
+
+

Triggering Examples

+
↓func f(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}
+
+
↓func initialValue(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}
+
+
private ↓func f(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int = 2, g: Int) {}
+
+
struct Foo {
+    init(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}
+    ↓func bar(a: Int, b: Int, c: Int, d: Int, e: Int, f: Int) {}}
+
+ +
+
+ + +
+
+ + + diff --git a/generic_type_name.html b/generic_type_name.html new file mode 100644 index 000000000..aaa930c9d --- /dev/null +++ b/generic_type_name.html @@ -0,0 +1,528 @@ + + + + generic_type_name Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Generic Type Name

+ +

Generic type name should only contain alphanumeric characters, start with an uppercase character and span between 1 and 20 characters in length.

+ +
    +
  • Identifier: generic_type_name
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +min_length + + + + + + + + + + + + + + + +
    KeyValue
    +warning + +1 +
    +error + +0 +
    +
    +max_length + + + + + + + + + + + + + + + +
    KeyValue
    +warning + +20 +
    +error + +1000 +
    +
    +excluded + +[] +
    +allowed_symbols + +[] +
    +unallowed_symbols_severity + +error +
    +validates_start_with_lowercase + +error +
  • +
+

Non Triggering Examples

+
func foo<T>() {}
+
+
func foo<T>() -> T {}
+
+
func foo<T, U>(param: U) -> T {}
+
+
func foo<T: Hashable, U: Rule>(param: U) -> T {}
+
+
struct Foo<T> {}
+
+
class Foo<T> {}
+
+
enum Foo<T> {}
+
+
func run(_ options: NoOptions<CommandantError<()>>) {}
+
+
func foo(_ options: Set<type>) {}
+
+
func < <T: Comparable>(lhs: T?, rhs: T?) -> Bool
+
+
func configureWith(data: Either<MessageThread, (project: Project, backing: Backing)>)
+
+
typealias StringDictionary<T> = Dictionary<String, T>
+
+
typealias BackwardTriple<T1, T2, T3> = (T3, T2, T1)
+
+
typealias DictionaryOfStrings<T : Hashable> = Dictionary<T, String>
+
+

Triggering Examples

+
func foo<↓T_Foo>() {}
+
+
func foo<T, ↓U_Foo>(param: U_Foo) -> T {}
+
+
func foo<↓TTTTTTTTTTTTTTTTTTTTT>() {}
+
+
func foo<↓type>() {}
+
+
typealias StringDictionary<↓T_Foo> = Dictionary<String, T_Foo>
+
+
typealias BackwardTriple<T1, ↓T2_Bar, T3> = (T3, T2_Bar, T1)
+
+
typealias DictionaryOfStrings<↓T_Foo: Hashable> = Dictionary<T_Foo, String>
+
+
class Foo<↓T_Foo> {}
+
+
class Foo<T, ↓U_Foo> {}
+
+
class Foo<↓T_Foo, ↓U_Foo> {}
+
+
class Foo<↓TTTTTTTTTTTTTTTTTTTTT> {}
+
+
class Foo<↓type> {}
+
+
struct Foo<↓T_Foo> {}
+
+
struct Foo<T, ↓U_Foo> {}
+
+
struct Foo<↓T_Foo, ↓U_Foo> {}
+
+
struct Foo<↓TTTTTTTTTTTTTTTTTTTTT> {}
+
+
struct Foo<↓type> {}
+
+
enum Foo<↓T_Foo> {}
+
+
enum Foo<T, ↓U_Foo> {}
+
+
enum Foo<↓T_Foo, ↓U_Foo> {}
+
+
enum Foo<↓TTTTTTTTTTTTTTTTTTTTT> {}
+
+
enum Foo<↓type> {}
+
+ +
+
+ + +
+
+ + + diff --git a/ibinspectable_in_extension.html b/ibinspectable_in_extension.html new file mode 100644 index 000000000..1dd0556ff --- /dev/null +++ b/ibinspectable_in_extension.html @@ -0,0 +1,380 @@ + + + + ibinspectable_in_extension Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

IBInspectable in Extension

+ +

Extensions shouldn’t add @IBInspectable properties

+ +
    +
  • Identifier: ibinspectable_in_extension
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class Foo {
+  @IBInspectable private var x: Int
+}
+
+

Triggering Examples

+
extension Foo {
+  ↓@IBInspectable private var x: Int
+}
+
+ +
+
+ + +
+
+ + + diff --git a/identical_operands.html b/identical_operands.html new file mode 100644 index 000000000..745e61806 --- /dev/null +++ b/identical_operands.html @@ -0,0 +1,858 @@ + + + + identical_operands Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Identical Operands

+ +

Comparing two identical operands is likely a mistake

+ +
    +
  • Identifier: identical_operands
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
1 == 2
+
+
foo == bar
+
+
prefixedFoo == foo
+
+
foo.aProperty == foo.anotherProperty
+
+
self.aProperty == self.anotherProperty
+
+
"1 == 1"
+
+
self.aProperty == aProperty
+
+
lhs.aProperty == rhs.aProperty
+
+
lhs.identifier == rhs.identifier
+
+
i == index
+
+
$0 == 0
+
+
keyValues?.count ?? 0 == 0
+
+
string == string.lowercased()
+
+
let num: Int? = 0
+_ = num != nil && num == num?.byteSwapped
+
+
num == num!.byteSwapped
+
+
1    + 1 ==   1     +    2
+
+
f(  i :   2) ==   f (i: 3 )
+
+
1 != 2
+
+
foo != bar
+
+
prefixedFoo != foo
+
+
foo.aProperty != foo.anotherProperty
+
+
self.aProperty != self.anotherProperty
+
+
"1 != 1"
+
+
self.aProperty != aProperty
+
+
lhs.aProperty != rhs.aProperty
+
+
lhs.identifier != rhs.identifier
+
+
i != index
+
+
$0 != 0
+
+
keyValues?.count ?? 0 != 0
+
+
string != string.lowercased()
+
+
let num: Int? = 0
+_ = num != nil && num != num?.byteSwapped
+
+
num != num!.byteSwapped
+
+
1    + 1 !=   1     +    2
+
+
f(  i :   2) !=   f (i: 3 )
+
+
1 === 2
+
+
foo === bar
+
+
prefixedFoo === foo
+
+
foo.aProperty === foo.anotherProperty
+
+
self.aProperty === self.anotherProperty
+
+
"1 === 1"
+
+
self.aProperty === aProperty
+
+
lhs.aProperty === rhs.aProperty
+
+
lhs.identifier === rhs.identifier
+
+
i === index
+
+
$0 === 0
+
+
keyValues?.count ?? 0 === 0
+
+
string === string.lowercased()
+
+
let num: Int? = 0
+_ = num != nil && num === num?.byteSwapped
+
+
num === num!.byteSwapped
+
+
1    + 1 ===   1     +    2
+
+
f(  i :   2) ===   f (i: 3 )
+
+
1 !== 2
+
+
foo !== bar
+
+
prefixedFoo !== foo
+
+
foo.aProperty !== foo.anotherProperty
+
+
self.aProperty !== self.anotherProperty
+
+
"1 !== 1"
+
+
self.aProperty !== aProperty
+
+
lhs.aProperty !== rhs.aProperty
+
+
lhs.identifier !== rhs.identifier
+
+
i !== index
+
+
$0 !== 0
+
+
keyValues?.count ?? 0 !== 0
+
+
string !== string.lowercased()
+
+
let num: Int? = 0
+_ = num != nil && num !== num?.byteSwapped
+
+
num !== num!.byteSwapped
+
+
1    + 1 !==   1     +    2
+
+
f(  i :   2) !==   f (i: 3 )
+
+
1 > 2
+
+
foo > bar
+
+
prefixedFoo > foo
+
+
foo.aProperty > foo.anotherProperty
+
+
self.aProperty > self.anotherProperty
+
+
"1 > 1"
+
+
self.aProperty > aProperty
+
+
lhs.aProperty > rhs.aProperty
+
+
lhs.identifier > rhs.identifier
+
+
i > index
+
+
$0 > 0
+
+
keyValues?.count ?? 0 > 0
+
+
string > string.lowercased()
+
+
let num: Int? = 0
+_ = num != nil && num > num?.byteSwapped
+
+
num > num!.byteSwapped
+
+
1    + 1 >   1     +    2
+
+
f(  i :   2) >   f (i: 3 )
+
+
1 >= 2
+
+
foo >= bar
+
+
prefixedFoo >= foo
+
+
foo.aProperty >= foo.anotherProperty
+
+
self.aProperty >= self.anotherProperty
+
+
"1 >= 1"
+
+
self.aProperty >= aProperty
+
+
lhs.aProperty >= rhs.aProperty
+
+
lhs.identifier >= rhs.identifier
+
+
i >= index
+
+
$0 >= 0
+
+
keyValues?.count ?? 0 >= 0
+
+
string >= string.lowercased()
+
+
let num: Int? = 0
+_ = num != nil && num >= num?.byteSwapped
+
+
num >= num!.byteSwapped
+
+
1    + 1 >=   1     +    2
+
+
f(  i :   2) >=   f (i: 3 )
+
+
1 < 2
+
+
foo < bar
+
+
prefixedFoo < foo
+
+
foo.aProperty < foo.anotherProperty
+
+
self.aProperty < self.anotherProperty
+
+
"1 < 1"
+
+
self.aProperty < aProperty
+
+
lhs.aProperty < rhs.aProperty
+
+
lhs.identifier < rhs.identifier
+
+
i < index
+
+
$0 < 0
+
+
keyValues?.count ?? 0 < 0
+
+
string < string.lowercased()
+
+
let num: Int? = 0
+_ = num != nil && num < num?.byteSwapped
+
+
num < num!.byteSwapped
+
+
1    + 1 <   1     +    2
+
+
f(  i :   2) <   f (i: 3 )
+
+
1 <= 2
+
+
foo <= bar
+
+
prefixedFoo <= foo
+
+
foo.aProperty <= foo.anotherProperty
+
+
self.aProperty <= self.anotherProperty
+
+
"1 <= 1"
+
+
self.aProperty <= aProperty
+
+
lhs.aProperty <= rhs.aProperty
+
+
lhs.identifier <= rhs.identifier
+
+
i <= index
+
+
$0 <= 0
+
+
keyValues?.count ?? 0 <= 0
+
+
string <= string.lowercased()
+
+
let num: Int? = 0
+_ = num != nil && num <= num?.byteSwapped
+
+
num <= num!.byteSwapped
+
+
1    + 1 <=   1     +    2
+
+
f(  i :   2) <=   f (i: 3 )
+
+
func evaluate(_ mode: CommandMode) -> Result<Options, CommandantError<CommandantError<()>>>
+
+
let array = Array<Array<Int>>()
+
+
guard Set(identifiers).count != identifiers.count else { return }
+
+
expect("foo") == "foo"
+
+
type(of: model).cachePrefix == cachePrefix
+
+
histogram[156].0 == 0x003B8D96 && histogram[156].1 == 1
+
+
[Wrapper(type: .three), Wrapper(type: .one)].sorted { "\($0.type)" > "\($1.type)"}
+
+
array.sorted { "\($0)" < "\($1)" }
+
+

Triggering Examples

+
↓1 == 1
+
+
↓foo == foo
+
+
↓foo.aProperty == foo.aProperty
+
+
↓self.aProperty == self.aProperty
+
+
↓$0 == $0
+
+
↓a?.b == a?.b
+
+
if (↓elem == elem) {}
+
+
XCTAssertTrue(↓s3 == s3)
+
+
if let tab = tabManager.selectedTab, ↓tab.webView == tab.webView
+
+
↓1    + 1 ==   1     +    1
+
+
 ↓f(  i :   2) ==   f (i: 
+ 2 )
+
+
↓1 != 1
+
+
↓foo != foo
+
+
↓foo.aProperty != foo.aProperty
+
+
↓self.aProperty != self.aProperty
+
+
↓$0 != $0
+
+
↓a?.b != a?.b
+
+
if (↓elem != elem) {}
+
+
XCTAssertTrue(↓s3 != s3)
+
+
if let tab = tabManager.selectedTab, ↓tab.webView != tab.webView
+
+
↓1    + 1 !=   1     +    1
+
+
 ↓f(  i :   2) !=   f (i: 
+ 2 )
+
+
↓1 === 1
+
+
↓foo === foo
+
+
↓foo.aProperty === foo.aProperty
+
+
↓self.aProperty === self.aProperty
+
+
↓$0 === $0
+
+
↓a?.b === a?.b
+
+
if (↓elem === elem) {}
+
+
XCTAssertTrue(↓s3 === s3)
+
+
if let tab = tabManager.selectedTab, ↓tab.webView === tab.webView
+
+
↓1    + 1 ===   1     +    1
+
+
 ↓f(  i :   2) ===   f (i: 
+ 2 )
+
+
↓1 !== 1
+
+
↓foo !== foo
+
+
↓foo.aProperty !== foo.aProperty
+
+
↓self.aProperty !== self.aProperty
+
+
↓$0 !== $0
+
+
↓a?.b !== a?.b
+
+
if (↓elem !== elem) {}
+
+
XCTAssertTrue(↓s3 !== s3)
+
+
if let tab = tabManager.selectedTab, ↓tab.webView !== tab.webView
+
+
↓1    + 1 !==   1     +    1
+
+
 ↓f(  i :   2) !==   f (i: 
+ 2 )
+
+
↓1 > 1
+
+
↓foo > foo
+
+
↓foo.aProperty > foo.aProperty
+
+
↓self.aProperty > self.aProperty
+
+
↓$0 > $0
+
+
↓a?.b > a?.b
+
+
if (↓elem > elem) {}
+
+
XCTAssertTrue(↓s3 > s3)
+
+
if let tab = tabManager.selectedTab, ↓tab.webView > tab.webView
+
+
↓1    + 1 >   1     +    1
+
+
 ↓f(  i :   2) >   f (i: 
+ 2 )
+
+
↓1 >= 1
+
+
↓foo >= foo
+
+
↓foo.aProperty >= foo.aProperty
+
+
↓self.aProperty >= self.aProperty
+
+
↓$0 >= $0
+
+
↓a?.b >= a?.b
+
+
if (↓elem >= elem) {}
+
+
XCTAssertTrue(↓s3 >= s3)
+
+
if let tab = tabManager.selectedTab, ↓tab.webView >= tab.webView
+
+
↓1    + 1 >=   1     +    1
+
+
 ↓f(  i :   2) >=   f (i: 
+ 2 )
+
+
↓1 < 1
+
+
↓foo < foo
+
+
↓foo.aProperty < foo.aProperty
+
+
↓self.aProperty < self.aProperty
+
+
↓$0 < $0
+
+
↓a?.b < a?.b
+
+
if (↓elem < elem) {}
+
+
XCTAssertTrue(↓s3 < s3)
+
+
if let tab = tabManager.selectedTab, ↓tab.webView < tab.webView
+
+
↓1    + 1 <   1     +    1
+
+
 ↓f(  i :   2) <   f (i: 
+ 2 )
+
+
↓1 <= 1
+
+
↓foo <= foo
+
+
↓foo.aProperty <= foo.aProperty
+
+
↓self.aProperty <= self.aProperty
+
+
↓$0 <= $0
+
+
↓a?.b <= a?.b
+
+
if (↓elem <= elem) {}
+
+
XCTAssertTrue(↓s3 <= s3)
+
+
if let tab = tabManager.selectedTab, ↓tab.webView <= tab.webView
+
+
↓1    + 1 <=   1     +    1
+
+
 ↓f(  i :   2) <=   f (i: 
+ 2 )
+
+
    return ↓lhs.foo == lhs.foo &&
+           lhs.bar == rhs.bar
+
+
    return lhs.foo == rhs.foo &&
+           ↓lhs.bar == lhs.bar
+
+ +
+
+ + +
+
+ + + diff --git a/identifier_name.html b/identifier_name.html new file mode 100644 index 000000000..3e8da37da --- /dev/null +++ b/identifier_name.html @@ -0,0 +1,582 @@ + + + + identifier_name Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Identifier Name

+ +

Identifier names should only contain alphanumeric characters and start with a lowercase character or should only contain capital letters. In an exception to the above, variable names may start with a capital letter when they are declared as static. Variable names should not be too long or too short.

+ +
    +
  • Identifier: identifier_name
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +min_length + + + + + + + + + + + + + + + +
    KeyValue
    +warning + +3 +
    +error + +2 +
    +
    +max_length + + + + + + + + + + + + + + + +
    KeyValue
    +warning + +40 +
    +error + +60 +
    +
    +excluded + +[“^id$”] +
    +allowed_symbols + +[] +
    +unallowed_symbols_severity + +error +
    +validates_start_with_lowercase + +error +
    +additional_operators + +[“!”, “%”, “&”, “*”, “+”, “-”, “.”, “/”, “<”, “=”, “>”, “?”, “^”, “|”, “~”] +
  • +
+

Non Triggering Examples

+
let myLet = 0
+
+
var myVar = 0
+
+
private let _myLet = 0
+
+
private func _myFunc() {}
+
+
fileprivate let _myLet = 0
+
+
fileprivate func _myFunc() {}
+
+
fileprivate func _myFunc() {}
+
+
class Abc { static let MyLet = 0 }
+
+
let URL: NSURL? = nil
+
+
let XMLString: String? = nil
+
+
override var i = 0
+
+
enum Foo { case myEnum }
+
+
func isOperator(name: String) -> Bool
+
+
func typeForKind(_ kind: SwiftDeclarationKind) -> String
+
+
func == (lhs: SyntaxToken, rhs: SyntaxToken) -> Bool
+
+
override func IsOperator(name: String) -> Bool
+
+
enum Foo { case `private` }
+
+
enum Foo { case value(String) }
+
+
f { $abc in }
+
+
class Foo {
+   static let Bar = 0
+}
+
+
class Foo {
+   static var Bar = 0
+}
+
+
//
+// additional_operators: ["!", "%", "&", "*", "+", "-", ".", "/", "<", "=", ">", "?", "^", "|", "~", "√"]
+//
+
+func √ (arg: Double) -> Double { arg }
+
+
+

Triggering Examples

+
class C { static let ↓_myLet = 0 }
+
+
class C { class let ↓MyLet = 0 }
+
+
class C { static func ↓MyFunc() {} }
+
+
class C { class func ↓MyFunc() {} }
+
+
private let ↓myLet_ = 0
+
+
let ↓myExtremelyVeryVeryVeryVeryVeryVeryLongLet = 0
+
+
var ↓myExtremelyVeryVeryVeryVeryVeryVeryLongVar = 0
+
+
private let ↓_myExtremelyVeryVeryVeryVeryVeryVeryLongLet = 0
+
+
let ↓i = 0
+
+
var ↓aa = 0
+
+
private let ↓_i = 0
+
+
if let ↓_x {}
+
+
guard var ↓x = x else {}
+
+
func myFunc(
+    _ ↓s: String,
+    i ↓j: Int,
+    _ goodName: Double,
+    name ↓n: String,
+    ↓x: Int,
+    abc: Double,
+    _: Double,
+    last _: Double
+) {}
+
+
let (↓a, abc) = (1, 1)
+
+
if let ↓i {}
+
+
for ↓i in [] {}
+
+
f { ↓x in }
+
+
f { ↓$x in }
+
+
f { (x abc: Int, _ ↓x: Int) in }
+
+
enum E {
+    case ↓c
+    case case1(Int)
+    case case2(↓a: Int)
+    case case3(_ ↓a: Int)
+}
+
+
class C {
+    var ↓x: Int {
+        get { 1 }
+        set(↓y) { x = y }
+    }
+}
+
+
func ↓√ (arg: Double) -> Double { arg }
+
+ +
+
+ + +
+
+ + + diff --git a/img/carat.png b/img/carat.png new file mode 100755 index 000000000..29d2f7fd4 Binary files /dev/null and b/img/carat.png differ diff --git a/img/dash.png b/img/dash.png new file mode 100755 index 000000000..6f694c7a0 Binary files /dev/null and b/img/dash.png differ diff --git a/img/gh.png b/img/gh.png new file mode 100755 index 000000000..628da97c7 Binary files /dev/null and b/img/gh.png differ diff --git a/img/spinner.gif b/img/spinner.gif new file mode 100644 index 000000000..e3038d0a4 Binary files /dev/null and b/img/spinner.gif differ diff --git a/implicit_getter.html b/implicit_getter.html new file mode 100644 index 000000000..a8dc05666 --- /dev/null +++ b/implicit_getter.html @@ -0,0 +1,599 @@ + + + + implicit_getter Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Implicit Getter

+ +

Computed read-only properties and subscripts should avoid using the get keyword.

+ +
    +
  • Identifier: implicit_getter
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class Foo {
+    var foo: Int {
+        get { return 3 }
+        set { _abc = newValue }
+    }
+}
+
+
class Foo {
+    var foo: Int {
+        return 20
+    }
+}
+
+
class Foo {
+    static var foo: Int {
+        return 20
+    }
+}
+
+
class Foo {
+    static var foo: Int {
+        get { return 3 }
+        set { _abc = newValue }
+    }
+}
+
+
class Foo {
+    var foo: Int {
+        get { _foo }
+        _modify { yield &_foo }
+    }
+}
+
+
class Foo {
+    var _foo: Int
+    var foo: Int {
+        @storageRestrictions(initializes: _foo)
+        init { _foo = newValue }
+        get { _foo }
+    }
+}
+
+
class Foo {
+    var foo: Int
+}
+
+
class Foo {
+    var foo: Int {
+        return getValueFromDisk()
+    }
+}
+
+
class Foo {
+    var foo: String {
+        return "get"
+    }
+}
+
+
protocol Foo {
+    var foo: Int { get }
+}
+
+
protocol Foo {
+    var foo: Int { get set }
+}
+
+
class Foo {
+    var foo: Int {
+        struct Bar {
+            var bar: Int {
+                get { return 1 }
+                set { _ = newValue }
+            }
+        }
+
+        return Bar().bar
+    }
+}
+
+
var _objCTaggedPointerBits: UInt {
+    @inline(__always) get { return 0 }
+}
+
+
var next: Int? {
+    mutating get {
+        defer { self.count += 1 }
+        return self.count
+    }
+}
+
+
extension Foo {
+    var bar: Bool {
+        get { _bar }
+        set { self._bar = newValue }
+    }
+}
+
+
extension Foo {
+    var bar: Bool {
+        get { _bar }
+        set(newValue) { self._bar = newValue }
+    }
+}
+
+
extension Float {
+    var clamped: Float {
+        set {
+            self = min(1, max(0, newValue))
+        }
+        get {
+            min(1, max(0, self))
+        }
+    }
+}
+
+
extension Reactive where Base: UITapGestureRecognizer {
+    var tapped: CocoaAction<Base>? {
+        get {
+            return associatedAction.withValue { $0.flatMap { $0.action } }
+        }
+        nonmutating set {
+            setAction(newValue)
+        }
+    }
+}
+
+
extension Test {
+    var foo: Bool {
+        get {
+            bar?.boolValue ?? true // Comment mentioning word set which triggers violation
+        }
+        set {
+            bar = NSNumber(value: newValue as Bool)
+        }
+    }
+}
+
+
class Foo {
+    subscript(i: Int) -> Int {
+        return 20
+    }
+}
+
+
class Foo {
+    subscript(i: Int) -> Int {
+        get { return 3 }
+        set { _abc = newValue }
+    }
+}
+
+
protocol Foo {
+    subscript(i: Int) -> Int { get }
+}
+
+
protocol Foo {
+    subscript(i: Int) -> Int { get set }
+}
+
+
class DatabaseEntity {
+    var isSynced: Bool {
+        get async {
+            await database.isEntitySynced(self)
+        }
+    }
+}
+
+
struct Test {
+    subscript(value: Int) -> Int {
+        get throws {
+            if value == 0 {
+                throw NSError()
+            } else {
+                return value
+            }
+        }
+    }
+}
+
+

Triggering Examples

+
class Foo {
+    var foo: Int {
+        ↓get {
+            return 20
+        }
+    }
+}
+
+
class Foo {
+    var foo: Int {
+        ↓get{ return 20 }
+    }
+}
+
+
class Foo {
+    static var foo: Int {
+        ↓get {
+            return 20
+        }
+    }
+}
+
+
var foo: Int {
+    ↓get { return 20 }
+}
+
+
class Foo {
+    @objc func bar() {}
+    var foo: Int {
+        ↓get {
+            return 20
+        }
+    }
+}
+
+
extension Foo {
+    var bar: Bool {
+        ↓get { _bar }
+    }
+}
+
+
class Foo {
+    subscript(i: Int) -> Int {
+        ↓get {
+            return 20
+        }
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/implicit_return.html b/implicit_return.html new file mode 100644 index 000000000..dd2e490c7 --- /dev/null +++ b/implicit_return.html @@ -0,0 +1,520 @@ + + + + implicit_return Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Implicit Return

+ +

Prefer implicit returns in closures, functions and getters

+ +
    +
  • Identifier: implicit_return
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +included + +[closure, function, getter, initializer, subscript] +
  • +
+

Non Triggering Examples

+
foo.map { $0 + 1 }
+
+
foo.map({ $0 + 1 })
+
+
foo.map { value in value + 1 }
+
+
[1, 2].first(where: {
+    true
+})
+
+
func foo() -> Int {
+    0
+}
+
+
class Foo {
+    func foo() -> Int { 0 }
+}
+
+
func fetch() -> Data? {
+    do {
+        return try loadData()
+    } catch {
+        return nil
+    }
+}
+
+
func f() -> Int {
+    let i = 4
+    return i
+}
+
+
func f() -> Int {
+    return 3
+    let i = 2
+}
+
+
func f() -> Int {
+    return g()
+    func g() -> Int { 4 }
+}
+
+
var foo: Bool { true }
+
+
class Foo {
+    var bar: Int {
+        get {
+            0
+        }
+    }
+}
+
+
class Foo {
+    static var bar: Int {
+        0
+    }
+}
+
+
class C {
+    let i: Int
+    init(i: Int) {
+        if i < 3 {
+            self.i = 1
+            return
+        }
+        self.i = 2
+    }
+}
+
+
class C {
+    init?() {
+        let i = 1
+        return nil
+    }
+}
+
+
class C {
+    subscript(i: Int) -> Int {
+        let res = i
+        return res
+    }
+}
+
+

Triggering Examples

+
foo.map { value in
+    ↓return value + 1
+}
+
+
foo.map {
+    ↓return $0 + 1
+}
+
+
foo.map({ ↓return $0 + 1})
+
+
[1, 2].first(where: {
+    ↓return true
+})
+
+
func foo() -> Int {
+    ↓return 0
+}
+
+
class Foo {
+    func foo() -> Int { ↓return 0 }
+}
+
+
func f() { ↓return }
+
+
var foo: Bool { ↓return true }
+
+
class Foo {
+    var bar: Int {
+        get {
+            ↓return 0
+        }
+    }
+}
+
+
class Foo {
+    static var bar: Int {
+        ↓return 0
+    }
+}
+
+
class C {
+    init() {
+        ↓return
+    }
+}
+
+
class C {
+    init?() {
+        ↓return nil
+    }
+}
+
+
class C {
+    subscript(i: Int) -> Int {
+        ↓return i
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/implicitly_unwrapped_optional.html b/implicitly_unwrapped_optional.html new file mode 100644 index 000000000..b305b1644 --- /dev/null +++ b/implicitly_unwrapped_optional.html @@ -0,0 +1,416 @@ + + + + implicitly_unwrapped_optional Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Implicitly Unwrapped Optional

+ +

Implicitly unwrapped optionals should be avoided when possible

+ +
    +
  • Identifier: implicitly_unwrapped_optional
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +mode + +all_except_iboutlets +
  • +
+

Non Triggering Examples

+
@IBOutlet private var label: UILabel!
+
+
@IBOutlet var label: UILabel!
+
+
@IBOutlet var label: [UILabel!]
+
+
if !boolean {}
+
+
let int: Int? = 42
+
+
let int: Int? = nil
+
+

Triggering Examples

+
let label: ↓UILabel!
+
+
let IBOutlet: ↓UILabel!
+
+
let labels: [↓UILabel!]
+
+
var ints: [↓Int!] = [42, nil, 42]
+
+
let label: ↓IBOutlet!
+
+
let int: ↓Int! = 42
+
+
let int: ↓Int! = nil
+
+
var int: ↓Int! = 42
+
+
let collection: AnyCollection<↓Int!>
+
+
func foo(int: ↓Int!) {}
+
+
class MyClass {
+    weak var bar: ↓SomeObject!
+}
+
+ +
+
+ + +
+
+ + + diff --git a/inclusive_language.html b/inclusive_language.html new file mode 100644 index 000000000..6adff3f4d --- /dev/null +++ b/inclusive_language.html @@ -0,0 +1,406 @@ + + + + inclusive_language Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Inclusive Language

+ +

Identifiers should use inclusive language that avoids discrimination against groups of people based on race, gender, or socioeconomic status.

+ +
    +
  • Identifier: inclusive_language
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let foo = "abc"
+
+
enum AllowList {
+    case foo, bar
+}
+
+
func updateAllowList(add: String) {}
+
+
enum WalletItemType {
+    case visa
+    case mastercard
+}
+
+
func chargeMasterCard(_ card: Card) {}
+
+

Triggering Examples

+
let ↓slave = "abc"
+
+
enum ↓BlackList {
+    case foo, bar
+}
+
+
func ↓updateWhiteList(add: String) {}
+
+
enum ListType {
+    case ↓whitelist
+    case ↓blacklist
+}
+
+
init(↓master: String, ↓slave: String) {}
+
+
final class FooBar {
+    func register<↓Master, ↓Slave>(one: Master, two: Slave) {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/indentation_width.html b/indentation_width.html new file mode 100644 index 000000000..3608df6a4 --- /dev/null +++ b/indentation_width.html @@ -0,0 +1,442 @@ + + + + indentation_width Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Indentation Width

+ +

Indent code using either one tab or the configured amount of spaces, unindent to match previous indentations. Don’t indent the first line.

+ +
    +
  • Identifier: indentation_width
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +indentation_width + +4 +
    +include_comments + +true +
    +include_compiler_directives + +true +
    +include_multiline_strings + +true +
  • +
+

Non Triggering Examples

+
firstLine
+secondLine
+
+
firstLine
+    secondLine
+
+
firstLine
+    secondLine
+        thirdLine
+
+        fourthLine
+
+
firstLine
+    secondLine
+        thirdLine
+    //test
+        fourthLine
+
+
firstLine
+    secondLine
+        thirdLine
+fourthLine
+
+

Triggering Examples

+
↓    firstLine
+
+
firstLine
+        secondLine
+
+
firstLine
+    secondLine
+
+↓         fourthLine
+
+
firstLine
+    secondLine
+        thirdLine
+↓ fourthLine
+
+ +
+
+ + +
+
+ + + diff --git a/index.html b/index.html new file mode 100644 index 000000000..afd554a38 --- /dev/null +++ b/index.html @@ -0,0 +1,1307 @@ + + + + SwiftLintCore Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

SwiftLint

+ +

A tool to enforce Swift style and conventions, loosely based on the now +archived GitHub Swift Style Guide. +SwiftLint enforces the style guide rules that are generally accepted by the +Swift community. These rules are well described in popular style guides like +Kodeco’s Swift Style Guide.

+ +

SwiftLint hooks into Clang and +SourceKit to use the +AST representation +of your source files for more accurate results.

+ +

Supported Swift Versions +Supported Platforms +Azure Build Status +Buildkite Build Status

+ +

+ +

This project adheres to the +Contributor Covenant Code of Conduct. +By participating, you are expected to uphold this code.

+ +
+

Switch Language: +中文 +한국어

+
+

Video Introduction

+ +

To get a high-level overview of SwiftLint, we encourage you to watch this +presentation recorded January 9th, 2017 by JP Simard (transcript provided):

+ +

Presentation

+

Installation

+

Swift Package Manager

+ +

SwiftLint can be used as a command plugin +or a build tool plugin.

+ +

Add

+
.package(url: "https://github.com/SimplyDanny/SwiftLintPlugins", from: "<version>")
+
+ +

to your Package.swift file to consume the latest release of SwiftLint +automatically or pin the dependency to a specific version:

+
.package(url: "https://github.com/SimplyDanny/SwiftLintPlugins", exact: "<version>")
+
+ +

Therein, replace <version> with the desired minimum or exact version.

+ +
+

[!NOTE] +Consuming the plugins directly from the SwiftLint repository comes +with several drawbacks. To avoid them and reduce the overhead imposed, it’s +highly recommended to consume the plugins from the dedicated +SwiftLintPlugins repository, +even though plugins from the SwiftLint repository are also absolutely +functional. If the plugins from SwiftLint are preferred, just use the URL +https://github.com/realm/SwiftLint in the package declarations above.

+ +

However, SwiftLintPlugins +facilitates plugin adoption massively. It lists some of the reasons that +drive the plugins as provided by SwiftLint itself very troublesome. Since +the plugin code and the releases are kept in sync, there is no difference +in functionality between the two, but you spare yourself a lot of time and +trouble using the dedicated plugins repository.

+ +

This document assumes you’re relying on SwiftLintPlugins.

+
+

Xcode Package Dependency

+ +

Use the following link to add SwiftLint as a Package Dependency to an Xcode +project:

+
https://github.com/SimplyDanny/SwiftLintPlugins
+
+

Homebrew

+
brew install swiftlint
+
+

CocoaPods

+ +

Add the following to your Podfile:

+
pod 'SwiftLint'
+
+ +

This will download the SwiftLint binaries and dependencies in Pods/ during +your next pod install execution and will allow you to invoke it via +${PODS_ROOT}/SwiftLint/swiftlint in your Script Build Phases.

+ +

Installing via Cocoapods also enables pinning to a specific version of +SwiftLint rather than simply the latest (which is the case with +Homebrew).

+ +

Note that this will add the SwiftLint binaries, its dependencies’ binaries, and +the Swift binary library distribution to the Pods/ directory, so checking in +this directory to SCM such as Git is discouraged.

+

Mint

+
mint install realm/SwiftLint
+
+

Bazel

+ +

Put this in your MODULE.bazel:

+
bazel_dep(name = "swiftlint", version = "0.52.4", repo_name = "SwiftLint")
+
+ +

Or put this in your WORKSPACE:

+ +
+ +WORKSPACE + +“`bzl +load(”@bazel_tools//tools/build_defs/repo:http.bzl", “http_archive”) + +http_archive( + name = “build_bazel_rules_apple”, + sha256 = “390841dd5f8a85fc25776684f4793d56e21b098dfd7243cd145b9831e6ef8be6”, + url = “https://github.com/bazelbuild/rules_apple/releases/download/2.4.1/rules_apple.2.4.1.tar.gz”, +) + +load( + “@build_bazel_rules_apple//apple:repositories.bzl”, + “apple_rules_dependencies”, +) + +apple_rules_dependencies() + +load( + “@build_bazel_rules_swift//swift:repositories.bzl”, + “swift_rules_dependencies”, +) + +swift_rules_dependencies() + +load( + “@build_bazel_rules_swift//swift:extras.bzl”, + “swift_rules_extra_dependencies”, +) + +swift_rules_extra_dependencies() + +http_archive( + name = “SwiftLint”, + sha256 = “c6ea58b9c72082cdc1ada4a2d48273ecc355896ed72204cedcc586b6ccb8aca6”, + url = “https://github.com/realm/SwiftLint/releases/download/0.52.4/bazel.tar.gz”, +) + +load(“@SwiftLint//bazel:repos.bzl”, “swiftlint_repos”) + +swiftlint_repos() + +load(“@SwiftLint//bazel:deps.bzl”, “swiftlint_deps”) + +swiftlint_deps() +“` + +
+ +

Then you can run SwiftLint in the current directory with this command:

+
bazel run -c opt @SwiftLint//:swiftlint
+
+

Pre-Built Package

+ +

Download SwiftLint.pkg from the +latest GitHub release and +run it.

+

From Source

+ +

Make sure the build tool Bazel and a +recent Swift toolchain are +installed and all tools are discoverable in your PATH.

+ +

To build SwiftLint, clone this repository and run make install.

+

Setup

+ +
+

[!IMPORTANT] +While it may seem intuitive to run SwiftLint before compiling Swift source +files to exit a build early when there are lint violations, it is important +to understand that SwiftLint is designed to analyze valid source code that +is compilable. Non-compiling code can very easily lead to unexpected and +confusing results, especially when executing with --fix/--autocorrect +command line arguments.

+
+

Build Tool Plugins

+ +

SwiftLint can be used as a build tool plugin for both +Swift Package projects +and Xcode projects.

+ +

The build tool plugin determines the SwiftLint working directory by locating +the topmost config file within the package/project directory. If a config file +is not found therein, the package/project directory is used as the working +directory.

+ +

The plugin throws an error when it is unable to resolve the SwiftLint working +directory. For example, this will occur in Xcode projects where the target’s +Swift files are not located within the project directory.

+ +

To maximize compatibility with the plugin, avoid project structures that require +the use of the --config option.

+

Swift Package Projects

+ +
+

[!NOTE] +Requires installing via Swift Package Manager.

+
+ +

Build tool plugins run when building each target. When a project has multiple +targets, the plugin must be added to the desired targets individually.

+ +

To do this, add the plugin to the target(s) to be linted as follows:

+
.target(
+    ...
+    plugins: [.plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLintPlugins")]
+),
+
+

Swift Package Command Plugin

+ +
+

[!NOTE] +Requires installing via Swift Package Manager.

+
+ +

The command plugin enables running SwiftLint from the command line as follows:

+
swift package plugin swiftlint
+
+

Xcode Projects

+ +
+

[!NOTE] +Requires installing via Xcode Package Dependency.

+
+ +

Build tool plugins run as a build phase of each target. When a project has +multiple targets, the plugin must be added to the desired targets individually.

+ +

To do this, add the SwiftLintBuildToolPlugin to the Run Build Tool Plug-ins +phase of the Build Phases for the target(s) to be linted.

+ +
+

[!TIP] +When using the plugin for the first time, be sure to trust and enable +it when prompted. If a macros build warning exists, select it to trust +and enable the macros as well.

+
+ +

For unattended use (e.g. on CI), package plugin and macro +validations can be disabled with either of the following:

+ +
    +
  • Using xcodebuild options:
  • +
+
  -skipPackagePluginValidation
+  -skipMacroValidation
+
+ +
    +
  • Setting Xcode defaults:
  • +
+
  defaults write com.apple.dt.Xcode IDESkipPackagePluginFingerprintValidatation -bool YES
+  defaults write com.apple.dt.Xcode IDESkipMacroFingerprintValidation -bool YES
+
+ +
+

[!IMPORTANT] +The unattended use options bypass Xcode’s validation dialogs +and implicitly trust all plugins and macros, which has security implications.

+
+

Unexpected Xcode Project Structures

+ +

Project structures where SwiftLint’s configuration file is located +outside of the package/project directory are not directly supported +by the build tool plugin. This is because it isn’t possible to pass +arguments to build tool plugins (e.g., passing the config file path).

+ +

If your project structure doesn’t work directly with the build tool +plugin, please consider one of the following options:

+ +
    +
  • To use a config file located outside the package/project directory, a config +file may be added to that directory specifying a parent config path to the +other config file, e.g., parent_config: path/to/.swiftlint.yml.
  • +
  • You can also consider the use of a +Run Script Build Phase in place of the build +tool plugin.
  • +
+

Xcode Run Script Build Phase

+ +
+

[!NOTE] +Based upon the installation method used, the shell command syntax in the +Run Script Build Phase may be different or additional configuration could +be required. Refer to the installation instructions for +more information.

+
+ +

If the build tool plugin does not work for your project setup or when +additional custom setup is required, SwiftLint can be added as a Run Script +Build Phase. This is useful when a project setup relies on the --config +SwiftLint option; or to lint all targets together in a single swiftlint +invocation. File inclusions and exclusions can be configured in the +.swiftlint.yml configuration.

+ +

To do this, add a custom script to a Run Script phase of the Build Phases +of the primary app target, after the Compile Sources phase. Use the +following script implementation:

+
if command -v swiftlint >/dev/null 2>&1
+then
+    swiftlint
+else
+    echo "warning: `swiftlint` command not found - See https://github.com/realm/SwiftLint#installation for installation instructions."
+fi
+
+ +

If you’re using the SwiftLintPlugin in a Swift package, +you may refer to the swiftlint executable in the +following way:

+
SWIFT_PACKAGE_DIR="${BUILD_DIR%Build/*}SourcePackages/artifacts"
+SWIFTLINT_CMD=$(ls "$SWIFT_PACKAGE_DIR"/swiftlintplugins/SwiftLintBinary/SwiftLintBinary.artifactbundle/swiftlint-*/bin/swiftlint | head -n 1)
+
+if test -f "$SWIFTLINT_CMD" 2>&1
+then
+    "$SWIFTLINT_CMD"
+else
+    echo "warning: `swiftlint` command not found - See https://github.com/realm/SwiftLint#installation for installation instructions."
+fi
+
+ +
+

[!NOTE] +The SWIFTLINT_CMD path uses the default Xcode configuration and has been +tested on Xcode 15/16. In case of another configuration (e.g. a custom +Swift package path), please adapt the values accordingly.

+ +

[!TIP] +Uncheck Based on dependency analysis to run swiftlint on all incremental +builds, suppressing the unspecified outputs warning.

+
+

Consideration for Xcode 15.0

+ +

Xcode 15 made a significant change by setting the default value of the +ENABLE_USER_SCRIPT_SANDBOXING build setting from NO to YES. +As a result, SwiftLint encounters an error related to missing file permissions, +which typically manifests as +error: Sandbox: swiftlint(19427) deny(1) file-read-data.

+ +

To resolve this issue, it is necessary to manually set the +ENABLE_USER_SCRIPT_SANDBOXING setting to NO for the specific target that +SwiftLint is being configured for.

+

Consideration for Apple Silicon

+ +

If you installed SwiftLint via Homebrew on Apple Silicon, you might experience +this warning:

+
warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint
+
+ +

That is because Homebrew on Apple Silicon installs the binaries into the +/opt/homebrew/bin folder by default. To instruct Xcode where to find +SwiftLint, you can either add /opt/homebrew/bin to the PATH environment +variable in your build phase:

+
if [[ "$(uname -m)" == arm64 ]]
+then
+    export PATH="/opt/homebrew/bin:$PATH"
+fi
+
+if command -v swiftlint >/dev/null 2>&1
+then
+    swiftlint
+else
+    echo "warning: `swiftlint` command not found - See https://github.com/realm/SwiftLint#installation for installation instructions."
+fi
+
+ +

or you can create a symbolic link in /usr/local/bin pointing to the actual +binary:

+
ln -s /opt/homebrew/bin/swiftlint /usr/local/bin/swiftlint
+
+

Additional Considerations

+ +

If you wish to fix violations as well, your script could run +swiftlint --fix && swiftlint instead of just swiftlint. This will mean +that all correctable violations are fixed while ensuring warnings show up in +your project for remaining violations.

+ +

If you’ve installed SwiftLint via CocoaPods the script should look like this:

+
"${PODS_ROOT}/SwiftLint/swiftlint"
+
+

Visual Studio Code

+ +

To integrate SwiftLint with Visual Studio Code, install the +vscode-swiftlint +extension from the marketplace.

+

Fastlane

+ +

You can use the official +swiftlint fastlane action +to run SwiftLint as part of your fastlane process.

+
swiftlint(
+    mode: :lint,                            # SwiftLint mode: :lint (default) or :autocorrect
+    executable: "Pods/SwiftLint/swiftlint", # The SwiftLint binary path (optional). Important if you've installed it via CocoaPods
+    path: "/path/to/lint",                  # Specify path to lint (optional)
+    output_file: "swiftlint.result.json",   # The path of the output file (optional)
+    reporter: "json",                       # The custom reporter to use (optional)
+    config_file: ".swiftlint-ci.yml",       # The path of the configuration file (optional)
+    files: [                                # List of files to process (optional)
+        "AppDelegate.swift",
+        "path/to/project/Model.swift"
+    ],
+    ignore_exit_status: true,               # Allow fastlane to continue even if SwiftLint returns a non-zero exit status (Default: false)
+    quiet: true,                            # Don't print status logs like 'Linting ' & 'Done linting' (Default: false)
+    strict: true                            # Fail on warnings? (Default: false)
+)
+
+

Docker

+ +

SwiftLint is also available as a Docker image using +Ubuntu. So just the first time you need to pull the docker image using the +next command:

+
docker pull ghcr.io/realm/swiftlint:latest
+
+ +

Then following times, you just run swiftlint inside of the docker like:

+
docker run -it -v `pwd`:`pwd` -w `pwd` ghcr.io/realm/swiftlint:latest
+
+ +

This will execute swiftlint in the folder where you are right now (pwd), +showing an output like:

+
$ docker run -it -v `pwd`:`pwd` -w `pwd` ghcr.io/realm/swiftlint:latest
+Linting Swift files in current working directory
+Linting 'RuleDocumentation.swift' (1/490)
+...
+Linting 'YamlSwiftLintTests.swift' (490/490)
+Done linting! Found 0 violations, 0 serious in 490 files.
+
+ +

Here you have more documentation about the usage of +Docker Images.

+

Command Line Usage

+
$ swiftlint help
+OVERVIEW: A tool to enforce Swift style and conventions.
+
+USAGE: swiftlint <subcommand>
+
+OPTIONS:
+  --version               Show the version.
+  -h, --help              Show help information.
+
+SUBCOMMANDS:
+  analyze                 Run analysis rules
+  docs                    Open SwiftLint documentation website in the default web browser
+  generate-docs           Generates markdown documentation for selected group of rules
+  lint (default)          Print lint warnings and errors
+  baseline                Operations on existing baselines
+  reporters               Display the list of reporters and their identifiers
+  rules                   Display the list of rules and their identifiers
+  version                 Display the current version of SwiftLint
+
+  See 'swiftlint help <subcommand>' for detailed help.
+
+ +

Run swiftlint in the directory containing the Swift files to lint. Directories +will be searched recursively.

+ +

To specify a list of files when using lint or analyze +(like the list of files modified by Xcode specified by the +ExtraBuildPhase Xcode +plugin, or modified files in the working tree based on git ls-files -m), you +can do so by passing the option --use-script-input-files and setting the +following instance variables: SCRIPT_INPUT_FILE_COUNT +and SCRIPT_INPUT_FILE_0, SCRIPT_INPUT_FILE_1, …, +SCRIPT_INPUT_FILE_{SCRIPT_INPUT_FILE_COUNT - 1}. +Similarly, files can be read from file lists by passing +the option --use-script-input-file-lists and setting the +following instance variables: SCRIPT_INPUT_FILE_LIST_COUNT +and SCRIPT_INPUT_FILE_LIST_0, SCRIPT_INPUT_FILE_LIST_1, …, +SCRIPT_INPUT_FILE_LIST_{SCRIPT_INPUT_FILE_LIST_COUNT - 1}.

+ +

These are same environment variables set for input files to +custom Xcode script phases.

+

Working With Multiple Swift Versions

+ +

SwiftLint hooks into SourceKit so it continues working even as Swift evolves!

+ +

This also keeps SwiftLint lean, as it doesn’t need to ship with a full Swift +compiler, it just communicates with the official one you already have installed +on your machine.

+ +

You should always run SwiftLint with the same toolchain you use to compile your +code.

+ +

You may want to override SwiftLint’s default Swift toolchain if you have +multiple toolchains or Xcodes installed.

+ +

Here’s the order in which SwiftLint determines which Swift toolchain to use:

+ +
    +
  • $XCODE_DEFAULT_TOOLCHAIN_OVERRIDE
  • +
  • $TOOLCHAIN_DIR or $TOOLCHAINS
  • +
  • xcrun -find swift
  • +
  • /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
  • +
  • /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
  • +
  • ~/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
  • +
  • ~/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
  • +
+ +

sourcekitd.framework is expected to be found in the usr/lib/ subdirectory of +the value passed in the paths above.

+ +

You may also set the TOOLCHAINS environment variable to the reverse-DNS +notation that identifies a Swift toolchain version:

+
TOOLCHAINS=com.apple.dt.toolchain.Swift_2_3 swiftlint --fix
+
+ +

On Linux, SourceKit is expected to be located in +/usr/lib/libsourcekitdInProc.so or specified by the LINUX_SOURCEKIT_LIB_PATH +environment variable.

+

Git pre-commit Hook

+ +

SwiftLint can be run as a pre-commit hook. +Once installed, add this to the +.pre-commit-config.yaml in the root of your repository:

+
repos:
+  - repo: https://github.com/realm/SwiftLint
+    rev: 0.57.1
+    hooks:
+      - id: swiftlint
+
+ +

Adjust rev to the SwiftLint version of your choice. pre-commit autoupdate +can be used to update to the current version.

+ +

SwiftLint can be configured using entry to apply fixes and fail on errors:

+
-   repo: https://github.com/realm/SwiftLint
+    rev: 0.57.1
+    hooks:
+    -   id: swiftlint
+        entry: swiftlint --fix --strict
+
+

Rules

+ +

Over 200 rules are included in SwiftLint and the Swift community (that’s you!) +continues to contribute more over time. +Pull requests +are encouraged.

+ +

You can find an updated list of rules and more information about them +here.

+ +

You can also check the +Source/SwiftLintBuiltInRules/Rules +directory to see their implementation.

+

Opt-In Rules

+ +

opt_in_rules are disabled by default (i.e., you have to explicitly enable them +in your configuration file).

+ +

Guidelines on when to mark a rule as opt-in:

+ +
    +
  • A rule that can have many false positives (e.g. empty_count)
  • +
  • A rule that is too slow
  • +
  • A rule that is not general consensus or is only useful in some cases +(e.g. force_unwrapping)
  • +
+

Disable rules in code

+ +

Rules can be disabled with a comment inside a source file with the following +format:

+ +

// swiftlint:disable <rule1> [<rule2> <rule3>...]

+ +

The rules will be disabled until the end of the file or until the linter sees a +matching enable comment:

+ +

// swiftlint:enable <rule1> [<rule2> <rule3>...]

+ +

For example:

+
// swiftlint:disable colon
+let noWarning :String = "" // No warning about colons immediately after variable names!
+// swiftlint:enable colon
+let hasWarning :String = "" // Warning generated about colons immediately after variable names
+
+ +

Including the all keyword will disable all rules until the linter sees a +matching enable comment:

+ +

// swiftlint:disable all +// swiftlint:enable all

+ +

For example:

+
// swiftlint:disable all
+let noWarning :String = "" // No warning about colons immediately after variable names!
+let i = "" // Also no warning about short identifier names
+// swiftlint:enable all
+let hasWarning :String = "" // Warning generated about colons immediately after variable names
+let y = "" // Warning generated about short identifier names
+
+ +

It’s also possible to modify a disable or enable command by appending +:previous, :this or :next for only applying the command to the previous, +this (current) or next line respectively.

+ +

For example:

+
// swiftlint:disable:next force_cast
+let noWarning = NSNumber() as! Int
+let hasWarning = NSNumber() as! Int
+let noWarning2 = NSNumber() as! Int // swiftlint:disable:this force_cast
+let noWarning3 = NSNumber() as! Int
+// swiftlint:disable:previous force_cast
+
+ +

Run swiftlint rules to print a list of all available rules and their +identifiers.

+

Configuration

+ +

Configure SwiftLint by adding a .swiftlint.yml file from the directory you’ll +run SwiftLint from. The following parameters can be configured:

+ +

Rule inclusion:

+ +
    +
  • disabled_rules: Disable rules from the default enabled set.
  • +
  • opt_in_rules: Enable rules that are not part of the default set. The +special all identifier will enable all opt in linter rules, except the ones +listed in disabled_rules.
  • +
  • only_rules: Only the rules specified in this list will be enabled. +Cannot be specified alongside disabled_rules or opt_in_rules.
  • +
  • analyzer_rules: This is an entirely separate list of rules that are only +run by the analyze command. All analyzer rules are opt-in, so this is the +only configurable rule list, there are no equivalents for disabled_rules +and only_rules. The special all identifier can also be used here to enable +all analyzer rules, except the ones listed in disabled_rules.
  • +
+
# By default, SwiftLint uses a set of sensible default rules you can adjust:
+disabled_rules: # rule identifiers turned on by default to exclude from running
+  - colon
+  - comma
+  - control_statement
+opt_in_rules: # some rules are turned off by default, so you need to opt-in
+  - empty_count # find all the available rules by running: `swiftlint rules`
+
+# Alternatively, specify all rules explicitly by uncommenting this option:
+# only_rules: # delete `disabled_rules` & `opt_in_rules` if using this
+#   - empty_parameters
+#   - vertical_whitespace
+
+analyzer_rules: # rules run by `swiftlint analyze`
+  - explicit_self
+
+# Case-sensitive paths to include during linting. Directory paths supplied on the
+# command line will be ignored.
+included: 
+  - Sources
+excluded: # case-sensitive paths to ignore during linting. Takes precedence over `included`
+  - Carthage
+  - Pods
+  - Sources/ExcludedFolder
+  - Sources/ExcludedFile.swift
+  - Sources/*/ExcludedFile.swift # exclude files with a wildcard
+
+# If true, SwiftLint will not fail if no lintable files are found.
+allow_zero_lintable_files: false
+
+# If true, SwiftLint will treat all warnings as errors.
+strict: false
+
+# If true, SwiftLint will treat all errors as warnings.
+lenient: false
+
+# The path to a baseline file, which will be used to filter out detected violations.
+baseline: Baseline.json
+
+# The path to save detected violations to as a new baseline.
+write_baseline: Baseline.json
+
+# If true, SwiftLint will check for updates after linting or analyzing.
+check_for_updates: true
+
+# configurable rules can be customized from this configuration file
+# binary rules can set their severity level
+force_cast: warning # implicitly
+force_try:
+  severity: warning # explicitly
+# rules that have both warning and error levels, can set just the warning level
+# implicitly
+line_length: 110
+# they can set both implicitly with an array
+type_body_length:
+  - 300 # warning
+  - 400 # error
+# or they can set both explicitly
+file_length:
+  warning: 500
+  error: 1200
+# naming rules can set warnings/errors for min_length and max_length
+# additionally they can set excluded names
+type_name:
+  min_length: 4 # only warning
+  max_length: # warning and error
+    warning: 40
+    error: 50
+  excluded: iPhone # excluded via string
+  allowed_symbols: ["_"] # these are allowed in type names
+identifier_name:
+  min_length: # only min_length
+    error: 4 # only error
+  excluded: # excluded via string array
+    - id
+    - URL
+    - GlobalAPIKey
+reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, codeclimate, junit, html, emoji, sonarqube, markdown, github-actions-logging, summary)
+
+ +

You can also use environment variables in your configuration file, +by using ${SOME_VARIABLE} in a string.

+

Defining Custom Rules

+ +

In addition to the rules that the main SwiftLint project ships with, SwiftLint +can also run two types of custom rules that you can define yourself in your own +projects:

+

1. Swift Custom Rules

+ +

These rules are written the same way as the Swift-based rules that ship with +SwiftLint so they’re fast, accurate, can leverage SwiftSyntax, can be unit +tested, and more.

+ +

Using these requires building SwiftLint with Bazel as described in +this video or its associated code in +github.com/jpsim/swiftlint-bazel-example.

+

2. Regex Custom Rules

+ +

You can define custom regex-based rules in your configuration file using the +following syntax:

+
custom_rules:
+  pirates_beat_ninjas: # rule identifier
+    included:
+      - ".*\\.swift" # regex that defines paths to include during linting. optional.
+    excluded:
+      - ".*Test\\.swift" # regex that defines paths to exclude during linting. optional
+    name: "Pirates Beat Ninjas" # rule name. optional.
+    regex: "([nN]inja)" # matching pattern
+    capture_group: 0 # number of regex capture group to highlight the rule violation at. optional.
+    match_kinds: # SyntaxKinds to match. optional.
+      - comment
+      - identifier
+    message: "Pirates are better than ninjas." # violation message. optional.
+    severity: error # violation severity. optional.
+  no_hiding_in_strings:
+    regex: "([nN]inja)"
+    match_kinds: string
+
+ +

This is what the output would look like:

+ +

+ +

It is important to note that the regular expression pattern is used with the +flags s and m enabled, that is . +matches newlines +and ^/$ +match the start and end of lines, +respectively. If you do not want to have . match newlines, for example, the +regex can be prepended by (?-s).

+ +

You can filter the matches by providing one or more match_kinds, which will +reject matches that include syntax kinds that are not present in this list. Here +are all the possible syntax kinds:

+ +
    +
  • argument
  • +
  • attribute.builtin
  • +
  • attribute.id
  • +
  • buildconfig.id
  • +
  • buildconfig.keyword
  • +
  • comment
  • +
  • comment.mark
  • +
  • comment.url
  • +
  • doccomment
  • +
  • doccomment.field
  • +
  • identifier
  • +
  • keyword
  • +
  • number
  • +
  • objectliteral
  • +
  • parameter
  • +
  • placeholder
  • +
  • string
  • +
  • string_interpolation_anchor
  • +
  • typeidentifier
  • +
+ +

All syntax kinds used in a snippet of Swift code can be extracted asking +SourceKitten. For example, +sourcekitten syntax --text "struct S {}" delivers

+ +
    +
  • source.lang.swift.syntaxtype.keyword for the struct keyword and
  • +
  • source.lang.swift.syntaxtype.identifier for its name S
  • +
+ +

which match to keyword and identifier in the above list.

+ +

If using custom rules in combination with only_rules, you must include the +literal string custom_rules in the only_rules list:

+
only_rules:
+  - custom_rules
+
+custom_rules:
+  no_hiding_in_strings:
+    regex: "([nN]inja)"
+    match_kinds: string
+
+ +

Unlike Swift custom rules, you can use official SwiftLint builds +(e.g. from Homebrew) to run regex custom rules.

+

Auto-correct

+ +

SwiftLint can automatically correct certain violations. Files on disk are +overwritten with a corrected version.

+ +

Please make sure to have backups of these files before running +swiftlint --fix, otherwise important data may be lost.

+ +

Standard linting is disabled while correcting because of the high likelihood of +violations (or their offsets) being incorrect after modifying a file while +applying corrections.

+

Analyze

+ +

The swiftlint analyze command can lint Swift files using the +full type-checked AST. The compiler log path containing the clean swiftc build +command invocation (incremental builds will fail) must be passed to analyze +via the --compiler-log-path flag. +e.g. --compiler-log-path /path/to/xcodebuild.log

+ +

This can be obtained by

+ +
    +
  1. Cleaning DerivedData (incremental builds won’t work with analyze)
  2. +
  3. Running xcodebuild -workspace {WORKSPACE}.xcworkspace -scheme {SCHEME} > xcodebuild.log
  4. +
  5. Running swiftlint analyze --compiler-log-path xcodebuild.log
  6. +
+ +

Analyzer rules tend to be considerably slower than lint rules.

+

Using Multiple Configuration Files

+ +

SwiftLint offers a variety of ways to include multiple configuration files. +Multiple configuration files get merged into one single configuration that is +then applied just as a single configuration file would get applied.

+ +

There are quite a lot of use cases where using multiple configuration files +could be helpful:

+ +

For instance, one could use a team-wide shared SwiftLint configuration while +allowing overrides in each project via a child configuration file.

+ +

Team-Wide Configuration:

+
disabled_rules:
+- force_cast
+
+ +

Project-Specific Configuration:

+
opt_in_rules:
+- force_cast
+
+

Child/Parent Configs (Locally)

+ +

You can specify a child_config and/or a parent_config reference within a +configuration file. These references should be local paths relative to the +folder of the configuration file they are specified in. This even works +recursively, as long as there are no cycles and no ambiguities.

+ +

A child config is treated as a refinement and thus has a higher priority, +while a parent config is considered a base with lower priority in case of +conflicts.

+ +

Here’s an example, assuming you have the following file structure:

+
ProjectRoot
+    |_ .swiftlint.yml
+    |_ .swiftlint_refinement.yml
+    |_ Base
+        |_ .swiftlint_base.yml
+
+ +

To include both the refinement and the base file, your .swiftlint.yml should +look like this:

+
child_config: .swiftlint_refinement.yml
+parent_config: Base/.swiftlint_base.yml
+
+ +

When merging parent and child configs, included and excluded configurations +are processed carefully to account for differences in the directory location +of the containing configuration files.

+

Child/Parent Configs (Remote)

+ +

Just as you can provide local child_config/parent_config references, +instead of referencing local paths, you can just put urls that lead to +configuration files. In order for SwiftLint to detect these remote references, +they must start with http:// or https://.

+ +

The referenced remote configuration files may even recursively reference other +remote configuration files, but aren’t allowed to include local references.

+ +

Using a remote reference, your .swiftlint.yml could look like this:

+
parent_config: https://myteamserver.com/our-base-swiftlint-config.yml
+
+ +

Every time you run SwiftLint and have an Internet connection, SwiftLint tries +to get a new version of every remote configuration that is referenced. If this +request times out, a cached version is used if available. If there is no cached +version available, SwiftLint fails – but no worries, a cached version should be +there once SwiftLint has run successfully at least once.

+ +

If needed, the timeouts for the remote configuration fetching can be specified +manually via the configuration file(s) using the +remote_timeout/remote_timeout_if_cached specifiers. These values default +to 2 seconds or 1 second, respectively.

+

Command Line

+ +

Instead of just providing one configuration file when running SwiftLint via the +command line, you can also pass a hierarchy, where the first configuration is +treated as a parent, while the last one is treated as the highest-priority +child.

+ +

A simple example including just two configuration files looks like this:

+ +

swiftlint --config .swiftlint.yml --config .swiftlint_child.yml

+

Nested Configurations

+ +

In addition to a main configuration (the .swiftlint.yml file in the root +folder), you can put other configuration files named .swiftlint.yml into the +directory structure that then get merged as a child config, but only with an +effect for those files that are within the same directory as the config or in a +deeper directory where there isn’t another configuration file. In other words: +Nested configurations don’t work recursively – there’s a maximum number of one +nested configuration per file that may be applied in addition to the main +configuration.

+ +

.swiftlint.yml files are only considered as a nested configuration if they +have not been used to build the main configuration already (e. g. by having +been referenced via something like child_config: Folder/.swiftlint.yml). +Also, parent_config/child_config specifications of nested configurations +are getting ignored because there’s no sense to that.

+ +

If one (or more) SwiftLint file(s) are explicitly specified via the --config +parameter, that configuration will be treated as an override, no matter whether +there exist other .swiftlint.yml files somewhere within the directory. +So if you want to use nested configurations, you can’t use the --config +parameter.

+

License

+ +

MIT licensed.

+

About

+ +

SwiftLint is utterly maintained by volunteers contributing to its success +entirely in their free time. As such, SwiftLint isn’t a commercial product +in any way.

+ +

Be kind to the people maintaining SwiftLint as a hobby and accept that their +time is limited. Support them by contributing to the project, reporting issues, +and helping others in the community.

+ +

Special thanks go to MacStadium for providing +physical Mac mini machines to run our performance tests.

+ +

+ +

We also thank Realm (now MongoDB) for their inital contributions and setup of +the project.

+ +
+
+ + +
+
+ + + diff --git a/invalid_swiftlint_command.html b/invalid_swiftlint_command.html new file mode 100644 index 000000000..f87fee9d5 --- /dev/null +++ b/invalid_swiftlint_command.html @@ -0,0 +1,414 @@ + + + + invalid_swiftlint_command Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Invalid SwiftLint Command

+ +

swiftlint command is invalid

+ +
    +
  • Identifier: invalid_swiftlint_command
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
// swiftlint:disable unused_import
+
+
// swiftlint:enable unused_import
+
+
// swiftlint:disable:next unused_import
+
+
// swiftlint:disable:previous unused_import
+
+
// swiftlint:disable:this unused_import
+
+
//swiftlint:disable:this unused_import
+
+

Triggering Examples

+
// ↓swiftlint:
+
+
// ↓swiftlint: 
+
+
// ↓swiftlint::
+
+
// ↓swiftlint:: 
+
+
// ↓swiftlint:disable
+
+
// ↓swiftlint:dissable unused_import
+
+
// ↓swiftlint:enaaaable unused_import
+
+
// ↓swiftlint:disable:nxt unused_import
+
+
// ↓swiftlint:enable:prevus unused_import
+
+
// ↓swiftlint:enable:ths unused_import
+
+
// ↓swiftlint:enable
+
+
// ↓swiftlint:enable:
+
+
// ↓swiftlint:enable: 
+
+
// ↓swiftlint:disable: unused_import
+
+
// s↓swiftlint:disable unused_import
+
+ +
+
+ + +
+
+ + + diff --git a/is_disjoint.html b/is_disjoint.html new file mode 100644 index 000000000..e5b10d499 --- /dev/null +++ b/is_disjoint.html @@ -0,0 +1,384 @@ + + + + is_disjoint Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Is Disjoint

+ +

Prefer using Set.isDisjoint(with:) over Set.intersection(_:).isEmpty

+ +
    +
  • Identifier: is_disjoint
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
_ = Set(syntaxKinds).isDisjoint(with: commentAndStringKindsSet)
+
+
let isObjc = !objcAttributes.isDisjoint(with: dictionary.enclosedSwiftAttributes)
+
+
_ = Set(syntaxKinds).intersection(commentAndStringKindsSet)
+
+
_ = !objcAttributes.intersection(dictionary.enclosedSwiftAttributes)
+
+

Triggering Examples

+
_ = Set(syntaxKinds).↓intersection(commentAndStringKindsSet).isEmpty
+
+
let isObjc = !objcAttributes.↓intersection(dictionary.enclosedSwiftAttributes).isEmpty
+
+ +
+
+ + +
+
+ + + diff --git a/joined_default_parameter.html b/joined_default_parameter.html new file mode 100644 index 000000000..8f6bc621b --- /dev/null +++ b/joined_default_parameter.html @@ -0,0 +1,387 @@ + + + + joined_default_parameter Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Joined Default Parameter

+ +

Discouraged explicit usage of the default separator

+ +
    +
  • Identifier: joined_default_parameter
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let foo = bar.joined()
+
+
let foo = bar.joined(separator: ",")
+
+
let foo = bar.joined(separator: toto)
+
+

Triggering Examples

+
let foo = bar.joined(↓separator: "")
+
+
let foo = bar.filter(toto)
+             .joined(↓separator: ""),
+
+
func foo() -> String {
+  return ["1", "2"].joined(↓separator: "")
+}
+
+ +
+
+ + +
+
+ + + diff --git a/js/jazzy.js b/js/jazzy.js new file mode 100755 index 000000000..198441660 --- /dev/null +++ b/js/jazzy.js @@ -0,0 +1,74 @@ +// Jazzy - https://github.com/realm/jazzy +// Copyright Realm Inc. +// SPDX-License-Identifier: MIT + +window.jazzy = {'docset': false} +if (typeof window.dash != 'undefined') { + document.documentElement.className += ' dash' + window.jazzy.docset = true +} +if (navigator.userAgent.match(/xcode/i)) { + document.documentElement.className += ' xcode' + window.jazzy.docset = true +} + +function toggleItem($link, $content) { + var animationDuration = 300; + $link.toggleClass('token-open'); + $content.slideToggle(animationDuration); +} + +function itemLinkToContent($link) { + return $link.parent().parent().next(); +} + +// On doc load + hash-change, open any targetted item +function openCurrentItemIfClosed() { + if (window.jazzy.docset) { + return; + } + var $link = $(`a[name="${location.hash.substring(1)}"]`).nextAll('.token'); + $content = itemLinkToContent($link); + if ($content.is(':hidden')) { + toggleItem($link, $content); + } +} + +$(openCurrentItemIfClosed); +$(window).on('hashchange', openCurrentItemIfClosed); + +// On item link ('token') click, toggle its discussion +$('.token').on('click', function(event) { + if (window.jazzy.docset) { + return; + } + var $link = $(this); + toggleItem($link, itemLinkToContent($link)); + + // Keeps the document from jumping to the hash. + var href = $link.attr('href'); + if (history.pushState) { + history.pushState({}, '', href); + } else { + location.hash = href; + } + event.preventDefault(); +}); + +// Clicks on links to the current, closed, item need to open the item +$("a:not('.token')").on('click', function() { + if (location == this.href) { + openCurrentItemIfClosed(); + } +}); + +// KaTeX rendering +if ("katex" in window) { + $($('.math').each( (_, element) => { + katex.render(element.textContent, element, { + displayMode: $(element).hasClass('m-block'), + throwOnError: false, + trust: true + }); + })) +} diff --git a/js/jazzy.search.js b/js/jazzy.search.js new file mode 100644 index 000000000..359cdbb8b --- /dev/null +++ b/js/jazzy.search.js @@ -0,0 +1,74 @@ +// Jazzy - https://github.com/realm/jazzy +// Copyright Realm Inc. +// SPDX-License-Identifier: MIT + +$(function(){ + var $typeahead = $('[data-typeahead]'); + var $form = $typeahead.parents('form'); + var searchURL = $form.attr('action'); + + function displayTemplate(result) { + return result.name; + } + + function suggestionTemplate(result) { + var t = '
'; + t += '' + result.name + ''; + if (result.parent_name) { + t += '' + result.parent_name + ''; + } + t += '
'; + return t; + } + + $typeahead.one('focus', function() { + $form.addClass('loading'); + + $.getJSON(searchURL).then(function(searchData) { + const searchIndex = lunr(function() { + this.ref('url'); + this.field('name'); + this.field('abstract'); + for (const [url, doc] of Object.entries(searchData)) { + this.add({url: url, name: doc.name, abstract: doc.abstract}); + } + }); + + $typeahead.typeahead( + { + highlight: true, + minLength: 3, + autoselect: true + }, + { + limit: 10, + display: displayTemplate, + templates: { suggestion: suggestionTemplate }, + source: function(query, sync) { + const lcSearch = query.toLowerCase(); + const results = searchIndex.query(function(q) { + q.term(lcSearch, { boost: 100 }); + q.term(lcSearch, { + boost: 10, + wildcard: lunr.Query.wildcard.TRAILING + }); + }).map(function(result) { + var doc = searchData[result.ref]; + doc.url = result.ref; + return doc; + }); + sync(results); + } + } + ); + $form.removeClass('loading'); + $typeahead.trigger('focus'); + }); + }); + + var baseURL = searchURL.slice(0, -"search.json".length); + + $typeahead.on('typeahead:select', function(e, result) { + window.location = baseURL + result.url; + }); +}); diff --git a/js/jquery.min.js b/js/jquery.min.js new file mode 100644 index 000000000..7f37b5d99 --- /dev/null +++ b/js/jquery.min.js @@ -0,0 +1,2 @@ +/*! jQuery v3.7.1 | (c) OpenJS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(ie,e){"use strict";var oe=[],r=Object.getPrototypeOf,ae=oe.slice,g=oe.flat?function(e){return oe.flat.call(e)}:function(e){return oe.concat.apply([],e)},s=oe.push,se=oe.indexOf,n={},i=n.toString,ue=n.hasOwnProperty,o=ue.toString,a=o.call(Object),le={},v=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},y=function(e){return null!=e&&e===e.window},C=ie.document,u={type:!0,src:!0,nonce:!0,noModule:!0};function m(e,t,n){var r,i,o=(n=n||C).createElement("script");if(o.text=e,t)for(r in u)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[i.call(e)]||"object":typeof e}var t="3.7.1",l=/HTML$/i,ce=function(e,t){return new ce.fn.init(e,t)};function c(e){var t=!!e&&"length"in e&&e.length,n=x(e);return!v(e)&&!y(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+ge+")"+ge+"*"),x=new RegExp(ge+"|>"),j=new RegExp(g),A=new RegExp("^"+t+"$"),D={ID:new RegExp("^#("+t+")"),CLASS:new RegExp("^\\.("+t+")"),TAG:new RegExp("^("+t+"|[*])"),ATTR:new RegExp("^"+p),PSEUDO:new RegExp("^"+g),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ge+"*(even|odd|(([+-]|)(\\d*)n|)"+ge+"*(?:([+-]|)"+ge+"*(\\d+)|))"+ge+"*\\)|)","i"),bool:new RegExp("^(?:"+f+")$","i"),needsContext:new RegExp("^"+ge+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ge+"*((?:-\\d)?\\d*)"+ge+"*\\)|)(?=[^-]|$)","i")},N=/^(?:input|select|textarea|button)$/i,q=/^h\d$/i,L=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,H=/[+~]/,O=new RegExp("\\\\[\\da-fA-F]{1,6}"+ge+"?|\\\\([^\\r\\n\\f])","g"),P=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},M=function(){V()},R=J(function(e){return!0===e.disabled&&fe(e,"fieldset")},{dir:"parentNode",next:"legend"});try{k.apply(oe=ae.call(ye.childNodes),ye.childNodes),oe[ye.childNodes.length].nodeType}catch(e){k={apply:function(e,t){me.apply(e,ae.call(t))},call:function(e){me.apply(e,ae.call(arguments,1))}}}function I(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(V(e),e=e||T,C)){if(11!==p&&(u=L.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return k.call(n,a),n}else if(f&&(a=f.getElementById(i))&&I.contains(e,a)&&a.id===i)return k.call(n,a),n}else{if(u[2])return k.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&e.getElementsByClassName)return k.apply(n,e.getElementsByClassName(i)),n}if(!(h[t+" "]||d&&d.test(t))){if(c=t,f=e,1===p&&(x.test(t)||m.test(t))){(f=H.test(t)&&U(e.parentNode)||e)==e&&le.scope||((s=e.getAttribute("id"))?s=ce.escapeSelector(s):e.setAttribute("id",s=S)),o=(l=Y(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+Q(l[o]);c=l.join(",")}try{return k.apply(n,f.querySelectorAll(c)),n}catch(e){h(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return re(t.replace(ve,"$1"),e,n,r)}function W(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function F(e){return e[S]=!0,e}function $(e){var t=T.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function B(t){return function(e){return fe(e,"input")&&e.type===t}}function _(t){return function(e){return(fe(e,"input")||fe(e,"button"))&&e.type===t}}function z(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&R(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function X(a){return F(function(o){return o=+o,F(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function U(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function V(e){var t,n=e?e.ownerDocument||e:ye;return n!=T&&9===n.nodeType&&n.documentElement&&(r=(T=n).documentElement,C=!ce.isXMLDoc(T),i=r.matches||r.webkitMatchesSelector||r.msMatchesSelector,r.msMatchesSelector&&ye!=T&&(t=T.defaultView)&&t.top!==t&&t.addEventListener("unload",M),le.getById=$(function(e){return r.appendChild(e).id=ce.expando,!T.getElementsByName||!T.getElementsByName(ce.expando).length}),le.disconnectedMatch=$(function(e){return i.call(e,"*")}),le.scope=$(function(){return T.querySelectorAll(":scope")}),le.cssHas=$(function(){try{return T.querySelector(":has(*,:jqfake)"),!1}catch(e){return!0}}),le.getById?(b.filter.ID=function(e){var t=e.replace(O,P);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(O,P);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&C){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):t.querySelectorAll(e)},b.find.CLASS=function(e,t){if("undefined"!=typeof t.getElementsByClassName&&C)return t.getElementsByClassName(e)},d=[],$(function(e){var t;r.appendChild(e).innerHTML="",e.querySelectorAll("[selected]").length||d.push("\\["+ge+"*(?:value|"+f+")"),e.querySelectorAll("[id~="+S+"-]").length||d.push("~="),e.querySelectorAll("a#"+S+"+*").length||d.push(".#.+[+~]"),e.querySelectorAll(":checked").length||d.push(":checked"),(t=T.createElement("input")).setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),r.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&d.push(":enabled",":disabled"),(t=T.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||d.push("\\["+ge+"*name"+ge+"*="+ge+"*(?:''|\"\")")}),le.cssHas||d.push(":has"),d=d.length&&new RegExp(d.join("|")),l=function(e,t){if(e===t)return a=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!le.sortDetached&&t.compareDocumentPosition(e)===n?e===T||e.ownerDocument==ye&&I.contains(ye,e)?-1:t===T||t.ownerDocument==ye&&I.contains(ye,t)?1:o?se.call(o,e)-se.call(o,t):0:4&n?-1:1)}),T}for(e in I.matches=function(e,t){return I(e,null,null,t)},I.matchesSelector=function(e,t){if(V(e),C&&!h[t+" "]&&(!d||!d.test(t)))try{var n=i.call(e,t);if(n||le.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){h(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(O,P),e[3]=(e[3]||e[4]||e[5]||"").replace(O,P),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||I.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&I.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return D.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&j.test(n)&&(t=Y(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(O,P).toLowerCase();return"*"===e?function(){return!0}:function(e){return fe(e,t)}},CLASS:function(e){var t=s[e+" "];return t||(t=new RegExp("(^|"+ge+")"+e+"("+ge+"|$)"))&&s(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=I.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function T(e,n,r){return v(n)?ce.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?ce.grep(e,function(e){return e===n!==r}):"string"!=typeof n?ce.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(ce.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||k,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:S.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof ce?t[0]:t,ce.merge(this,ce.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:C,!0)),w.test(r[1])&&ce.isPlainObject(t))for(r in t)v(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=C.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):v(e)?void 0!==n.ready?n.ready(e):e(ce):ce.makeArray(e,this)}).prototype=ce.fn,k=ce(C);var E=/^(?:parents|prev(?:Until|All))/,j={children:!0,contents:!0,next:!0,prev:!0};function A(e,t){while((e=e[t])&&1!==e.nodeType);return e}ce.fn.extend({has:function(e){var t=ce(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,Ce=/^$|^module$|\/(?:java|ecma)script/i;xe=C.createDocumentFragment().appendChild(C.createElement("div")),(be=C.createElement("input")).setAttribute("type","radio"),be.setAttribute("checked","checked"),be.setAttribute("name","t"),xe.appendChild(be),le.checkClone=xe.cloneNode(!0).cloneNode(!0).lastChild.checked,xe.innerHTML="",le.noCloneChecked=!!xe.cloneNode(!0).lastChild.defaultValue,xe.innerHTML="",le.option=!!xe.lastChild;var ke={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function Se(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&fe(e,t)?ce.merge([e],n):n}function Ee(e,t){for(var n=0,r=e.length;n",""]);var je=/<|&#?\w+;/;function Ae(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function Re(e,t){return fe(e,"table")&&fe(11!==t.nodeType?t:t.firstChild,"tr")&&ce(e).children("tbody")[0]||e}function Ie(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function We(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Fe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(_.hasData(e)&&(s=_.get(e).events))for(i in _.remove(t,"handle events"),s)for(n=0,r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),C.head.appendChild(r[0])},abort:function(){i&&i()}}});var Jt,Kt=[],Zt=/(=)\?(?=&|$)|\?\?/;ce.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Kt.pop()||ce.expando+"_"+jt.guid++;return this[e]=!0,e}}),ce.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Zt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Zt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=v(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Zt,"$1"+r):!1!==e.jsonp&&(e.url+=(At.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||ce.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=ie[r],ie[r]=function(){o=arguments},n.always(function(){void 0===i?ce(ie).removeProp(r):ie[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Kt.push(r)),o&&v(i)&&i(o[0]),o=i=void 0}),"script"}),le.createHTMLDocument=((Jt=C.implementation.createHTMLDocument("").body).innerHTML="
",2===Jt.childNodes.length),ce.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(le.createHTMLDocument?((r=(t=C.implementation.createHTMLDocument("")).createElement("base")).href=C.location.href,t.head.appendChild(r)):t=C),o=!n&&[],(i=w.exec(e))?[t.createElement(i[1])]:(i=Ae([e],t,o),o&&o.length&&ce(o).remove(),ce.merge([],i.childNodes)));var r,i,o},ce.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(ce.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},ce.expr.pseudos.animated=function(t){return ce.grep(ce.timers,function(e){return t===e.elem}).length},ce.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=ce.css(e,"position"),c=ce(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=ce.css(e,"top"),u=ce.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),v(t)&&(t=t.call(e,n,ce.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},ce.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){ce.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===ce.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===ce.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=ce(e).offset()).top+=ce.css(e,"borderTopWidth",!0),i.left+=ce.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-ce.css(r,"marginTop",!0),left:t.left-i.left-ce.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===ce.css(e,"position"))e=e.offsetParent;return e||J})}}),ce.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;ce.fn[t]=function(e){return M(this,function(e,t,n){var r;if(y(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),ce.each(["top","left"],function(e,n){ce.cssHooks[n]=Ye(le.pixelPosition,function(e,t){if(t)return t=Ge(e,n),_e.test(t)?ce(e).position()[n]+"px":t})}),ce.each({Height:"height",Width:"width"},function(a,s){ce.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){ce.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return M(this,function(e,t,n){var r;return y(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?ce.css(e,t,i):ce.style(e,t,n,i)},s,n?e:void 0,n)}})}),ce.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){ce.fn[t]=function(e){return this.on(t,e)}}),ce.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.on("mouseenter",e).on("mouseleave",t||e)}}),ce.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){ce.fn[n]=function(e,t){return 00){var c=e.utils.clone(r)||{};c.position=[a,l],c.index=s.length,s.push(new e.Token(i.slice(a,o),c))}a=o+1}}return s},e.tokenizer.separator=/[\s\-]+/,e.Pipeline=function(){this._stack=[]},e.Pipeline.registeredFunctions=Object.create(null),e.Pipeline.registerFunction=function(t,r){r in this.registeredFunctions&&e.utils.warn("Overwriting existing registered function: "+r),t.label=r,e.Pipeline.registeredFunctions[t.label]=t},e.Pipeline.warnIfFunctionNotRegistered=function(t){var r=t.label&&t.label in this.registeredFunctions;r||e.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",t)},e.Pipeline.load=function(t){var r=new e.Pipeline;return t.forEach(function(t){var i=e.Pipeline.registeredFunctions[t];if(!i)throw new Error("Cannot load unregistered function: "+t);r.add(i)}),r},e.Pipeline.prototype.add=function(){var t=Array.prototype.slice.call(arguments);t.forEach(function(t){e.Pipeline.warnIfFunctionNotRegistered(t),this._stack.push(t)},this)},e.Pipeline.prototype.after=function(t,r){e.Pipeline.warnIfFunctionNotRegistered(r);var i=this._stack.indexOf(t);if(i==-1)throw new Error("Cannot find existingFn");i+=1,this._stack.splice(i,0,r)},e.Pipeline.prototype.before=function(t,r){e.Pipeline.warnIfFunctionNotRegistered(r);var i=this._stack.indexOf(t);if(i==-1)throw new Error("Cannot find existingFn");this._stack.splice(i,0,r)},e.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);t!=-1&&this._stack.splice(t,1)},e.Pipeline.prototype.run=function(e){for(var t=this._stack.length,r=0;r1&&(se&&(r=n),s!=e);)i=r-t,n=t+Math.floor(i/2),s=this.elements[2*n];return s==e?2*n:s>e?2*n:sa?l+=2:o==a&&(t+=r[u+1]*i[l+1],u+=2,l+=2);return t},e.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},e.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),t=1,r=0;t0){var o,a=s.str.charAt(0);a in s.node.edges?o=s.node.edges[a]:(o=new e.TokenSet,s.node.edges[a]=o),1==s.str.length&&(o["final"]=!0),n.push({node:o,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(0!=s.editsRemaining){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new e.TokenSet;s.node.edges["*"]=u}if(0==s.str.length&&(u["final"]=!0),n.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&n.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),1==s.str.length&&(s.node["final"]=!0),s.str.length>=1){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new e.TokenSet;s.node.edges["*"]=l}1==s.str.length&&(l["final"]=!0),n.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var c,h=s.str.charAt(0),d=s.str.charAt(1);d in s.node.edges?c=s.node.edges[d]:(c=new e.TokenSet,s.node.edges[d]=c),1==s.str.length&&(c["final"]=!0),n.push({node:c,editsRemaining:s.editsRemaining-1,str:h+s.str.slice(2)})}}}return i},e.TokenSet.fromString=function(t){for(var r=new e.TokenSet,i=r,n=0,s=t.length;n=e;t--){var r=this.uncheckedNodes[t],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r["char"]]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}},e.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},e.Index.prototype.search=function(t){return this.query(function(r){var i=new e.QueryParser(t,r);i.parse()})},e.Index.prototype.query=function(t){for(var r=new e.Query(this.fields),i=Object.create(null),n=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),u=0;u1?this._b=1:this._b=e},e.Builder.prototype.k1=function(e){this._k1=e},e.Builder.prototype.add=function(t,r){var i=t[this._ref],n=Object.keys(this._fields);this._documents[i]=r||{},this.documentCount+=1;for(var s=0;s=this.length)return e.QueryLexer.EOS;var t=this.str.charAt(this.pos);return this.pos+=1,t},e.QueryLexer.prototype.width=function(){return this.pos-this.start},e.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},e.QueryLexer.prototype.backup=function(){this.pos-=1},e.QueryLexer.prototype.acceptDigitRun=function(){var t,r;do t=this.next(),r=t.charCodeAt(0);while(r>47&&r<58);t!=e.QueryLexer.EOS&&this.backup()},e.QueryLexer.prototype.more=function(){return this.pos1&&(t.backup(),t.emit(e.QueryLexer.TERM)),t.ignore(),t.more())return e.QueryLexer.lexText},e.QueryLexer.lexEditDistance=function(t){return t.ignore(),t.acceptDigitRun(),t.emit(e.QueryLexer.EDIT_DISTANCE),e.QueryLexer.lexText},e.QueryLexer.lexBoost=function(t){return t.ignore(),t.acceptDigitRun(),t.emit(e.QueryLexer.BOOST),e.QueryLexer.lexText},e.QueryLexer.lexEOS=function(t){t.width()>0&&t.emit(e.QueryLexer.TERM)},e.QueryLexer.termSeparator=e.tokenizer.separator,e.QueryLexer.lexText=function(t){for(;;){var r=t.next();if(r==e.QueryLexer.EOS)return e.QueryLexer.lexEOS;if(92!=r.charCodeAt(0)){if(":"==r)return e.QueryLexer.lexField;if("~"==r)return t.backup(),t.width()>0&&t.emit(e.QueryLexer.TERM),e.QueryLexer.lexEditDistance;if("^"==r)return t.backup(),t.width()>0&&t.emit(e.QueryLexer.TERM),e.QueryLexer.lexBoost;if("+"==r&&1===t.width())return t.emit(e.QueryLexer.PRESENCE),e.QueryLexer.lexText;if("-"==r&&1===t.width())return t.emit(e.QueryLexer.PRESENCE),e.QueryLexer.lexText;if(r.match(e.QueryLexer.termSeparator))return e.QueryLexer.lexTerm}else t.escapeCharacter()}},e.QueryParser=function(t,r){this.lexer=new e.QueryLexer(t),this.query=r,this.currentClause={},this.lexemeIdx=0},e.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var t=e.QueryParser.parseClause;t;)t=t(this);return this.query},e.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},e.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},e.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},e.QueryParser.parseClause=function(t){var r=t.peekLexeme();if(void 0!=r)switch(r.type){case e.QueryLexer.PRESENCE:return e.QueryParser.parsePresence;case e.QueryLexer.FIELD:return e.QueryParser.parseField;case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var i="expected either a field or a term, found "+r.type;throw r.str.length>=1&&(i+=" with value '"+r.str+"'"),new e.QueryParseError(i,r.start,r.end)}},e.QueryParser.parsePresence=function(t){var r=t.consumeLexeme();if(void 0!=r){switch(r.str){case"-":t.currentClause.presence=e.Query.presence.PROHIBITED;break;case"+":t.currentClause.presence=e.Query.presence.REQUIRED;break;default:var i="unrecognised presence operator'"+r.str+"'";throw new e.QueryParseError(i,r.start,r.end)}var n=t.peekLexeme();if(void 0==n){var i="expecting term or field, found nothing";throw new e.QueryParseError(i,r.start,r.end)}switch(n.type){case e.QueryLexer.FIELD:return e.QueryParser.parseField;case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var i="expecting term or field, found '"+n.type+"'";throw new e.QueryParseError(i,n.start,n.end)}}},e.QueryParser.parseField=function(t){var r=t.consumeLexeme();if(void 0!=r){if(t.query.allFields.indexOf(r.str)==-1){var i=t.query.allFields.map(function(e){return"'"+e+"'"}).join(", "),n="unrecognised field '"+r.str+"', possible fields: "+i;throw new e.QueryParseError(n,r.start,r.end)}t.currentClause.fields=[r.str];var s=t.peekLexeme();if(void 0==s){var n="expecting term, found nothing";throw new e.QueryParseError(n,r.start,r.end)}switch(s.type){case e.QueryLexer.TERM:return e.QueryParser.parseTerm;default:var n="expecting term, found '"+s.type+"'";throw new e.QueryParseError(n,s.start,s.end)}}},e.QueryParser.parseTerm=function(t){var r=t.consumeLexeme();if(void 0!=r){t.currentClause.term=r.str.toLowerCase(),r.str.indexOf("*")!=-1&&(t.currentClause.usePipeline=!1);var i=t.peekLexeme();if(void 0==i)return void t.nextClause();switch(i.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;case e.QueryLexer.PRESENCE:return t.nextClause(),e.QueryParser.parsePresence;default:var n="Unexpected lexeme type '"+i.type+"'";throw new e.QueryParseError(n,i.start,i.end)}}},e.QueryParser.parseEditDistance=function(t){var r=t.consumeLexeme();if(void 0!=r){var i=parseInt(r.str,10);if(isNaN(i)){var n="edit distance must be numeric";throw new e.QueryParseError(n,r.start,r.end)}t.currentClause.editDistance=i;var s=t.peekLexeme();if(void 0==s)return void t.nextClause();switch(s.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;case e.QueryLexer.PRESENCE:return t.nextClause(),e.QueryParser.parsePresence;default:var n="Unexpected lexeme type '"+s.type+"'";throw new e.QueryParseError(n,s.start,s.end)}}},e.QueryParser.parseBoost=function(t){var r=t.consumeLexeme();if(void 0!=r){var i=parseInt(r.str,10);if(isNaN(i)){var n="boost must be numeric";throw new e.QueryParseError(n,r.start,r.end)}t.currentClause.boost=i;var s=t.peekLexeme();if(void 0==s)return void t.nextClause();switch(s.type){case e.QueryLexer.TERM:return t.nextClause(),e.QueryParser.parseTerm;case e.QueryLexer.FIELD:return t.nextClause(),e.QueryParser.parseField;case e.QueryLexer.EDIT_DISTANCE:return e.QueryParser.parseEditDistance;case e.QueryLexer.BOOST:return e.QueryParser.parseBoost;case e.QueryLexer.PRESENCE:return t.nextClause(),e.QueryParser.parsePresence;default:var n="Unexpected lexeme type '"+s.type+"'";throw new e.QueryParseError(n,s.start,s.end)}}},function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.lunr=t()}(this,function(){return e})}(); diff --git a/js/typeahead.jquery.js b/js/typeahead.jquery.js new file mode 100644 index 000000000..bcb734bef --- /dev/null +++ b/js/typeahead.jquery.js @@ -0,0 +1,1695 @@ +/*! + * typeahead.js 1.3.3 + * https://github.com/corejavascript/typeahead.js + * Copyright 2013-2024 Twitter, Inc. and other contributors; Licensed MIT + */ + + +(function(root, factory) { + if (typeof define === "function" && define.amd) { + define([ "jquery" ], function(a0) { + return factory(a0); + }); + } else if (typeof module === "object" && module.exports) { + module.exports = factory(require("jquery")); + } else { + factory(root["jQuery"]); + } +})(this, function($) { + var _ = function() { + "use strict"; + return { + isMsie: function() { + return /(msie|trident)/i.test(navigator.userAgent) ? navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2] : false; + }, + isBlankString: function(str) { + return !str || /^\s*$/.test(str); + }, + escapeRegExChars: function(str) { + return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); + }, + isString: function(obj) { + return typeof obj === "string"; + }, + isNumber: function(obj) { + return typeof obj === "number"; + }, + isArray: $.isArray, + isFunction: $.isFunction, + isObject: $.isPlainObject, + isUndefined: function(obj) { + return typeof obj === "undefined"; + }, + isElement: function(obj) { + return !!(obj && obj.nodeType === 1); + }, + isJQuery: function(obj) { + return obj instanceof $; + }, + toStr: function toStr(s) { + return _.isUndefined(s) || s === null ? "" : s + ""; + }, + bind: $.proxy, + each: function(collection, cb) { + $.each(collection, reverseArgs); + function reverseArgs(index, value) { + return cb(value, index); + } + }, + map: $.map, + filter: $.grep, + every: function(obj, test) { + var result = true; + if (!obj) { + return result; + } + $.each(obj, function(key, val) { + if (!(result = test.call(null, val, key, obj))) { + return false; + } + }); + return !!result; + }, + some: function(obj, test) { + var result = false; + if (!obj) { + return result; + } + $.each(obj, function(key, val) { + if (result = test.call(null, val, key, obj)) { + return false; + } + }); + return !!result; + }, + mixin: $.extend, + identity: function(x) { + return x; + }, + clone: function(obj) { + return $.extend(true, {}, obj); + }, + getIdGenerator: function() { + var counter = 0; + return function() { + return counter++; + }; + }, + templatify: function templatify(obj) { + return $.isFunction(obj) ? obj : template; + function template() { + return String(obj); + } + }, + defer: function(fn) { + setTimeout(fn, 0); + }, + debounce: function(func, wait, immediate) { + var timeout, result; + return function() { + var context = this, args = arguments, later, callNow; + later = function() { + timeout = null; + if (!immediate) { + result = func.apply(context, args); + } + }; + callNow = immediate && !timeout; + clearTimeout(timeout); + timeout = setTimeout(later, wait); + if (callNow) { + result = func.apply(context, args); + } + return result; + }; + }, + throttle: function(func, wait) { + var context, args, timeout, result, previous, later; + previous = 0; + later = function() { + previous = new Date(); + timeout = null; + result = func.apply(context, args); + }; + return function() { + var now = new Date(), remaining = wait - (now - previous); + context = this; + args = arguments; + if (remaining <= 0) { + clearTimeout(timeout); + timeout = null; + previous = now; + result = func.apply(context, args); + } else if (!timeout) { + timeout = setTimeout(later, remaining); + } + return result; + }; + }, + stringify: function(val) { + return _.isString(val) ? val : JSON.stringify(val); + }, + guid: function() { + function _p8(s) { + var p = (Math.random().toString(16) + "000000000").substr(2, 8); + return s ? "-" + p.substr(0, 4) + "-" + p.substr(4, 4) : p; + } + return "tt-" + _p8() + _p8(true) + _p8(true) + _p8(); + }, + noop: function() {} + }; + }(); + var WWW = function() { + "use strict"; + var defaultClassNames = { + wrapper: "twitter-typeahead", + input: "tt-input", + hint: "tt-hint", + menu: "tt-menu", + dataset: "tt-dataset", + suggestion: "tt-suggestion", + selectable: "tt-selectable", + empty: "tt-empty", + open: "tt-open", + cursor: "tt-cursor", + highlight: "tt-highlight" + }; + return build; + function build(o) { + var www, classes; + classes = _.mixin({}, defaultClassNames, o); + www = { + css: buildCss(), + classes: classes, + html: buildHtml(classes), + selectors: buildSelectors(classes) + }; + return { + css: www.css, + html: www.html, + classes: www.classes, + selectors: www.selectors, + mixin: function(o) { + _.mixin(o, www); + } + }; + } + function buildHtml(c) { + return { + wrapper: '', + menu: '
' + }; + } + function buildSelectors(classes) { + var selectors = {}; + _.each(classes, function(v, k) { + selectors[k] = "." + v; + }); + return selectors; + } + function buildCss() { + var css = { + wrapper: { + position: "relative", + display: "inline-block" + }, + hint: { + position: "absolute", + top: "0", + left: "0", + borderColor: "transparent", + boxShadow: "none", + opacity: "1" + }, + input: { + position: "relative", + verticalAlign: "top", + backgroundColor: "transparent" + }, + inputWithNoHint: { + position: "relative", + verticalAlign: "top" + }, + menu: { + position: "absolute", + top: "100%", + left: "0", + zIndex: "100", + display: "none" + }, + ltr: { + left: "0", + right: "auto" + }, + rtl: { + left: "auto", + right: " 0" + } + }; + if (_.isMsie()) { + _.mixin(css.input, { + backgroundImage: "url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)" + }); + } + return css; + } + }(); + var EventBus = function() { + "use strict"; + var namespace, deprecationMap; + namespace = "typeahead:"; + deprecationMap = { + render: "rendered", + cursorchange: "cursorchanged", + select: "selected", + autocomplete: "autocompleted" + }; + function EventBus(o) { + if (!o || !o.el) { + $.error("EventBus initialized without el"); + } + this.$el = $(o.el); + } + _.mixin(EventBus.prototype, { + _trigger: function(type, args) { + var $e = $.Event(namespace + type); + this.$el.trigger.call(this.$el, $e, args || []); + return $e; + }, + before: function(type) { + var args, $e; + args = [].slice.call(arguments, 1); + $e = this._trigger("before" + type, args); + return $e.isDefaultPrevented(); + }, + trigger: function(type) { + var deprecatedType; + this._trigger(type, [].slice.call(arguments, 1)); + if (deprecatedType = deprecationMap[type]) { + this._trigger(deprecatedType, [].slice.call(arguments, 1)); + } + } + }); + return EventBus; + }(); + var EventEmitter = function() { + "use strict"; + var splitter = /\s+/, nextTick = getNextTick(); + return { + onSync: onSync, + onAsync: onAsync, + off: off, + trigger: trigger + }; + function on(method, types, cb, context) { + var type; + if (!cb) { + return this; + } + types = types.split(splitter); + cb = context ? bindContext(cb, context) : cb; + this._callbacks = this._callbacks || {}; + while (type = types.shift()) { + this._callbacks[type] = this._callbacks[type] || { + sync: [], + async: [] + }; + this._callbacks[type][method].push(cb); + } + return this; + } + function onAsync(types, cb, context) { + return on.call(this, "async", types, cb, context); + } + function onSync(types, cb, context) { + return on.call(this, "sync", types, cb, context); + } + function off(types) { + var type; + if (!this._callbacks) { + return this; + } + types = types.split(splitter); + while (type = types.shift()) { + delete this._callbacks[type]; + } + return this; + } + function trigger(types) { + var type, callbacks, args, syncFlush, asyncFlush; + if (!this._callbacks) { + return this; + } + types = types.split(splitter); + args = [].slice.call(arguments, 1); + while ((type = types.shift()) && (callbacks = this._callbacks[type])) { + syncFlush = getFlush(callbacks.sync, this, [ type ].concat(args)); + asyncFlush = getFlush(callbacks.async, this, [ type ].concat(args)); + syncFlush() && nextTick(asyncFlush); + } + return this; + } + function getFlush(callbacks, context, args) { + return flush; + function flush() { + var cancelled; + for (var i = 0, len = callbacks.length; !cancelled && i < len; i += 1) { + cancelled = callbacks[i].apply(context, args) === false; + } + return !cancelled; + } + } + function getNextTick() { + var nextTickFn; + if (window.setImmediate) { + nextTickFn = function nextTickSetImmediate(fn) { + setImmediate(function() { + fn(); + }); + }; + } else { + nextTickFn = function nextTickSetTimeout(fn) { + setTimeout(function() { + fn(); + }, 0); + }; + } + return nextTickFn; + } + function bindContext(fn, context) { + return fn.bind ? fn.bind(context) : function() { + fn.apply(context, [].slice.call(arguments, 0)); + }; + } + }(); + var highlight = function(doc) { + "use strict"; + var defaults = { + node: null, + pattern: null, + tagName: "strong", + className: null, + wordsOnly: false, + caseSensitive: false, + diacriticInsensitive: false + }; + var accented = { + A: "[AaªÀ-Åà-åĀ-ąǍǎȀ-ȃȦȧᴬᵃḀḁẚẠ-ảₐ℀℁℻⒜Ⓐⓐ㍱-㍴㎀-㎄㎈㎉㎩-㎯㏂㏊㏟㏿Aa]", + B: "[BbᴮᵇḂ-ḇℬ⒝Ⓑⓑ㍴㎅-㎇㏃㏈㏔㏝Bb]", + C: "[CcÇçĆ-čᶜ℀ℂ℃℅℆ℭⅭⅽ⒞Ⓒⓒ㍶㎈㎉㎝㎠㎤㏄-㏇Cc]", + D: "[DdĎďDŽ-džDZ-dzᴰᵈḊ-ḓⅅⅆⅮⅾ⒟Ⓓⓓ㋏㍲㍷-㍹㎗㎭-㎯㏅㏈Dd]", + E: "[EeÈ-Ëè-ëĒ-ěȄ-ȇȨȩᴱᵉḘ-ḛẸ-ẽₑ℡ℯℰⅇ⒠Ⓔⓔ㉐㋍㋎Ee]", + F: "[FfᶠḞḟ℉ℱ℻⒡Ⓕⓕ㎊-㎌㎙ff-fflFf]", + G: "[GgĜ-ģǦǧǴǵᴳᵍḠḡℊ⒢Ⓖⓖ㋌㋍㎇㎍-㎏㎓㎬㏆㏉㏒㏿Gg]", + H: "[HhĤĥȞȟʰᴴḢ-ḫẖℋ-ℎ⒣Ⓗⓗ㋌㍱㎐-㎔㏊㏋㏗Hh]", + I: "[IiÌ-Ïì-ïĨ-İIJijǏǐȈ-ȋᴵᵢḬḭỈ-ịⁱℐℑℹⅈⅠ-ⅣⅥ-ⅨⅪⅫⅰ-ⅳⅵ-ⅸⅺⅻ⒤Ⓘⓘ㍺㏌㏕fiffiIi]", + J: "[JjIJ-ĵLJ-njǰʲᴶⅉ⒥ⒿⓙⱼJj]", + K: "[KkĶķǨǩᴷᵏḰ-ḵK⒦Ⓚⓚ㎄㎅㎉㎏㎑㎘㎞㎢㎦㎪㎸㎾㏀㏆㏍-㏏Kk]", + L: "[LlĹ-ŀLJ-ljˡᴸḶḷḺ-ḽℒℓ℡Ⅼⅼ⒧Ⓛⓛ㋏㎈㎉㏐-㏓㏕㏖㏿flfflLl]", + M: "[MmᴹᵐḾ-ṃ℠™ℳⅯⅿ⒨Ⓜⓜ㍷-㍹㎃㎆㎎㎒㎖㎙-㎨㎫㎳㎷㎹㎽㎿㏁㏂㏎㏐㏔-㏖㏘㏙㏞㏟Mm]", + N: "[NnÑñŃ-ʼnNJ-njǸǹᴺṄ-ṋⁿℕ№⒩Ⓝⓝ㎁㎋㎚㎱㎵㎻㏌㏑Nn]", + O: "[OoºÒ-Öò-öŌ-őƠơǑǒǪǫȌ-ȏȮȯᴼᵒỌ-ỏₒ℅№ℴ⒪Ⓞⓞ㍵㏇㏒㏖Oo]", + P: "[PpᴾᵖṔ-ṗℙ⒫Ⓟⓟ㉐㍱㍶㎀㎊㎩-㎬㎰㎴㎺㏋㏗-㏚Pp]", + Q: "[Qqℚ⒬Ⓠⓠ㏃Qq]", + R: "[RrŔ-řȐ-ȓʳᴿᵣṘ-ṛṞṟ₨ℛ-ℝ⒭Ⓡⓡ㋍㍴㎭-㎯㏚㏛Rr]", + S: "[SsŚ-šſȘșˢṠ-ṣ₨℁℠⒮Ⓢⓢ㎧㎨㎮-㎳㏛㏜stSs]", + T: "[TtŢ-ťȚțᵀᵗṪ-ṱẗ℡™⒯Ⓣⓣ㉐㋏㎔㏏ſtstTt]", + U: "[UuÙ-Üù-üŨ-ųƯưǓǔȔ-ȗᵁᵘᵤṲ-ṷỤ-ủ℆⒰Ⓤⓤ㍳㍺Uu]", + V: "[VvᵛᵥṼ-ṿⅣ-Ⅷⅳ-ⅷ⒱Ⓥⓥⱽ㋎㍵㎴-㎹㏜㏞Vv]", + W: "[WwŴŵʷᵂẀ-ẉẘ⒲Ⓦⓦ㎺-㎿㏝Ww]", + X: "[XxˣẊ-ẍₓ℻Ⅸ-Ⅻⅸ-ⅻ⒳Ⓧⓧ㏓Xx]", + Y: "[YyÝýÿŶ-ŸȲȳʸẎẏẙỲ-ỹ⒴Ⓨⓨ㏉Yy]", + Z: "[ZzŹ-žDZ-dzᶻẐ-ẕℤℨ⒵Ⓩⓩ㎐-㎔Zz]" + }; + return function hightlight(o) { + var regex; + o = _.mixin({}, defaults, o); + if (!o.node || !o.pattern) { + return; + } + o.pattern = _.isArray(o.pattern) ? o.pattern : [ o.pattern ]; + regex = getRegex(o.pattern, o.caseSensitive, o.wordsOnly, o.diacriticInsensitive); + traverse(o.node, hightlightTextNode); + function hightlightTextNode(textNode) { + var match, patternNode, wrapperNode; + if (match = regex.exec(textNode.data)) { + wrapperNode = doc.createElement(o.tagName); + o.className && (wrapperNode.className = o.className); + patternNode = textNode.splitText(match.index); + patternNode.splitText(match[0].length); + wrapperNode.appendChild(patternNode.cloneNode(true)); + textNode.parentNode.replaceChild(wrapperNode, patternNode); + } + return !!match; + } + function traverse(el, hightlightTextNode) { + var childNode, TEXT_NODE_TYPE = 3; + for (var i = 0; i < el.childNodes.length; i++) { + childNode = el.childNodes[i]; + if (childNode.nodeType === TEXT_NODE_TYPE) { + i += hightlightTextNode(childNode) ? 1 : 0; + } else { + traverse(childNode, hightlightTextNode); + } + } + } + }; + function accent_replacer(chr) { + return accented[chr.toUpperCase()] || chr; + } + function getRegex(patterns, caseSensitive, wordsOnly, diacriticInsensitive) { + var escapedPatterns = [], regexStr; + for (var i = 0, len = patterns.length; i < len; i++) { + var escapedWord = _.escapeRegExChars(patterns[i]); + if (diacriticInsensitive) { + escapedWord = escapedWord.replace(/\S/g, accent_replacer); + } + escapedPatterns.push(escapedWord); + } + regexStr = wordsOnly ? "\\b(" + escapedPatterns.join("|") + ")\\b" : "(" + escapedPatterns.join("|") + ")"; + return caseSensitive ? new RegExp(regexStr) : new RegExp(regexStr, "i"); + } + }(window.document); + var Input = function() { + "use strict"; + var specialKeyCodeMap; + specialKeyCodeMap = { + 9: "tab", + 27: "esc", + 37: "left", + 39: "right", + 13: "enter", + 38: "up", + 40: "down" + }; + function Input(o, www) { + var id; + o = o || {}; + if (!o.input) { + $.error("input is missing"); + } + www.mixin(this); + this.$hint = $(o.hint); + this.$input = $(o.input); + this.$menu = $(o.menu); + id = this.$input.attr("id") || _.guid(); + this.$menu.attr("id", id + "_listbox"); + this.$hint.attr({ + "aria-hidden": true + }); + this.$input.attr({ + "aria-owns": id + "_listbox", + "aria-controls": id + "_listbox", + role: "combobox", + "aria-autocomplete": "list", + "aria-expanded": false + }); + this.query = this.$input.val(); + this.queryWhenFocused = this.hasFocus() ? this.query : null; + this.$overflowHelper = buildOverflowHelper(this.$input); + this._checkLanguageDirection(); + if (this.$hint.length === 0) { + this.setHint = this.getHint = this.clearHint = this.clearHintIfInvalid = _.noop; + } + this.onSync("cursorchange", this._updateDescendent); + } + Input.normalizeQuery = function(str) { + return _.toStr(str).replace(/^\s*/g, "").replace(/\s{2,}/g, " "); + }; + _.mixin(Input.prototype, EventEmitter, { + _onBlur: function onBlur() { + this.resetInputValue(); + this.trigger("blurred"); + }, + _onFocus: function onFocus() { + this.queryWhenFocused = this.query; + this.trigger("focused"); + }, + _onKeydown: function onKeydown($e) { + var keyName = specialKeyCodeMap[$e.which || $e.keyCode]; + this._managePreventDefault(keyName, $e); + if (keyName && this._shouldTrigger(keyName, $e)) { + this.trigger(keyName + "Keyed", $e); + } + }, + _onInput: function onInput() { + this._setQuery(this.getInputValue()); + this.clearHintIfInvalid(); + this._checkLanguageDirection(); + }, + _managePreventDefault: function managePreventDefault(keyName, $e) { + var preventDefault; + switch (keyName) { + case "up": + case "down": + preventDefault = !withModifier($e); + break; + + default: + preventDefault = false; + } + preventDefault && $e.preventDefault(); + }, + _shouldTrigger: function shouldTrigger(keyName, $e) { + var trigger; + switch (keyName) { + case "tab": + trigger = !withModifier($e); + break; + + default: + trigger = true; + } + return trigger; + }, + _checkLanguageDirection: function checkLanguageDirection() { + var dir = (this.$input.css("direction") || "ltr").toLowerCase(); + if (this.dir !== dir) { + this.dir = dir; + this.$hint.attr("dir", dir); + this.trigger("langDirChanged", dir); + } + }, + _setQuery: function setQuery(val, silent) { + var areEquivalent, hasDifferentWhitespace; + areEquivalent = areQueriesEquivalent(val, this.query); + hasDifferentWhitespace = areEquivalent ? this.query.length !== val.length : false; + this.query = val; + if (!silent && !areEquivalent) { + this.trigger("queryChanged", this.query); + } else if (!silent && hasDifferentWhitespace) { + this.trigger("whitespaceChanged", this.query); + } + }, + _updateDescendent: function updateDescendent(event, id) { + this.$input.attr("aria-activedescendant", id); + }, + bind: function() { + var that = this, onBlur, onFocus, onKeydown, onInput; + onBlur = _.bind(this._onBlur, this); + onFocus = _.bind(this._onFocus, this); + onKeydown = _.bind(this._onKeydown, this); + onInput = _.bind(this._onInput, this); + this.$input.on("blur.tt", onBlur).on("focus.tt", onFocus).on("keydown.tt", onKeydown); + if (!_.isMsie() || _.isMsie() > 9) { + this.$input.on("input.tt", onInput); + } else { + this.$input.on("keydown.tt keypress.tt cut.tt paste.tt", function($e) { + if (specialKeyCodeMap[$e.which || $e.keyCode]) { + return; + } + _.defer(_.bind(that._onInput, that, $e)); + }); + } + return this; + }, + focus: function focus() { + this.$input.focus(); + }, + blur: function blur() { + this.$input.blur(); + }, + getLangDir: function getLangDir() { + return this.dir; + }, + getQuery: function getQuery() { + return this.query || ""; + }, + setQuery: function setQuery(val, silent) { + this.setInputValue(val); + this._setQuery(val, silent); + }, + hasQueryChangedSinceLastFocus: function hasQueryChangedSinceLastFocus() { + return this.query !== this.queryWhenFocused; + }, + getInputValue: function getInputValue() { + return this.$input.val(); + }, + setInputValue: function setInputValue(value) { + this.$input.val(value); + this.clearHintIfInvalid(); + this._checkLanguageDirection(); + }, + resetInputValue: function resetInputValue() { + this.setInputValue(this.query); + }, + getHint: function getHint() { + return this.$hint.val(); + }, + setHint: function setHint(value) { + this.$hint.val(value); + }, + clearHint: function clearHint() { + this.setHint(""); + }, + clearHintIfInvalid: function clearHintIfInvalid() { + var val, hint, valIsPrefixOfHint, isValid; + val = this.getInputValue(); + hint = this.getHint(); + valIsPrefixOfHint = val !== hint && hint.indexOf(val) === 0; + isValid = val !== "" && valIsPrefixOfHint && !this.hasOverflow(); + !isValid && this.clearHint(); + }, + hasFocus: function hasFocus() { + return this.$input.is(":focus"); + }, + hasOverflow: function hasOverflow() { + var constraint = this.$input.width() - 2; + this.$overflowHelper.text(this.getInputValue()); + return this.$overflowHelper.width() >= constraint; + }, + isCursorAtEnd: function() { + var valueLength, selectionStart, range; + valueLength = this.$input.val().length; + selectionStart = this.$input[0].selectionStart; + if (_.isNumber(selectionStart)) { + return selectionStart === valueLength; + } else if (document.selection) { + range = document.selection.createRange(); + range.moveStart("character", -valueLength); + return valueLength === range.text.length; + } + return true; + }, + destroy: function destroy() { + this.$hint.off(".tt"); + this.$input.off(".tt"); + this.$overflowHelper.remove(); + this.$hint = this.$input = this.$overflowHelper = $("
"); + }, + setAriaExpanded: function setAriaExpanded(value) { + this.$input.attr("aria-expanded", value); + } + }); + return Input; + function buildOverflowHelper($input) { + return $('').css({ + position: "absolute", + visibility: "hidden", + whiteSpace: "pre", + fontFamily: $input.css("font-family"), + fontSize: $input.css("font-size"), + fontStyle: $input.css("font-style"), + fontVariant: $input.css("font-variant"), + fontWeight: $input.css("font-weight"), + wordSpacing: $input.css("word-spacing"), + letterSpacing: $input.css("letter-spacing"), + textIndent: $input.css("text-indent"), + textRendering: $input.css("text-rendering"), + textTransform: $input.css("text-transform") + }).insertAfter($input); + } + function areQueriesEquivalent(a, b) { + return Input.normalizeQuery(a) === Input.normalizeQuery(b); + } + function withModifier($e) { + return $e.altKey || $e.ctrlKey || $e.metaKey || $e.shiftKey; + } + }(); + var Dataset = function() { + "use strict"; + var keys, nameGenerator; + keys = { + dataset: "tt-selectable-dataset", + val: "tt-selectable-display", + obj: "tt-selectable-object" + }; + nameGenerator = _.getIdGenerator(); + function Dataset(o, www) { + o = o || {}; + o.templates = o.templates || {}; + o.templates.notFound = o.templates.notFound || o.templates.empty; + if (!o.source) { + $.error("missing source"); + } + if (!o.node) { + $.error("missing node"); + } + if (o.name && !isValidName(o.name)) { + $.error("invalid dataset name: " + o.name); + } + www.mixin(this); + this.highlight = !!o.highlight; + this.name = _.toStr(o.name || nameGenerator()); + this.limit = o.limit || 5; + this.displayFn = getDisplayFn(o.display || o.displayKey); + this.templates = getTemplates(o.templates, this.displayFn); + this.source = o.source.__ttAdapter ? o.source.__ttAdapter() : o.source; + this.async = _.isUndefined(o.async) ? this.source.length > 2 : !!o.async; + this._resetLastSuggestion(); + this.$el = $(o.node).attr("role", "presentation").addClass(this.classes.dataset).addClass(this.classes.dataset + "-" + this.name); + } + Dataset.extractData = function extractData(el) { + var $el = $(el); + if ($el.data(keys.obj)) { + return { + dataset: $el.data(keys.dataset) || "", + val: $el.data(keys.val) || "", + obj: $el.data(keys.obj) || null + }; + } + return null; + }; + _.mixin(Dataset.prototype, EventEmitter, { + _overwrite: function overwrite(query, suggestions) { + suggestions = suggestions || []; + if (suggestions.length) { + this._renderSuggestions(query, suggestions); + } else if (this.async && this.templates.pending) { + this._renderPending(query); + } else if (!this.async && this.templates.notFound) { + this._renderNotFound(query); + } else { + this._empty(); + } + this.trigger("rendered", suggestions, false, this.name); + }, + _append: function append(query, suggestions) { + suggestions = suggestions || []; + if (suggestions.length && this.$lastSuggestion.length) { + this._appendSuggestions(query, suggestions); + } else if (suggestions.length) { + this._renderSuggestions(query, suggestions); + } else if (!this.$lastSuggestion.length && this.templates.notFound) { + this._renderNotFound(query); + } + this.trigger("rendered", suggestions, true, this.name); + }, + _renderSuggestions: function renderSuggestions(query, suggestions) { + var $fragment; + $fragment = this._getSuggestionsFragment(query, suggestions); + this.$lastSuggestion = $fragment.children().last(); + this.$el.html($fragment).prepend(this._getHeader(query, suggestions)).append(this._getFooter(query, suggestions)); + }, + _appendSuggestions: function appendSuggestions(query, suggestions) { + var $fragment, $lastSuggestion; + $fragment = this._getSuggestionsFragment(query, suggestions); + $lastSuggestion = $fragment.children().last(); + this.$lastSuggestion.after($fragment); + this.$lastSuggestion = $lastSuggestion; + }, + _renderPending: function renderPending(query) { + var template = this.templates.pending; + this._resetLastSuggestion(); + template && this.$el.html(template({ + query: query, + dataset: this.name + })); + }, + _renderNotFound: function renderNotFound(query) { + var template = this.templates.notFound; + this._resetLastSuggestion(); + template && this.$el.html(template({ + query: query, + dataset: this.name + })); + }, + _empty: function empty() { + this.$el.empty(); + this._resetLastSuggestion(); + }, + _getSuggestionsFragment: function getSuggestionsFragment(query, suggestions) { + var that = this, fragment; + fragment = document.createDocumentFragment(); + _.each(suggestions, function getSuggestionNode(suggestion) { + var $el, context; + context = that._injectQuery(query, suggestion); + $el = $(that.templates.suggestion(context)).data(keys.dataset, that.name).data(keys.obj, suggestion).data(keys.val, that.displayFn(suggestion)).addClass(that.classes.suggestion + " " + that.classes.selectable); + fragment.appendChild($el[0]); + }); + this.highlight && highlight({ + className: this.classes.highlight, + node: fragment, + pattern: query + }); + return $(fragment); + }, + _getFooter: function getFooter(query, suggestions) { + return this.templates.footer ? this.templates.footer({ + query: query, + suggestions: suggestions, + dataset: this.name + }) : null; + }, + _getHeader: function getHeader(query, suggestions) { + return this.templates.header ? this.templates.header({ + query: query, + suggestions: suggestions, + dataset: this.name + }) : null; + }, + _resetLastSuggestion: function resetLastSuggestion() { + this.$lastSuggestion = $(); + }, + _injectQuery: function injectQuery(query, obj) { + return _.isObject(obj) ? _.mixin({ + _query: query + }, obj) : obj; + }, + update: function update(query) { + var that = this, canceled = false, syncCalled = false, rendered = 0; + this.cancel(); + this.cancel = function cancel() { + canceled = true; + that.cancel = $.noop; + that.async && that.trigger("asyncCanceled", query, that.name); + }; + this.source(query, sync, async); + !syncCalled && sync([]); + function sync(suggestions) { + if (syncCalled) { + return; + } + syncCalled = true; + suggestions = (suggestions || []).slice(0, that.limit); + rendered = suggestions.length; + that._overwrite(query, suggestions); + if (rendered < that.limit && that.async) { + that.trigger("asyncRequested", query, that.name); + } + } + function async(suggestions) { + suggestions = suggestions || []; + if (!canceled && rendered < that.limit) { + that.cancel = $.noop; + var idx = Math.abs(rendered - that.limit); + rendered += idx; + that._append(query, suggestions.slice(0, idx)); + that.async && that.trigger("asyncReceived", query, that.name); + } + } + }, + cancel: $.noop, + clear: function clear() { + this._empty(); + this.cancel(); + this.trigger("cleared"); + }, + isEmpty: function isEmpty() { + return this.$el.is(":empty"); + }, + destroy: function destroy() { + this.$el = $("
"); + } + }); + return Dataset; + function getDisplayFn(display) { + display = display || _.stringify; + return _.isFunction(display) ? display : displayFn; + function displayFn(obj) { + return obj[display]; + } + } + function getTemplates(templates, displayFn) { + return { + notFound: templates.notFound && _.templatify(templates.notFound), + pending: templates.pending && _.templatify(templates.pending), + header: templates.header && _.templatify(templates.header), + footer: templates.footer && _.templatify(templates.footer), + suggestion: templates.suggestion ? userSuggestionTemplate : suggestionTemplate + }; + function userSuggestionTemplate(context) { + var template = templates.suggestion; + return $(template(context)).attr("id", _.guid()); + } + function suggestionTemplate(context) { + return $('
').attr("id", _.guid()).text(displayFn(context)); + } + } + function isValidName(str) { + return /^[_a-zA-Z0-9-]+$/.test(str); + } + }(); + var Menu = function() { + "use strict"; + function Menu(o, www) { + var that = this; + o = o || {}; + if (!o.node) { + $.error("node is required"); + } + www.mixin(this); + this.$node = $(o.node); + this.query = null; + this.datasets = _.map(o.datasets, initializeDataset); + function initializeDataset(oDataset) { + var node = that.$node.find(oDataset.node).first(); + oDataset.node = node.length ? node : $("
").appendTo(that.$node); + return new Dataset(oDataset, www); + } + } + _.mixin(Menu.prototype, EventEmitter, { + _onSelectableClick: function onSelectableClick($e) { + this.trigger("selectableClicked", $($e.currentTarget)); + }, + _onRendered: function onRendered(type, dataset, suggestions, async) { + this.$node.toggleClass(this.classes.empty, this._allDatasetsEmpty()); + this.trigger("datasetRendered", dataset, suggestions, async); + }, + _onCleared: function onCleared() { + this.$node.toggleClass(this.classes.empty, this._allDatasetsEmpty()); + this.trigger("datasetCleared"); + }, + _propagate: function propagate() { + this.trigger.apply(this, arguments); + }, + _allDatasetsEmpty: function allDatasetsEmpty() { + return _.every(this.datasets, _.bind(function isDatasetEmpty(dataset) { + var isEmpty = dataset.isEmpty(); + this.$node.attr("aria-expanded", !isEmpty); + return isEmpty; + }, this)); + }, + _getSelectables: function getSelectables() { + return this.$node.find(this.selectors.selectable); + }, + _removeCursor: function _removeCursor() { + var $selectable = this.getActiveSelectable(); + $selectable && $selectable.removeClass(this.classes.cursor); + }, + _ensureVisible: function ensureVisible($el) { + var elTop, elBottom, nodeScrollTop, nodeHeight; + elTop = $el.position().top; + elBottom = elTop + $el.outerHeight(true); + nodeScrollTop = this.$node.scrollTop(); + nodeHeight = this.$node.height() + parseInt(this.$node.css("paddingTop"), 10) + parseInt(this.$node.css("paddingBottom"), 10); + if (elTop < 0) { + this.$node.scrollTop(nodeScrollTop + elTop); + } else if (nodeHeight < elBottom) { + this.$node.scrollTop(nodeScrollTop + (elBottom - nodeHeight)); + } + }, + bind: function() { + var that = this, onSelectableClick; + onSelectableClick = _.bind(this._onSelectableClick, this); + this.$node.on("click.tt", this.selectors.selectable, onSelectableClick); + this.$node.on("mouseover", this.selectors.selectable, function() { + that.setCursor($(this)); + }); + this.$node.on("mouseleave", function() { + that._removeCursor(); + }); + _.each(this.datasets, function(dataset) { + dataset.onSync("asyncRequested", that._propagate, that).onSync("asyncCanceled", that._propagate, that).onSync("asyncReceived", that._propagate, that).onSync("rendered", that._onRendered, that).onSync("cleared", that._onCleared, that); + }); + return this; + }, + isOpen: function isOpen() { + return this.$node.hasClass(this.classes.open); + }, + open: function open() { + this.$node.scrollTop(0); + this.$node.addClass(this.classes.open); + }, + close: function close() { + this.$node.attr("aria-expanded", false); + this.$node.removeClass(this.classes.open); + this._removeCursor(); + }, + setLanguageDirection: function setLanguageDirection(dir) { + this.$node.attr("dir", dir); + }, + selectableRelativeToCursor: function selectableRelativeToCursor(delta) { + var $selectables, $oldCursor, oldIndex, newIndex; + $oldCursor = this.getActiveSelectable(); + $selectables = this._getSelectables(); + oldIndex = $oldCursor ? $selectables.index($oldCursor) : -1; + newIndex = oldIndex + delta; + newIndex = (newIndex + 1) % ($selectables.length + 1) - 1; + newIndex = newIndex < -1 ? $selectables.length - 1 : newIndex; + return newIndex === -1 ? null : $selectables.eq(newIndex); + }, + setCursor: function setCursor($selectable) { + this._removeCursor(); + if ($selectable = $selectable && $selectable.first()) { + $selectable.addClass(this.classes.cursor); + this._ensureVisible($selectable); + } + }, + getSelectableData: function getSelectableData($el) { + return $el && $el.length ? Dataset.extractData($el) : null; + }, + getActiveSelectable: function getActiveSelectable() { + var $selectable = this._getSelectables().filter(this.selectors.cursor).first(); + return $selectable.length ? $selectable : null; + }, + getTopSelectable: function getTopSelectable() { + var $selectable = this._getSelectables().first(); + return $selectable.length ? $selectable : null; + }, + update: function update(query) { + var isValidUpdate = query !== this.query; + if (isValidUpdate) { + this.query = query; + _.each(this.datasets, updateDataset); + } + return isValidUpdate; + function updateDataset(dataset) { + dataset.update(query); + } + }, + empty: function empty() { + _.each(this.datasets, clearDataset); + this.query = null; + this.$node.addClass(this.classes.empty); + function clearDataset(dataset) { + dataset.clear(); + } + }, + destroy: function destroy() { + this.$node.off(".tt"); + this.$node = $("
"); + _.each(this.datasets, destroyDataset); + function destroyDataset(dataset) { + dataset.destroy(); + } + } + }); + return Menu; + }(); + var Status = function() { + "use strict"; + function Status(options) { + this.$el = $("", { + role: "status", + "aria-live": "polite" + }).css({ + position: "absolute", + padding: "0", + border: "0", + height: "1px", + width: "1px", + "margin-bottom": "-1px", + "margin-right": "-1px", + overflow: "hidden", + clip: "rect(0 0 0 0)", + "white-space": "nowrap" + }); + options.$input.after(this.$el); + _.each(options.menu.datasets, _.bind(function(dataset) { + if (dataset.onSync) { + dataset.onSync("rendered", _.bind(this.update, this)); + dataset.onSync("cleared", _.bind(this.cleared, this)); + } + }, this)); + } + _.mixin(Status.prototype, { + update: function update(event, suggestions) { + var length = suggestions.length; + var words; + if (length === 1) { + words = { + result: "result", + is: "is" + }; + } else { + words = { + result: "results", + is: "are" + }; + } + this.$el.text(length + " " + words.result + " " + words.is + " available, use up and down arrow keys to navigate."); + }, + cleared: function() { + this.$el.text(""); + } + }); + return Status; + }(); + var DefaultMenu = function() { + "use strict"; + var s = Menu.prototype; + function DefaultMenu() { + Menu.apply(this, [].slice.call(arguments, 0)); + } + _.mixin(DefaultMenu.prototype, Menu.prototype, { + open: function open() { + !this._allDatasetsEmpty() && this._show(); + return s.open.apply(this, [].slice.call(arguments, 0)); + }, + close: function close() { + this._hide(); + return s.close.apply(this, [].slice.call(arguments, 0)); + }, + _onRendered: function onRendered() { + if (this._allDatasetsEmpty()) { + this._hide(); + } else { + this.isOpen() && this._show(); + } + return s._onRendered.apply(this, [].slice.call(arguments, 0)); + }, + _onCleared: function onCleared() { + if (this._allDatasetsEmpty()) { + this._hide(); + } else { + this.isOpen() && this._show(); + } + return s._onCleared.apply(this, [].slice.call(arguments, 0)); + }, + setLanguageDirection: function setLanguageDirection(dir) { + this.$node.css(dir === "ltr" ? this.css.ltr : this.css.rtl); + return s.setLanguageDirection.apply(this, [].slice.call(arguments, 0)); + }, + _hide: function hide() { + this.$node.hide(); + }, + _show: function show() { + this.$node.css("display", "block"); + } + }); + return DefaultMenu; + }(); + var Typeahead = function() { + "use strict"; + function Typeahead(o, www) { + var onFocused, onBlurred, onEnterKeyed, onTabKeyed, onEscKeyed, onUpKeyed, onDownKeyed, onLeftKeyed, onRightKeyed, onQueryChanged, onWhitespaceChanged; + o = o || {}; + if (!o.input) { + $.error("missing input"); + } + if (!o.menu) { + $.error("missing menu"); + } + if (!o.eventBus) { + $.error("missing event bus"); + } + www.mixin(this); + this.eventBus = o.eventBus; + this.minLength = _.isNumber(o.minLength) ? o.minLength : 1; + this.input = o.input; + this.menu = o.menu; + this.enabled = true; + this.autoselect = !!o.autoselect; + this.active = false; + this.input.hasFocus() && this.activate(); + this.dir = this.input.getLangDir(); + this._hacks(); + this.menu.bind().onSync("selectableClicked", this._onSelectableClicked, this).onSync("asyncRequested", this._onAsyncRequested, this).onSync("asyncCanceled", this._onAsyncCanceled, this).onSync("asyncReceived", this._onAsyncReceived, this).onSync("datasetRendered", this._onDatasetRendered, this).onSync("datasetCleared", this._onDatasetCleared, this); + onFocused = c(this, "activate", "open", "_onFocused"); + onBlurred = c(this, "deactivate", "_onBlurred"); + onEnterKeyed = c(this, "isActive", "isOpen", "_onEnterKeyed"); + onTabKeyed = c(this, "isActive", "isOpen", "_onTabKeyed"); + onEscKeyed = c(this, "isActive", "_onEscKeyed"); + onUpKeyed = c(this, "isActive", "open", "_onUpKeyed"); + onDownKeyed = c(this, "isActive", "open", "_onDownKeyed"); + onLeftKeyed = c(this, "isActive", "isOpen", "_onLeftKeyed"); + onRightKeyed = c(this, "isActive", "isOpen", "_onRightKeyed"); + onQueryChanged = c(this, "_openIfActive", "_onQueryChanged"); + onWhitespaceChanged = c(this, "_openIfActive", "_onWhitespaceChanged"); + this.input.bind().onSync("focused", onFocused, this).onSync("blurred", onBlurred, this).onSync("enterKeyed", onEnterKeyed, this).onSync("tabKeyed", onTabKeyed, this).onSync("escKeyed", onEscKeyed, this).onSync("upKeyed", onUpKeyed, this).onSync("downKeyed", onDownKeyed, this).onSync("leftKeyed", onLeftKeyed, this).onSync("rightKeyed", onRightKeyed, this).onSync("queryChanged", onQueryChanged, this).onSync("whitespaceChanged", onWhitespaceChanged, this).onSync("langDirChanged", this._onLangDirChanged, this); + } + _.mixin(Typeahead.prototype, { + _hacks: function hacks() { + var $input, $menu; + $input = this.input.$input || $("
"); + $menu = this.menu.$node || $("
"); + $input.on("blur.tt", function($e) { + var active, isActive, hasActive; + active = document.activeElement; + isActive = $menu.is(active); + hasActive = $menu.has(active).length > 0; + if (_.isMsie() && (isActive || hasActive)) { + $e.preventDefault(); + $e.stopImmediatePropagation(); + _.defer(function() { + $input.focus(); + }); + } + }); + $menu.on("mousedown.tt", function($e) { + $e.preventDefault(); + }); + }, + _onSelectableClicked: function onSelectableClicked(type, $el) { + this.select($el); + }, + _onDatasetCleared: function onDatasetCleared() { + this._updateHint(); + }, + _onDatasetRendered: function onDatasetRendered(type, suggestions, async, dataset) { + this._updateHint(); + if (this.autoselect) { + var cursorClass = this.selectors.cursor.substr(1); + this.menu.$node.find(this.selectors.suggestion).first().addClass(cursorClass); + } + this.eventBus.trigger("render", suggestions, async, dataset); + }, + _onAsyncRequested: function onAsyncRequested(type, dataset, query) { + this.eventBus.trigger("asyncrequest", query, dataset); + }, + _onAsyncCanceled: function onAsyncCanceled(type, dataset, query) { + this.eventBus.trigger("asynccancel", query, dataset); + }, + _onAsyncReceived: function onAsyncReceived(type, dataset, query) { + this.eventBus.trigger("asyncreceive", query, dataset); + }, + _onFocused: function onFocused() { + this._minLengthMet() && this.menu.update(this.input.getQuery()); + }, + _onBlurred: function onBlurred() { + if (this.input.hasQueryChangedSinceLastFocus()) { + this.eventBus.trigger("change", this.input.getQuery()); + } + }, + _onEnterKeyed: function onEnterKeyed(type, $e) { + var $selectable; + if ($selectable = this.menu.getActiveSelectable()) { + if (this.select($selectable)) { + $e.preventDefault(); + $e.stopPropagation(); + } + } else if (this.autoselect) { + if (this.select(this.menu.getTopSelectable())) { + $e.preventDefault(); + $e.stopPropagation(); + } + } + }, + _onTabKeyed: function onTabKeyed(type, $e) { + var $selectable; + if ($selectable = this.menu.getActiveSelectable()) { + this.select($selectable) && $e.preventDefault(); + } else if (this.autoselect) { + if ($selectable = this.menu.getTopSelectable()) { + this.autocomplete($selectable) && $e.preventDefault(); + } + } + }, + _onEscKeyed: function onEscKeyed() { + this.close(); + }, + _onUpKeyed: function onUpKeyed() { + this.moveCursor(-1); + }, + _onDownKeyed: function onDownKeyed() { + this.moveCursor(+1); + }, + _onLeftKeyed: function onLeftKeyed() { + if (this.dir === "rtl" && this.input.isCursorAtEnd()) { + this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable()); + } + }, + _onRightKeyed: function onRightKeyed() { + if (this.dir === "ltr" && this.input.isCursorAtEnd()) { + this.autocomplete(this.menu.getActiveSelectable() || this.menu.getTopSelectable()); + } + }, + _onQueryChanged: function onQueryChanged(e, query) { + this._minLengthMet(query) ? this.menu.update(query) : this.menu.empty(); + }, + _onWhitespaceChanged: function onWhitespaceChanged() { + this._updateHint(); + }, + _onLangDirChanged: function onLangDirChanged(e, dir) { + if (this.dir !== dir) { + this.dir = dir; + this.menu.setLanguageDirection(dir); + } + }, + _openIfActive: function openIfActive() { + this.isActive() && this.open(); + }, + _minLengthMet: function minLengthMet(query) { + query = _.isString(query) ? query : this.input.getQuery() || ""; + return query.length >= this.minLength; + }, + _updateHint: function updateHint() { + var $selectable, data, val, query, escapedQuery, frontMatchRegEx, match; + $selectable = this.menu.getTopSelectable(); + data = this.menu.getSelectableData($selectable); + val = this.input.getInputValue(); + if (data && !_.isBlankString(val) && !this.input.hasOverflow()) { + query = Input.normalizeQuery(val); + escapedQuery = _.escapeRegExChars(query); + frontMatchRegEx = new RegExp("^(?:" + escapedQuery + ")(.+$)", "i"); + match = frontMatchRegEx.exec(data.val); + match && this.input.setHint(val + match[1]); + } else { + this.input.clearHint(); + } + }, + isEnabled: function isEnabled() { + return this.enabled; + }, + enable: function enable() { + this.enabled = true; + }, + disable: function disable() { + this.enabled = false; + }, + isActive: function isActive() { + return this.active; + }, + activate: function activate() { + if (this.isActive()) { + return true; + } else if (!this.isEnabled() || this.eventBus.before("active")) { + return false; + } else { + this.active = true; + this.eventBus.trigger("active"); + return true; + } + }, + deactivate: function deactivate() { + if (!this.isActive()) { + return true; + } else if (this.eventBus.before("idle")) { + return false; + } else { + this.active = false; + this.close(); + this.eventBus.trigger("idle"); + return true; + } + }, + isOpen: function isOpen() { + return this.menu.isOpen(); + }, + open: function open() { + if (!this.isOpen() && !this.eventBus.before("open")) { + this.input.setAriaExpanded(true); + this.menu.open(); + this._updateHint(); + this.eventBus.trigger("open"); + } + return this.isOpen(); + }, + close: function close() { + if (this.isOpen() && !this.eventBus.before("close")) { + this.input.setAriaExpanded(false); + this.menu.close(); + this.input.clearHint(); + this.input.resetInputValue(); + this.eventBus.trigger("close"); + } + return !this.isOpen(); + }, + setVal: function setVal(val) { + this.input.setQuery(_.toStr(val)); + }, + getVal: function getVal() { + return this.input.getQuery(); + }, + select: function select($selectable) { + var data = this.menu.getSelectableData($selectable); + if (data && !this.eventBus.before("select", data.obj, data.dataset)) { + this.input.setQuery(data.val, true); + this.eventBus.trigger("select", data.obj, data.dataset); + this.close(); + return true; + } + return false; + }, + autocomplete: function autocomplete($selectable) { + var query, data, isValid; + query = this.input.getQuery(); + data = this.menu.getSelectableData($selectable); + isValid = data && query !== data.val; + if (isValid && !this.eventBus.before("autocomplete", data.obj, data.dataset)) { + this.input.setQuery(data.val); + this.eventBus.trigger("autocomplete", data.obj, data.dataset); + return true; + } + return false; + }, + moveCursor: function moveCursor(delta) { + var query, $candidate, data, suggestion, datasetName, cancelMove, id; + query = this.input.getQuery(); + $candidate = this.menu.selectableRelativeToCursor(delta); + data = this.menu.getSelectableData($candidate); + suggestion = data ? data.obj : null; + datasetName = data ? data.dataset : null; + id = $candidate ? $candidate.attr("id") : null; + this.input.trigger("cursorchange", id); + cancelMove = this._minLengthMet() && this.menu.update(query); + if (!cancelMove && !this.eventBus.before("cursorchange", suggestion, datasetName)) { + this.menu.setCursor($candidate); + if (data) { + if (typeof data.val === "string") { + this.input.setInputValue(data.val); + } + } else { + this.input.resetInputValue(); + this._updateHint(); + } + this.eventBus.trigger("cursorchange", suggestion, datasetName); + return true; + } + return false; + }, + destroy: function destroy() { + this.input.destroy(); + this.menu.destroy(); + } + }); + return Typeahead; + function c(ctx) { + var methods = [].slice.call(arguments, 1); + return function() { + var args = [].slice.call(arguments); + _.each(methods, function(method) { + return ctx[method].apply(ctx, args); + }); + }; + } + }(); + (function() { + "use strict"; + var old, keys, methods; + old = $.fn.typeahead; + keys = { + www: "tt-www", + attrs: "tt-attrs", + typeahead: "tt-typeahead" + }; + methods = { + initialize: function initialize(o, datasets) { + var www; + datasets = _.isArray(datasets) ? datasets : [].slice.call(arguments, 1); + o = o || {}; + www = WWW(o.classNames); + return this.each(attach); + function attach() { + var $input, $wrapper, $hint, $menu, defaultHint, defaultMenu, eventBus, input, menu, status, typeahead, MenuConstructor; + _.each(datasets, function(d) { + d.highlight = !!o.highlight; + }); + $input = $(this); + $wrapper = $(www.html.wrapper); + $hint = $elOrNull(o.hint); + $menu = $elOrNull(o.menu); + defaultHint = o.hint !== false && !$hint; + defaultMenu = o.menu !== false && !$menu; + defaultHint && ($hint = buildHintFromInput($input, www)); + defaultMenu && ($menu = $(www.html.menu).css(www.css.menu)); + $hint && $hint.val(""); + $input = prepInput($input, www); + if (defaultHint || defaultMenu) { + $wrapper.css(www.css.wrapper); + $input.css(defaultHint ? www.css.input : www.css.inputWithNoHint); + $input.wrap($wrapper).parent().prepend(defaultHint ? $hint : null).append(defaultMenu ? $menu : null); + } + MenuConstructor = defaultMenu ? DefaultMenu : Menu; + eventBus = new EventBus({ + el: $input + }); + input = new Input({ + hint: $hint, + input: $input, + menu: $menu + }, www); + menu = new MenuConstructor({ + node: $menu, + datasets: datasets + }, www); + status = new Status({ + $input: $input, + menu: menu + }); + typeahead = new Typeahead({ + input: input, + menu: menu, + eventBus: eventBus, + minLength: o.minLength, + autoselect: o.autoselect + }, www); + $input.data(keys.www, www); + $input.data(keys.typeahead, typeahead); + } + }, + isEnabled: function isEnabled() { + var enabled; + ttEach(this.first(), function(t) { + enabled = t.isEnabled(); + }); + return enabled; + }, + enable: function enable() { + ttEach(this, function(t) { + t.enable(); + }); + return this; + }, + disable: function disable() { + ttEach(this, function(t) { + t.disable(); + }); + return this; + }, + isActive: function isActive() { + var active; + ttEach(this.first(), function(t) { + active = t.isActive(); + }); + return active; + }, + activate: function activate() { + ttEach(this, function(t) { + t.activate(); + }); + return this; + }, + deactivate: function deactivate() { + ttEach(this, function(t) { + t.deactivate(); + }); + return this; + }, + isOpen: function isOpen() { + var open; + ttEach(this.first(), function(t) { + open = t.isOpen(); + }); + return open; + }, + open: function open() { + ttEach(this, function(t) { + t.open(); + }); + return this; + }, + close: function close() { + ttEach(this, function(t) { + t.close(); + }); + return this; + }, + select: function select(el) { + var success = false, $el = $(el); + ttEach(this.first(), function(t) { + success = t.select($el); + }); + return success; + }, + autocomplete: function autocomplete(el) { + var success = false, $el = $(el); + ttEach(this.first(), function(t) { + success = t.autocomplete($el); + }); + return success; + }, + moveCursor: function moveCursoe(delta) { + var success = false; + ttEach(this.first(), function(t) { + success = t.moveCursor(delta); + }); + return success; + }, + val: function val(newVal) { + var query; + if (!arguments.length) { + ttEach(this.first(), function(t) { + query = t.getVal(); + }); + return query; + } else { + ttEach(this, function(t) { + t.setVal(_.toStr(newVal)); + }); + return this; + } + }, + destroy: function destroy() { + ttEach(this, function(typeahead, $input) { + revert($input); + typeahead.destroy(); + }); + return this; + } + }; + $.fn.typeahead = function(method) { + if (methods[method]) { + return methods[method].apply(this, [].slice.call(arguments, 1)); + } else { + return methods.initialize.apply(this, arguments); + } + }; + $.fn.typeahead.noConflict = function noConflict() { + $.fn.typeahead = old; + return this; + }; + function ttEach($els, fn) { + $els.each(function() { + var $input = $(this), typeahead; + (typeahead = $input.data(keys.typeahead)) && fn(typeahead, $input); + }); + } + function buildHintFromInput($input, www) { + return $input.clone().addClass(www.classes.hint).removeData().css(www.css.hint).css(getBackgroundStyles($input)).prop({ + readonly: true, + required: false + }).removeAttr("id name placeholder").removeClass("required").attr({ + spellcheck: "false", + tabindex: -1 + }); + } + function prepInput($input, www) { + $input.data(keys.attrs, { + dir: $input.attr("dir"), + autocomplete: $input.attr("autocomplete"), + spellcheck: $input.attr("spellcheck"), + style: $input.attr("style") + }); + $input.addClass(www.classes.input).attr({ + spellcheck: false + }); + try { + !$input.attr("dir") && $input.attr("dir", "auto"); + } catch (e) {} + return $input; + } + function getBackgroundStyles($el) { + return { + backgroundAttachment: $el.css("background-attachment"), + backgroundClip: $el.css("background-clip"), + backgroundColor: $el.css("background-color"), + backgroundImage: $el.css("background-image"), + backgroundOrigin: $el.css("background-origin"), + backgroundPosition: $el.css("background-position"), + backgroundRepeat: $el.css("background-repeat"), + backgroundSize: $el.css("background-size") + }; + } + function revert($input) { + var www, $wrapper; + www = $input.data(keys.www); + $wrapper = $input.parent().filter(www.selectors.wrapper); + _.each($input.data(keys.attrs), function(val, key) { + _.isUndefined(val) ? $input.removeAttr(key) : $input.attr(key, val); + }); + $input.removeData(keys.typeahead).removeData(keys.www).removeData(keys.attr).removeClass(www.classes.input); + if ($wrapper.length) { + $input.detach().insertAfter($wrapper); + $wrapper.remove(); + } + } + function $elOrNull(obj) { + var isValid, $el; + isValid = _.isJQuery(obj) || _.isElement(obj); + $el = isValid ? $(obj).first() : []; + return $el.length ? $el : null; + } + })(); +}); \ No newline at end of file diff --git a/large_tuple.html b/large_tuple.html new file mode 100644 index 000000000..87649cf27 --- /dev/null +++ b/large_tuple.html @@ -0,0 +1,478 @@ + + + + large_tuple Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Large Tuple

+ +

Tuples shouldn’t have too many members. Create a custom type instead.

+ +
    +
  • Identifier: large_tuple
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: metrics
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +warning + +2 +
    +error + +3 +
  • +
+

Non Triggering Examples

+
let foo: (Int, Int)
+
+
let foo: (start: Int, end: Int)
+
+
let foo: (Int, (Int, String))
+
+
func foo() -> (Int, Int)
+
+
func foo() -> (Int, Int) {}
+
+
func foo(bar: String) -> (Int, Int)
+
+
func foo(bar: String) -> (Int, Int) {}
+
+
func foo() throws -> (Int, Int)
+
+
func foo() throws -> (Int, Int) {}
+
+
let foo: (Int, Int, Int) -> Void
+
+
let foo: (Int, Int, Int) throws -> Void
+
+
func foo(bar: (Int, String, Float) -> Void)
+
+
func foo(bar: (Int, String, Float) throws -> Void)
+
+
var completionHandler: ((_ data: Data?, _ resp: URLResponse?, _ e: NSError?) -> Void)!
+
+
func getDictionaryAndInt() -> (Dictionary<Int, String>, Int)?
+
+
func getGenericTypeAndInt() -> (Type<Int, String, Float>, Int)?
+
+
func foo() async -> (Int, Int)
+
+
func foo() async -> (Int, Int) {}
+
+
func foo(bar: String) async -> (Int, Int)
+
+
func foo(bar: String) async -> (Int, Int) {}
+
+
func foo() async throws -> (Int, Int)
+
+
func foo() async throws -> (Int, Int) {}
+
+
let foo: (Int, Int, Int) async -> Void
+
+
let foo: (Int, Int, Int) async throws -> Void
+
+
func foo(bar: (Int, String, Float) async -> Void)
+
+
func foo(bar: (Int, String, Float) async throws -> Void)
+
+
func getDictionaryAndInt() async -> (Dictionary<Int, String>, Int)?
+
+
func getGenericTypeAndInt() async -> (Type<Int, String, Float>, Int)?
+
+

Triggering Examples

+
let foo: ↓(Int, Int, Int)
+
+
let foo: ↓(start: Int, end: Int, value: String)
+
+
let foo: (Int, ↓(Int, Int, Int))
+
+
func foo(bar: ↓(Int, Int, Int))
+
+
func foo() -> ↓(Int, Int, Int)
+
+
func foo() -> ↓(Int, Int, Int) {}
+
+
func foo(bar: String) -> ↓(Int, Int, Int)
+
+
func foo(bar: String) -> ↓(Int, Int, Int) {}
+
+
func foo() throws -> ↓(Int, Int, Int)
+
+
func foo() throws -> ↓(Int, Int, Int) {}
+
+
func foo() throws -> ↓(Int, ↓(String, String, String), Int) {}
+
+
func getDictionaryAndInt() -> (Dictionary<Int, ↓(String, String, String)>, Int)?
+
+
func foo(bar: ↓(Int, Int, Int)) async
+
+
func foo() async -> ↓(Int, Int, Int)
+
+
func foo() async -> ↓(Int, Int, Int) {}
+
+
func foo(bar: String) async -> ↓(Int, Int, Int)
+
+
func foo(bar: String) async -> ↓(Int, Int, Int) {}
+
+
func foo() async throws -> ↓(Int, Int, Int)
+
+
func foo() async throws -> ↓(Int, Int, Int) {}
+
+
func foo() async throws -> ↓(Int, ↓(String, String, String), Int) {}
+
+
func getDictionaryAndInt() async -> (Dictionary<Int, ↓(String, String, String)>, Int)?
+
+ +
+
+ + +
+
+ + + diff --git a/last_where.html b/last_where.html new file mode 100644 index 000000000..24cffff1a --- /dev/null +++ b/last_where.html @@ -0,0 +1,397 @@ + + + + last_where Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Last Where

+ +

Prefer using .last(where:) over .filter { }.last in collections

+ +
    +
  • Identifier: last_where
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
kinds.filter(excludingKinds.contains).isEmpty && kinds.last == .identifier
+
+
myList.last(where: { $0 % 2 == 0 })
+
+
match(pattern: pattern).filter { $0.last == .identifier }
+
+
(myList.filter { $0 == 1 }.suffix(2)).last
+
+
collection.filter("stringCol = '3'").last
+
+

Triggering Examples

+
↓myList.filter { $0 % 2 == 0 }.last
+
+
↓myList.filter({ $0 % 2 == 0 }).last
+
+
↓myList.map { $0 + 1 }.filter({ $0 % 2 == 0 }).last
+
+
↓myList.map { $0 + 1 }.filter({ $0 % 2 == 0 }).last?.something()
+
+
↓myList.filter(someFunction).last
+
+
↓myList.filter({ $0 % 2 == 0 })
+.last
+
+
(↓myList.filter { $0 == 1 }).last
+
+ +
+
+ + +
+
+ + + diff --git a/leading_whitespace.html b/leading_whitespace.html new file mode 100644 index 000000000..2e2bf0a11 --- /dev/null +++ b/leading_whitespace.html @@ -0,0 +1,379 @@ + + + + leading_whitespace Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Leading Whitespace

+ +

Files should not contain leading whitespace

+ +
    +
  • Identifier: leading_whitespace
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
//
+
+

Triggering Examples

+

+//
+
+
 //
+
+ +
+
+ + +
+
+ + + diff --git a/legacy_cggeometry_functions.html b/legacy_cggeometry_functions.html new file mode 100644 index 000000000..5420f794c --- /dev/null +++ b/legacy_cggeometry_functions.html @@ -0,0 +1,452 @@ + + + + legacy_cggeometry_functions Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Legacy CGGeometry Functions

+ +

Struct extension properties and methods are preferred over legacy functions

+ +
    +
  • Identifier: legacy_cggeometry_functions
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
rect.width
+
+
rect.height
+
+
rect.minX
+
+
rect.midX
+
+
rect.maxX
+
+
rect.minY
+
+
rect.midY
+
+
rect.maxY
+
+
rect.isNull
+
+
rect.isEmpty
+
+
rect.isInfinite
+
+
rect.standardized
+
+
rect.integral
+
+
rect.insetBy(dx: 5.0, dy: -7.0)
+
+
rect.offsetBy(dx: 5.0, dy: -7.0)
+
+
rect1.union(rect2)
+
+
rect1.intersect(rect2)
+
+
rect1.contains(rect2)
+
+
rect.contains(point)
+
+
rect1.intersects(rect2)
+
+

Triggering Examples

+
↓CGRectGetWidth(rect)
+
+
↓CGRectGetHeight(rect)
+
+
↓CGRectGetMinX(rect)
+
+
↓CGRectGetMidX(rect)
+
+
↓CGRectGetMaxX(rect)
+
+
↓CGRectGetMinY(rect)
+
+
↓CGRectGetMidY(rect)
+
+
↓CGRectGetMaxY(rect)
+
+
↓CGRectIsNull(rect)
+
+
↓CGRectIsEmpty(rect)
+
+
↓CGRectIsInfinite(rect)
+
+
↓CGRectStandardize(rect)
+
+
↓CGRectIntegral(rect)
+
+
↓CGRectInset(rect, 10, 5)
+
+
↓CGRectOffset(rect, -2, 8.3)
+
+
↓CGRectUnion(rect1, rect2)
+
+
↓CGRectIntersection(rect1, rect2)
+
+
↓CGRectContainsRect(rect1, rect2)
+
+
↓CGRectContainsPoint(rect, point)
+
+
↓CGRectIntersectsRect(rect1, rect2)
+
+ +
+
+ + +
+
+ + + diff --git a/legacy_constant.html b/legacy_constant.html new file mode 100644 index 000000000..25403214e --- /dev/null +++ b/legacy_constant.html @@ -0,0 +1,412 @@ + + + + legacy_constant Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Legacy Constant

+ +

Struct-scoped constants are preferred over legacy global constants

+ +
    +
  • Identifier: legacy_constant
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
CGRect.infinite
+
+
CGPoint.zero
+
+
CGRect.zero
+
+
CGSize.zero
+
+
NSPoint.zero
+
+
NSRect.zero
+
+
NSSize.zero
+
+
CGRect.null
+
+
CGFloat.pi
+
+
Float.pi
+
+

Triggering Examples

+
↓CGRectInfinite
+
+
↓CGPointZero
+
+
↓CGRectZero
+
+
↓CGSizeZero
+
+
↓NSZeroPoint
+
+
↓NSZeroRect
+
+
↓NSZeroSize
+
+
↓CGRectNull
+
+
↓CGFloat(M_PI)
+
+
↓Float(M_PI)
+
+ +
+
+ + +
+
+ + + diff --git a/legacy_constructor.html b/legacy_constructor.html new file mode 100644 index 000000000..cf1036757 --- /dev/null +++ b/legacy_constructor.html @@ -0,0 +1,465 @@ + + + + legacy_constructor Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Legacy Constructor

+ +

Swift constructors are preferred over legacy convenience functions

+ +
    +
  • Identifier: legacy_constructor
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
CGPoint(x: 10, y: 10)
+
+
CGPoint(x: xValue, y: yValue)
+
+
CGSize(width: 10, height: 10)
+
+
CGSize(width: aWidth, height: aHeight)
+
+
CGRect(x: 0, y: 0, width: 10, height: 10)
+
+
CGRect(x: xVal, y: yVal, width: aWidth, height: aHeight)
+
+
CGVector(dx: 10, dy: 10)
+
+
CGVector(dx: deltaX, dy: deltaY)
+
+
NSPoint(x: 10, y: 10)
+
+
NSPoint(x: xValue, y: yValue)
+
+
NSSize(width: 10, height: 10)
+
+
NSSize(width: aWidth, height: aHeight)
+
+
NSRect(x: 0, y: 0, width: 10, height: 10)
+
+
NSRect(x: xVal, y: yVal, width: aWidth, height: aHeight)
+
+
NSRange(location: 10, length: 1)
+
+
NSRange(location: loc, length: len)
+
+
UIEdgeInsets(top: 0, left: 0, bottom: 10, right: 10)
+
+
UIEdgeInsets(top: aTop, left: aLeft, bottom: aBottom, right: aRight)
+
+
NSEdgeInsets(top: 0, left: 0, bottom: 10, right: 10)
+
+
NSEdgeInsets(top: aTop, left: aLeft, bottom: aBottom, right: aRight)
+
+
UIOffset(horizontal: 0, vertical: 10)
+
+
UIOffset(horizontal: horizontal, vertical: vertical)
+
+

Triggering Examples

+
↓CGPointMake(10, 10)
+
+
↓CGPointMake(xVal, yVal)
+
+
↓CGPointMake(calculateX(), 10)
+
+
↓CGSizeMake(10, 10)
+
+
↓CGSizeMake(aWidth, aHeight)
+
+
↓CGRectMake(0, 0, 10, 10)
+
+
↓CGRectMake(xVal, yVal, width, height)
+
+
↓CGVectorMake(10, 10)
+
+
↓CGVectorMake(deltaX, deltaY)
+
+
↓NSMakePoint(10, 10)
+
+
↓NSMakePoint(xVal, yVal)
+
+
↓NSMakeSize(10, 10)
+
+
↓NSMakeSize(aWidth, aHeight)
+
+
↓NSMakeRect(0, 0, 10, 10)
+
+
↓NSMakeRect(xVal, yVal, width, height)
+
+
↓NSMakeRange(10, 1)
+
+
↓NSMakeRange(loc, len)
+
+
↓UIEdgeInsetsMake(0, 0, 10, 10)
+
+
↓UIEdgeInsetsMake(top, left, bottom, right)
+
+
↓NSEdgeInsetsMake(0, 0, 10, 10)
+
+
↓NSEdgeInsetsMake(top, left, bottom, right)
+
+
↓CGVectorMake(10, 10)
+↓NSMakeRange(10, 1)
+
+
↓UIOffsetMake(0, 10)
+
+
↓UIOffsetMake(horizontal, vertical)
+
+ +
+
+ + +
+
+ + + diff --git a/legacy_hashing.html b/legacy_hashing.html new file mode 100644 index 000000000..b536cc40b --- /dev/null +++ b/legacy_hashing.html @@ -0,0 +1,425 @@ + + + + legacy_hashing Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Legacy Hashing

+ +

Prefer using the hash(into:) function instead of overriding hashValue

+ +
    +
  • Identifier: legacy_hashing
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
struct Foo: Hashable {
+  let bar: Int = 10
+
+  func hash(into hasher: inout Hasher) {
+    hasher.combine(bar)
+  }
+}
+
+
class Foo: Hashable {
+  let bar: Int = 10
+
+  func hash(into hasher: inout Hasher) {
+    hasher.combine(bar)
+  }
+}
+
+
var hashValue: Int { return 1 }
+class Foo: Hashable { 
+ }
+
+
class Foo: Hashable {
+  let bar: String = "Foo"
+
+  public var hashValue: String {
+    return bar
+  }
+}
+
+
class Foo: Hashable {
+  let bar: String = "Foo"
+
+  public var hashValue: String {
+    get { return bar }
+    set { bar = newValue }
+  }
+}
+
+

Triggering Examples

+
struct Foo: Hashable {
+    let bar: Int = 10
+
+    public ↓var hashValue: Int {
+        return bar
+    }
+}
+
+
class Foo: Hashable {
+    let bar: Int = 10
+
+    public ↓var hashValue: Int {
+        return bar
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/legacy_multiple.html b/legacy_multiple.html new file mode 100644 index 000000000..922add409 --- /dev/null +++ b/legacy_multiple.html @@ -0,0 +1,403 @@ + + + + legacy_multiple Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Legacy Multiple

+ +

Prefer using the isMultiple(of:) function instead of using the remainder operator (%)

+ +
    +
  • Identifier: legacy_multiple
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
cell.contentView.backgroundColor = indexPath.row.isMultiple(of: 2) ? .gray : .white
+
+
guard count.isMultiple(of: 2) else { throw DecodingError.dataCorrupted(...) }
+
+
sanityCheck(bytes > 0 && bytes.isMultiple(of: 4), "capacity must be multiple of 4 bytes")
+
+
guard let i = reversedNumbers.firstIndex(where: { $0.isMultiple(of: 2) }) else { return }
+
+
let constant = 56
+let isMultiple = value.isMultiple(of: constant)
+
+
let constant = 56
+let secret = value % constant == 5
+
+
let secretValue = (value % 3) + 2
+
+

Triggering Examples

+
cell.contentView.backgroundColor = indexPath.row ↓% 2 == 0 ? .gray : .white
+
+
cell.contentView.backgroundColor = 0 == indexPath.row ↓% 2 ? .gray : .white
+
+
cell.contentView.backgroundColor = indexPath.row ↓% 2 != 0 ? .gray : .white
+
+
guard count ↓% 2 == 0 else { throw DecodingError.dataCorrupted(...) }
+
+
sanityCheck(bytes > 0 && bytes ↓% 4 == 0, "capacity must be multiple of 4 bytes")
+
+
guard let i = reversedNumbers.firstIndex(where: { $0 ↓% 2 == 0 }) else { return }
+
+
let constant = 56
+let isMultiple = value ↓% constant == 0
+
+ +
+
+ + +
+
+ + + diff --git a/legacy_nsgeometry_functions.html b/legacy_nsgeometry_functions.html new file mode 100644 index 000000000..383fe1a31 --- /dev/null +++ b/legacy_nsgeometry_functions.html @@ -0,0 +1,448 @@ + + + + legacy_nsgeometry_functions Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Legacy NSGeometry Functions

+ +

Struct extension properties and methods are preferred over legacy functions

+ +
    +
  • Identifier: legacy_nsgeometry_functions
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
rect.width
+
+
rect.height
+
+
rect.minX
+
+
rect.midX
+
+
rect.maxX
+
+
rect.minY
+
+
rect.midY
+
+
rect.maxY
+
+
rect.isEmpty
+
+
rect.integral
+
+
rect.insetBy(dx: 5.0, dy: -7.0)
+
+
rect.offsetBy(dx: 5.0, dy: -7.0)
+
+
rect1.union(rect2)
+
+
rect1.intersection(rect2)
+
+
rect1.contains(rect2)
+
+
rect.contains(point)
+
+
rect1.intersects(rect2)
+
+

Triggering Examples

+
↓NSWidth(rect)
+
+
↓NSHeight(rect)
+
+
↓NSMinX(rect)
+
+
↓NSMidX(rect)
+
+
↓NSMaxX(rect)
+
+
↓NSMinY(rect)
+
+
↓NSMidY(rect)
+
+
↓NSMaxY(rect)
+
+
↓NSEqualRects(rect1, rect2)
+
+
↓NSEqualSizes(size1, size2)
+
+
↓NSEqualPoints(point1, point2)
+
+
↓NSEdgeInsetsEqual(insets2, insets2)
+
+
↓NSIsEmptyRect(rect)
+
+
↓NSIntegralRect(rect)
+
+
↓NSInsetRect(rect, 10, 5)
+
+
↓NSOffsetRect(rect, -2, 8.3)
+
+
↓NSUnionRect(rect1, rect2)
+
+
↓NSIntersectionRect(rect1, rect2)
+
+
↓NSContainsRect(rect1, rect2)
+
+
↓NSPointInRect(rect, point)
+
+
↓NSIntersectsRect(rect1, rect2)
+
+ +
+
+ + +
+
+ + + diff --git a/legacy_objc_type.html b/legacy_objc_type.html new file mode 100644 index 000000000..10a45ee54 --- /dev/null +++ b/legacy_objc_type.html @@ -0,0 +1,404 @@ + + + + legacy_objc_type Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Legacy Objective-C Reference Type

+ +

Prefer Swift value types to bridged Objective-C reference types

+ +
    +
  • Identifier: legacy_objc_type
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
var array = Array<Int>()
+
+
var calendar: Calendar? = nil
+
+
var formatter: NSDataDetector
+
+
var className: String = NSStringFromClass(MyClass.self)
+
+
_ = URLRequest.CachePolicy.reloadIgnoringLocalCacheData
+
+
_ = Notification.Name("com.apple.Music.playerInfo")
+
+

Triggering Examples

+
var array = ↓NSArray()
+
+
var calendar: ↓NSCalendar? = nil
+
+
_ = ↓NSURLRequest.CachePolicy.reloadIgnoringLocalCacheData
+
+
_ = ↓NSNotification.Name("com.apple.Music.playerInfo")
+
+
let keyValuePair: (Int) -> (↓NSString, ↓NSString) = {
+  let n = "\($0)" as ↓NSString; return (n, n)
+}
+dictionary = [↓NSString: ↓NSString](uniqueKeysWithValues:
+  (1...10_000).lazy.map(keyValuePair))
+
+
extension Foundation.Notification.Name {
+    static var reachabilityChanged: Foundation.↓NSNotification.Name {
+        return Foundation.Notification.Name("org.wordpress.reachability.changed")
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/legacy_random.html b/legacy_random.html new file mode 100644 index 000000000..b57389384 --- /dev/null +++ b/legacy_random.html @@ -0,0 +1,384 @@ + + + + legacy_random Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Legacy Random

+ +

Prefer using type.random(in:) over legacy functions

+ +
    +
  • Identifier: legacy_random
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
Int.random(in: 0..<10)
+
+
Double.random(in: 8.6...111.34)
+
+
Float.random(in: 0 ..< 1)
+
+

Triggering Examples

+
↓arc4random()
+
+
↓arc4random_uniform(83)
+
+
↓drand48()
+
+ +
+
+ + +
+
+ + + diff --git a/let_var_whitespace.html b/let_var_whitespace.html new file mode 100644 index 000000000..09ffdfebf --- /dev/null +++ b/let_var_whitespace.html @@ -0,0 +1,547 @@ + + + + let_var_whitespace Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Variable Declaration Whitespace

+ +

Variable declarations should be separated from other statements by a blank line

+ +
    +
  • Identifier: let_var_whitespace
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class C {
+let a = 0
+var x = 1
+
+var y = 2
+}
+
+
class C {
+let a = 5
+
+var x = 1
+}
+
+
class C {
+var a = 0
+}
+
+
class C {
+let a = 1 +
+    2
+let b = 5
+}
+
+
class C {
+var x: Int {
+    return 0
+}
+}
+
+
class C {
+var x: Int {
+    let a = 0
+
+    return a
+}
+}
+
+
class C {
+#if os(macOS)
+let a = 0
+
+func f() {}
+#endif
+}
+
+
class C {
+#warning("TODO: remove it")
+let a = 0
+#warning("TODO: remove it")
+let b = 0
+}
+
+
class C {
+#error("TODO: remove it")
+let a = 0
+}
+
+
class C {
+@available(swift 4)
+let a = 0
+}
+
+
class C {
+@objc
+var s: String = ""
+}
+
+
class C {
+@objc
+func a() {}
+}
+
+
class C {
+var x = 0
+lazy
+var y = 0
+}
+
+
class C {
+@available(OSX, introduced: 10.6)
+@available(*, deprecated)
+var x = 0
+}
+
+
class C {
+// swiftlint:disable superfluous_disable_command
+// swiftlint:disable force_cast
+
+let x = bar as! Bar
+}
+
+
class C {
+@available(swift 4)
+@UserDefault("param", defaultValue: true)
+var isEnabled = true
+
+@Attribute
+func f() {}
+}
+
+
class C {
+var x: Int {
+    let a = 0
+    return a
+}
+}
+
+
a = 2
+
+
a = 2
+
+var b = 3
+
+
#warning("message")
+let a = 2
+
+
#if os(macOS)
+let a = 2
+#endif
+
+
f {
+    let a = 1
+    return a
+}
+
+
func f() {
+    #if os(macOS)
+    let a = 2
+    return a
+    #else
+    return 1
+    #endif
+}
+
+

Triggering Examples

+
class C {
+let a
+↓func x() {}
+}
+
+
class C {
+var x = 0
+↓@objc func f() {}
+}
+
+
class C {
+var x = 0
+↓@objc
+func f() {}
+}
+
+
class C {
+@objc func f() {
+}
+↓var x = 0
+}
+
+
class C {
+func f() {}
+↓@Wapper
+let isNumber = false
+@Wapper
+var isEnabled = true
+↓func g() {}
+}
+
+
class C {
+#if os(macOS)
+let a = 0
+↓func f() {}
+#endif
+}
+
+
let a = 2
+↓b = 1
+
+ +
+
+ + +
+
+ + + diff --git a/line_length.html b/line_length.html new file mode 100644 index 000000000..745a7ab26 --- /dev/null +++ b/line_length.html @@ -0,0 +1,432 @@ + + + + line_length Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Line Length

+ +

Lines should not span too many characters.

+ +
    +
  • Identifier: line_length
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: metrics
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +warning + +120 +
    +error + +200 +
    +ignores_urls + +false +
    +ignores_function_declarations + +false +
    +ignores_comments + +false +
    +ignores_interpolated_strings + +false +
    +excluded_lines_patterns + +[] +
  • +
+

Non Triggering Examples

+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)
+
+
#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")
+
+

Triggering Examples

+
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)#colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)
+
+
#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")#imageLiteral(resourceName: "image.jpg")
+
+ +
+
+ + +
+
+ + + diff --git a/literal_expression_end_indentation.html b/literal_expression_end_indentation.html new file mode 100644 index 000000000..e6ddf7251 --- /dev/null +++ b/literal_expression_end_indentation.html @@ -0,0 +1,417 @@ + + + + literal_expression_end_indentation Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Literal Expression End Indentation

+ +

Array and dictionary literal end should have the same indentation as the line that started it

+ +
    +
  • Identifier: literal_expression_end_indentation
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
[1, 2, 3]
+
+
[1,
+ 2
+]
+
+
[
+   1,
+   2
+]
+
+
[
+   1,
+   2]
+
+
   let x = [
+       1,
+       2
+   ]
+
+
[key: 2, key2: 3]
+
+
[key: 1,
+ key2: 2
+]
+
+
[
+   key: 0,
+   key2: 20
+]
+
+

Triggering Examples

+
let x = [
+   1,
+   2
+   ↓]
+
+
   let x = [
+       1,
+       2
+↓]
+
+
let x = [
+   key: value
+   ↓]
+
+ +
+
+ + +
+
+ + + diff --git a/local_doc_comment.html b/local_doc_comment.html new file mode 100644 index 000000000..e4be0b998 --- /dev/null +++ b/local_doc_comment.html @@ -0,0 +1,392 @@ + + + + local_doc_comment Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Local Doc Comment

+ +

Prefer regular comments over doc comments in local scopes

+ +
    +
  • Identifier: local_doc_comment
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func foo() {
+  // Local scope documentation should use normal comments.
+  print("foo")
+}
+
+
/// My great property
+var myGreatProperty: String!
+
+
/// Look here for more info: https://github.com.
+var myGreatProperty: String!
+
+
/// Look here for more info:
+/// https://github.com.
+var myGreatProperty: String!
+
+

Triggering Examples

+
func foo() {
+  ↓/// Docstring inside a function declaration
+  print("foo")
+}
+
+ +
+
+ + +
+
+ + + diff --git a/lower_acl_than_parent.html b/lower_acl_than_parent.html new file mode 100644 index 000000000..552121ade --- /dev/null +++ b/lower_acl_than_parent.html @@ -0,0 +1,444 @@ + + + + lower_acl_than_parent Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Lower ACL than Parent

+ +

Ensure declarations have a lower access control level than their enclosing parent

+ +
    +
  • Identifier: lower_acl_than_parent
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
public struct Foo { public func bar() {} }
+
+
internal struct Foo { func bar() {} }
+
+
struct Foo { func bar() {} }
+
+
struct Foo { internal func bar() {} }
+
+
open class Foo { public func bar() {} }
+
+
open class Foo { open func bar() {} }
+
+
fileprivate struct Foo { private func bar() {} }
+
+
private struct Foo { private func bar(id: String) }
+
+
extension Foo { public func bar() {} }
+
+
private struct Foo { fileprivate func bar() {} }
+
+
private func foo(id: String) {}
+
+
private class Foo { func bar() {} }
+
+
public extension Foo { struct Bar { public func baz() {} }}
+
+
public extension Foo { struct Bar { internal func baz() {} }}
+
+
internal extension Foo { struct Bar { internal func baz() {} }}
+
+
extension Foo { struct Bar { internal func baz() {} }}
+
+

Triggering Examples

+
struct Foo { ↓public func bar() {} }
+
+
enum Foo { ↓public func bar() {} }
+
+
public class Foo { ↓open func bar() }
+
+
class Foo { ↓public private(set) var bar: String? }
+
+
private struct Foo { ↓public func bar() {} }
+
+
private class Foo { ↓public func bar() {} }
+
+
private actor Foo { ↓public func bar() {} }
+
+
fileprivate struct Foo { ↓public func bar() {} }
+
+
class Foo { ↓public func bar() {} }
+
+
actor Foo { ↓public func bar() {} }
+
+
private struct Foo { ↓internal func bar() {} }
+
+
fileprivate struct Foo { ↓internal func bar() {} }
+
+
extension Foo { struct Bar { ↓public func baz() {} }}
+
+
internal extension Foo { struct Bar { ↓public func baz() {} }}
+
+
private extension Foo { struct Bar { ↓public func baz() {} }}
+
+
fileprivate extension Foo { struct Bar { ↓public func baz() {} }}
+
+
private extension Foo { struct Bar { ↓internal func baz() {} }}
+
+
fileprivate extension Foo { struct Bar { ↓internal func baz() {} }}
+
+
public extension Foo { struct Bar { struct Baz { ↓public func qux() {} }}}
+
+
final class Foo { ↓public func bar() {} }
+
+ +
+
+ + +
+
+ + + diff --git a/mark.html b/mark.html new file mode 100644 index 000000000..1af002091 --- /dev/null +++ b/mark.html @@ -0,0 +1,470 @@ + + + + mark Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Mark

+ +

MARK comment should be in valid format. e.g. ‘// MARK: …’ or ‘// MARK: - …’

+ +
    +
  • Identifier: mark
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
// MARK: good
+
+
// MARK: - good
+
+
// MARK: -
+
+
// MARK: - 
+
+
// BOOKMARK
+
+
//BOOKMARK
+
+
// BOOKMARKS
+
+
// MARK: This is good.
+
+
// MARK: - This is good.
+
+
// MARK: --- This is good. ---
+
+
// MARK: – This is dash separator
+
+
// Mark text
+
+
//  MarkdownText.swift
+
+
// MARK: good
+func foo() {
+    let bar = 0
+      // MARK: good
+}
+
+
/*
+func test1() {
+}
+//MARK: mark
+func test2() {
+}
+*/
+
+

Triggering Examples

+
↓//MARK: bad
+
+
↓// MARK:bad
+
+
↓//MARK:bad
+
+
↓//  MARK: bad
+
+
↓// MARK:  bad
+
+
↓// MARK: -bad
+
+
↓// MARK:- bad
+
+
↓// MARK:-bad
+
+
↓//MARK: - bad
+
+
↓//MARK:- bad
+
+
↓//MARK: -bad
+
+
↓//MARK:-bad
+
+
↓//Mark: bad
+
+
↓// Mark: bad
+
+
↓// MARK bad
+
+
↓//MARK bad
+
+
↓// MARK - bad
+
+
↓//MARK : bad
+
+
↓// MARKL:
+
+
↓// MARKR 
+
+
↓// MARKK -
+
+
↓/// MARK:
+
+
↓/// MARK bad
+
+
// MARK: good
+func foo() {
+    let bar = 0
+      ↓//MARK: bad
+}
+
+
↓//MARK:- Top-Level bad mark
+↓//MARK:- Another bad mark
+struct MarkTest {}
+↓// MARK:- Bad mark
+extension MarkTest {}
+
+ +
+
+ + +
+
+ + + diff --git a/missing_docs.html b/missing_docs.html new file mode 100644 index 000000000..4ef595208 --- /dev/null +++ b/missing_docs.html @@ -0,0 +1,581 @@ + + + + missing_docs Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Missing Docs

+ +

Declarations should be documented.

+ +
    +
  • Identifier: missing_docs
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +warning + +[open, public] +
    +excludes_extensions + +true +
    +excludes_inherited_types + +true +
    +excludes_trivial_init + +false +
    +evaluate_effective_access_control_level + +false +
  • +
+

Non Triggering Examples

+
/// docs
+public class A {
+/// docs
+public func b() {}
+}
+// no docs
+public class B: A { override public func b() {} }
+
+
import Foundation
+// no docs
+public class B: NSObject {
+// no docs
+override public var description: String { fatalError() } }
+
+
/// docs
+public class A {
+    var j = 1
+    var i: Int { 1 }
+    func f() {}
+    deinit {}
+}
+
+
public extension A {}
+
+
enum E {
+    case A
+}
+
+
//
+// excludes_trivial_init: true
+//
+
+/// docs
+public class A {
+    public init() {}
+}
+
+
+
//
+// evaluate_effective_access_control_level: true
+//
+
+class C {
+    public func f() {}
+}
+
+
+
public struct S: ~Copyable, P {
+    public init() {}
+}
+
+

Triggering Examples

+
public ↓func a() {}
+
+
// regular comment
+public ↓func a() {}
+
+
/* regular comment */
+public ↓func a() {}
+
+
/// docs
+public protocol A {
+    // no docs
+    ↓var b: Int { get }
+}
+/// docs
+public struct C: A {
+    public let b: Int
+}
+
+
/// a doc
+public class C {
+    public static ↓let i = 1
+}
+
+
public extension A {
+    public ↓func f() {}
+    static ↓var i: Int { 1 }
+    ↓struct S {
+        func f() {}
+    }
+    ↓class C {
+        func f() {}
+    }
+    ↓actor A {
+        func f() {}
+    }
+    ↓enum E {
+        ↓case a
+        func f() {}
+    }
+}
+
+
public extension A {
+    ↓enum E {
+        enum Inner {
+            case a
+        }
+    }
+}
+
+
extension E {
+    public ↓struct S {
+        public static ↓let i = 1
+    }
+}
+
+
extension E {
+    public ↓func f() {}
+}
+
+
//
+// excludes_trivial_init: true
+//
+
+/// docs
+public class A {
+    public ↓init(argument: String) {}
+}
+
+
+
//
+// excludes_inherited_types: false
+//
+
+public ↓struct C: A {
+    public ↓let b: Int
+}
+
+
+
//
+// excludes_extensions: false
+//
+
+public ↓extension A {
+    public ↓func f() {}
+}
+
+
+
public extension E {
+    ↓var i: Int {
+        let j = 1
+        func f() {}
+        return j
+    }
+}
+
+
#if os(macOS)
+public ↓func f() {}
+#endif
+
+
public ↓enum E {
+    ↓case A, B
+    func f() {}
+    init(_ i: Int) { self = .A }
+}
+
+
/// a doc
+public struct S {}
+public extension S {
+    ↓enum E {
+        ↓case A
+    }
+}
+
+
//
+// evaluate_effective_access_control_level: false
+//
+
+class C {
+    public ↓func f() {}
+}
+
+
+
public ↓struct S: ~Copyable, ~Escapable {
+    public ↓init() {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/modifier_order.html b/modifier_order.html new file mode 100644 index 000000000..af9a56594 --- /dev/null +++ b/modifier_order.html @@ -0,0 +1,567 @@ + + + + modifier_order Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Modifier Order

+ +

Modifier order should be consistent.

+ +
    +
  • Identifier: modifier_order
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +preferred_modifier_order + +[override, acl, setterACL, dynamic, mutators, lazy, final, required, convenience, typeMethods, owned] +
  • +
+

Non Triggering Examples

+
public class Foo {
+   public required convenience init() {}
+}
+
+
public class Foo {
+   public static let bar = 42
+}
+
+
public class Foo {
+   public static var bar: Int {
+       return
+   }
+}
+
+
public class Foo {
+   public class var bar: Int {
+       return 42
+   }
+}
+
+
public class Bar {
+   public class var foo: String {
+       return "foo"
+   }
+}
+public class Foo: Bar {
+   override public final class var foo: String {
+       return "bar"
+   }
+}
+
+
open class Bar {
+   public var foo: Int? {
+       return 42
+   }
+}
+open class Foo: Bar {
+   override public var foo: Int? {
+       return 43
+   }
+}
+
+
open class Bar {
+   open class func foo() -> Int {
+       return 42
+   }
+}
+class Foo: Bar {
+   override open class func foo() -> Int {
+       return 43
+   }
+}
+
+
protocol Foo: class {}
+class Bar {
+    public private(set) weak var foo: Foo?
+}
+
+
@objc
+public final class Foo: NSObject {}
+
+
@objcMembers
+public final class Foo: NSObject {}
+
+
@objc
+override public private(set) weak var foo: Bar?
+
+
@objc
+public final class Foo: NSObject {}
+
+
@objc
+open final class Foo: NSObject {
+   open weak var weakBar: NSString? = nil
+}
+
+
public final class Foo {}
+
+
class Bar {
+   func bar() {}
+}
+
+
internal class Foo: Bar {
+   override internal func bar() {}
+}
+
+
public struct Foo {
+   internal weak var weakBar: NSObject? = nil
+}
+
+
class Foo {
+   internal lazy var bar: String = "foo"
+}
+
+

Triggering Examples

+
class Foo {
+   convenience required public init() {}
+}
+
+
public class Foo {
+   static public let bar = 42
+}
+
+
public class Foo {
+   static public var bar: Int {
+       return 42
+   }
+}
+
+
public class Foo {
+   class public var bar: Int {
+       return 42
+   }
+}
+
+
public class RootFoo {
+   class public var foo: String {
+       return "foo"
+   }
+}
+public class Foo: RootFoo {
+   override final class public var foo: String
+       return "bar"
+   }
+}
+
+
open class Bar {
+   public var foo: Int? {
+       return 42
+   }
+}
+open class Foo: Bar {
+    public override var foo: Int? {
+       return 43
+   }
+}
+
+
protocol Foo: class {}
+    class Bar {
+        private(set) public weak var foo: Foo?
+}
+
+
open class Bar {
+   open class func foo() -> Int {
+       return 42
+   }
+}
+class Foo: Bar {
+   class open override func foo() -> Int {
+       return 43
+   }
+}
+
+
open class Bar {
+   open class func foo() -> Int {
+       return 42
+   }
+}
+class Foo: Bar {
+   open override class func foo() -> Int {
+       return 43
+   }
+}
+
+
@objc
+final public class Foo: NSObject {}
+
+
@objcMembers
+final public class Foo: NSObject {}
+
+
@objc
+final open class Foo: NSObject {
+   weak open var weakBar: NSString? = nil
+}
+
+
final public class Foo {}
+
+
internal class Foo: Bar {
+   internal override func bar() {}
+}
+
+
public struct Foo {
+   weak internal var weakBar: NSObjetc? = nil
+}
+
+
class Foo {
+   lazy internal var bar: String = "foo"
+}
+
+ +
+
+ + +
+
+ + + diff --git a/multiline_arguments.html b/multiline_arguments.html new file mode 100644 index 000000000..727a2675b --- /dev/null +++ b/multiline_arguments.html @@ -0,0 +1,473 @@ + + + + multiline_arguments Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Multiline Arguments

+ +

Arguments should be either on the same line, or one per line

+ +
    +
  • Identifier: multiline_arguments
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +first_argument_location + +any_line +
    +only_enforce_after_first_closure_on_first_line + +false +
  • +
+

Non Triggering Examples

+
foo()
+
+
foo(
+)
+
+
foo { }
+
+
foo {
+
+}
+
+
foo(0)
+
+
foo(0, 1)
+
+
foo(0, 1) { }
+
+
foo(0, param1: 1)
+
+
foo(0, param1: 1) { }
+
+
foo(param1: 1)
+
+
foo(param1: 1) { }
+
+
foo(param1: 1, param2: true) { }
+
+
foo(param1: 1, param2: true, param3: [3]) { }
+
+
foo(param1: 1, param2: true, param3: [3]) {
+    bar()
+}
+
+
foo(param1: 1,
+    param2: true,
+    param3: [3])
+
+
foo(
+    param1: 1, param2: true, param3: [3]
+)
+
+
foo(
+    param1: 1,
+    param2: true,
+    param3: [3]
+)
+
+
Picker(selection: viewStore.binding(\.$someProperty)) {
+   ForEach(SomeEnum.allCases, id: \.rawValue) { someCase in
+      Text(someCase.rawValue)
+         .tag(someCase)
+   }
+} label: {
+   EmptyView()
+}
+
+
UIView.animate(withDuration: 1,
+               delay: 0) {
+    // sample
+    print("a")
+} completion: { _ in
+    // sample
+    print("b")
+}
+
+
UIView.animate(withDuration: 1, delay: 0) {
+    print("a")
+} completion: { _ in
+    print("b")
+}
+
+

Triggering Examples

+
foo(0,
+    param1: 1, ↓param2: true, ↓param3: [3])
+
+
foo(0, ↓param1: 1,
+    param2: true, ↓param3: [3])
+
+
foo(0, ↓param1: 1, ↓param2: true,
+    param3: [3])
+
+
foo(
+    0, ↓param1: 1,
+    param2: true, ↓param3: [3]
+)
+
+ +
+
+ + +
+
+ + + diff --git a/multiline_arguments_brackets.html b/multiline_arguments_brackets.html new file mode 100644 index 000000000..18152081c --- /dev/null +++ b/multiline_arguments_brackets.html @@ -0,0 +1,480 @@ + + + + multiline_arguments_brackets Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Multiline Arguments Brackets

+ +

Multiline arguments should have their surrounding brackets in a new line

+ +
    +
  • Identifier: multiline_arguments_brackets
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
foo(param1: "Param1", param2: "Param2", param3: "Param3")
+
+
foo(
+    param1: "Param1", param2: "Param2", param3: "Param3"
+)
+
+
func foo(
+    param1: "Param1",
+    param2: "Param2",
+    param3: "Param3"
+)
+
+
foo { param1, param2 in
+    print("hello world")
+}
+
+
foo(
+    bar(
+        x: 5,
+        y: 7
+    )
+)
+
+
AlertViewModel.AlertAction(title: "some title", style: .default) {
+    AlertManager.shared.presentNextDebugAlert()
+}
+
+
public final class Logger {
+    public static let shared = Logger(outputs: [
+        OSLoggerOutput(),
+        ErrorLoggerOutput()
+    ])
+}
+
+
let errors = try self.download([
+    (description: description, priority: priority),
+])
+
+
return SignalProducer({ observer, _ in
+    observer.sendCompleted()
+}).onMainQueue()
+
+
SomeType(a: [
+    1, 2, 3
+], b: [1, 2])
+
+
SomeType(
+  a: 1
+) { print("completion") }
+
+
SomeType(
+  a: 1
+) {
+  print("completion")
+}
+
+
SomeType(
+  a: .init() { print("completion") }
+)
+
+
SomeType(
+  a: .init() {
+    print("completion")
+  }
+)
+
+
SomeType(
+  a: 1
+) {} onError: {}
+
+

Triggering Examples

+
foo(↓param1: "Param1", param2: "Param2",
+         param3: "Param3"
+)
+
+
foo(
+    param1: "Param1",
+    param2: "Param2",
+    param3: "Param3"↓)
+
+
foo(↓param1: "Param1",
+    param2: "Param2",
+    param3: "Param3"↓)
+
+
foo(↓bar(
+    x: 5,
+    y: 7
+)
+)
+
+
foo(
+    bar(
+        x: 5,
+        y: 7
+)↓)
+
+
SomeOtherType(↓a: [
+        1, 2, 3
+    ],
+    b: "two"↓)
+
+
SomeOtherType(
+  a: 1↓) {}
+
+
SomeOtherType(
+  a: 1↓) {
+  print("completion")
+}
+
+ +
+
+ + +
+
+ + + diff --git a/multiline_function_chains.html b/multiline_function_chains.html new file mode 100644 index 000000000..7d61faf26 --- /dev/null +++ b/multiline_function_chains.html @@ -0,0 +1,439 @@ + + + + multiline_function_chains Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Multiline Function Chains

+ +

Chained function calls should be either on the same line, or one per line

+ +
    +
  • Identifier: multiline_function_chains
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let evenSquaresSum = [20, 17, 35, 4].filter { $0 % 2 == 0 }.map { $0 * $0 }.reduce(0, +)
+
+
let evenSquaresSum = [20, 17, 35, 4]
+    .filter { $0 % 2 == 0 }.map { $0 * $0 }.reduce(0, +)",
+
+
let chain = a
+    .b(1, 2, 3)
+    .c { blah in
+        print(blah)
+    }
+    .d()
+
+
let chain = a.b(1, 2, 3)
+    .c { blah in
+        print(blah)
+    }
+    .d()
+
+
let chain = a.b(1, 2, 3)
+    .c { blah in print(blah) }
+    .d()
+
+
let chain = a.b(1, 2, 3)
+    .c(.init(
+        a: 1,
+        b, 2,
+        c, 3))
+    .d()
+
+
self.viewModel.outputs.postContextualNotification
+  .observeForUI()
+  .observeValues {
+    NotificationCenter.default.post(
+      Notification(
+        name: .ksr_showNotificationsDialog,
+        userInfo: [UserInfoKeys.context: PushNotificationDialog.Context.pledge,
+                   UserInfoKeys.viewController: self]
+     )
+    )
+  }
+
+
let remainingIDs = Array(Set(self.currentIDs).subtracting(Set(response.ids)))
+
+
self.happeningNewsletterOn = self.updateCurrentUser
+    .map { $0.newsletters.happening }.skipNil().skipRepeats()
+
+

Triggering Examples

+
let evenSquaresSum = [20, 17, 35, 4]
+    .filter { $0 % 2 == 0 }↓.map { $0 * $0 }
+    .reduce(0, +)
+
+
let evenSquaresSum = a.b(1, 2, 3)
+    .c { blah in
+        print(blah)
+    }↓.d()
+
+
let evenSquaresSum = a.b(1, 2, 3)
+    .c(2, 3, 4)↓.d()
+
+
let evenSquaresSum = a.b(1, 2, 3)↓.c { blah in
+        print(blah)
+    }
+    .d()
+
+
a.b {
+//  ““
+}↓.e()
+
+ +
+
+ + +
+
+ + + diff --git a/multiline_literal_brackets.html b/multiline_literal_brackets.html new file mode 100644 index 000000000..cfef25a0b --- /dev/null +++ b/multiline_literal_brackets.html @@ -0,0 +1,454 @@ + + + + multiline_literal_brackets Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Multiline Literal Brackets

+ +

Multiline literals should have their surrounding brackets in a new line

+ +
    +
  • Identifier: multiline_literal_brackets
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let trio = ["harry", "ronald", "hermione"]
+let houseCup = ["gryffindor": 460, "hufflepuff": 370, "ravenclaw": 410, "slytherin": 450]
+
+
let trio = [
+    "harry",
+    "ronald",
+    "hermione"
+]
+let houseCup = [
+    "gryffindor": 460,
+    "hufflepuff": 370,
+    "ravenclaw": 410,
+    "slytherin": 450
+]
+
+
let trio = [
+    "harry", "ronald", "hermione"
+]
+let houseCup = [
+    "gryffindor": 460, "hufflepuff": 370,
+    "ravenclaw": 410, "slytherin": 450
+]
+
+
_ = [
+    1,
+    2,
+    3,
+    4,
+    5, 6,
+    7, 8, 9
+]
+
+

Triggering Examples

+
let trio = [↓"harry",
+            "ronald",
+            "hermione"
+]
+
+
let houseCup = [↓"gryffindor": 460, "hufflepuff": 370,
+                "ravenclaw": 410, "slytherin": 450
+]
+
+
let houseCup = [↓"gryffindor": 460,
+                "hufflepuff": 370,
+                "ravenclaw": 410,
+                "slytherin": 450↓]
+
+
let trio = [
+    "harry",
+    "ronald",
+    "hermione"↓]
+
+
let houseCup = [
+    "gryffindor": 460, "hufflepuff": 370,
+    "ravenclaw": 410, "slytherin": 450↓]
+
+
class Hogwarts {
+    let houseCup = [
+        "gryffindor": 460, "hufflepuff": 370,
+        "ravenclaw": 410, "slytherin": 450↓]
+}
+
+
_ = [
+    1,
+    2,
+    3,
+    4,
+    5, 6,
+    7, 8, 9↓]
+
+
_ = [↓1, 2, 3,
+     4, 5, 6,
+     7, 8, 9
+]
+
+
class Hogwarts {
+    let houseCup = [
+        "gryffindor": 460, "hufflepuff": 370,
+        "ravenclaw": 410, "slytherin": slytherinPoints.filter {
+            $0.isValid
+        }.sum()↓]
+}
+
+ +
+
+ + +
+
+ + + diff --git a/multiline_parameters.html b/multiline_parameters.html new file mode 100644 index 000000000..e92bd7b41 --- /dev/null +++ b/multiline_parameters.html @@ -0,0 +1,804 @@ + + + + multiline_parameters Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Multiline Parameters

+ +

Functions and methods parameters should be either on the same line, or one per line

+ +
    +
  • Identifier: multiline_parameters
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +allows_single_line + +true +
  • +
+

Non Triggering Examples

+
func foo() { }
+
+
func foo(param1: Int) { }
+
+
func foo(param1: Int, param2: Bool) { }
+
+
func foo(param1: Int, param2: Bool, param3: [String]) { }
+
+
func foo(param1: Int,
+         param2: Bool,
+         param3: [String]) { }
+
+
func foo(_ param1: Int, param2: Int, param3: Int) -> (Int) -> Int {
+   return { x in x + param1 + param2 + param3 }
+}
+
+
static func foo() { }
+
+
static func foo(param1: Int) { }
+
+
static func foo(param1: Int, param2: Bool) { }
+
+
static func foo(param1: Int, param2: Bool, param3: [String]) { }
+
+
static func foo(param1: Int,
+                param2: Bool,
+                param3: [String]) { }
+
+
protocol Foo {
+    func foo() { }
+}
+
+
protocol Foo {
+    func foo(param1: Int) { }
+}
+
+
protocol Foo {
+    func foo(param1: Int, param2: Bool) { }
+}
+
+
protocol Foo {
+    func foo(param1: Int, param2: Bool, param3: [String]) { }
+}
+
+
protocol Foo {
+   func foo(param1: Int,
+            param2: Bool,
+            param3: [String]) { }
+}
+
+
protocol Foo {
+    static func foo(param1: Int, param2: Bool, param3: [String]) { }
+}
+
+
protocol Foo {
+   static func foo(param1: Int,
+                   param2: Bool,
+                   param3: [String]) { }
+}
+
+
protocol Foo {
+    class func foo(param1: Int, param2: Bool, param3: [String]) { }
+}
+
+
protocol Foo {
+   class func foo(param1: Int,
+                  param2: Bool,
+                  param3: [String]) { }
+}
+
+
enum Foo {
+    func foo() { }
+}
+
+
enum Foo {
+    func foo(param1: Int) { }
+}
+
+
enum Foo {
+    func foo(param1: Int, param2: Bool) { }
+}
+
+
enum Foo {
+    func foo(param1: Int, param2: Bool, param3: [String]) { }
+}
+
+
enum Foo {
+   func foo(param1: Int,
+            param2: Bool,
+            param3: [String]) { }
+}
+
+
enum Foo {
+    static func foo(param1: Int, param2: Bool, param3: [String]) { }
+}
+
+
enum Foo {
+   static func foo(param1: Int,
+                   param2: Bool,
+                   param3: [String]) { }
+}
+
+
struct Foo {
+    func foo() { }
+}
+
+
struct Foo {
+    func foo(param1: Int) { }
+}
+
+
struct Foo {
+    func foo(param1: Int, param2: Bool) { }
+}
+
+
struct Foo {
+    func foo(param1: Int, param2: Bool, param3: [String]) { }
+}
+
+
struct Foo {
+   func foo(param1: Int,
+            param2: Bool,
+            param3: [String]) { }
+}
+
+
struct Foo {
+    static func foo(param1: Int, param2: Bool, param3: [String]) { }
+}
+
+
struct Foo {
+   static func foo(param1: Int,
+                   param2: Bool,
+                   param3: [String]) { }
+}
+
+
class Foo {
+    func foo() { }
+}
+
+
class Foo {
+    func foo(param1: Int) { }
+}
+
+
class Foo {
+    func foo(param1: Int, param2: Bool) { }
+}
+
+
class Foo {
+    func foo(param1: Int, param2: Bool, param3: [String]) { }
+    }
+
+
class Foo {
+   func foo(param1: Int,
+            param2: Bool,
+            param3: [String]) { }
+}
+
+
class Foo {
+    class func foo(param1: Int, param2: Bool, param3: [String]) { }
+}
+
+
class Foo {
+   class func foo(param1: Int,
+                  param2: Bool,
+                  param3: [String]) { }
+}
+
+
class Foo {
+   class func foo(param1: Int,
+                  param2: Bool,
+                  param3: @escaping (Int, Int) -> Void = { _, _ in }) { }
+}
+
+
class Foo {
+   class func foo(param1: Int,
+                  param2: Bool,
+                  param3: @escaping (Int) -> Void = { _ in }) { }
+}
+
+
class Foo {
+   class func foo(param1: Int,
+                  param2: Bool,
+                  param3: @escaping ((Int) -> Void)? = nil) { }
+}
+
+
class Foo {
+   class func foo(param1: Int,
+                  param2: Bool,
+                  param3: @escaping ((Int) -> Void)? = { _ in }) { }
+}
+
+
class Foo {
+   class func foo(param1: Int,
+                  param2: @escaping ((Int) -> Void)? = { _ in },
+                  param3: Bool) { }
+}
+
+
class Foo {
+   class func foo(param1: Int,
+                  param2: @escaping ((Int) -> Void)? = { _ in },
+                  param3: @escaping (Int, Int) -> Void = { _, _ in }) { }
+}
+
+
class Foo {
+   class func foo(param1: Int,
+                  param2: Bool,
+                  param3: @escaping (Int) -> Void = { (x: Int) in }) { }
+}
+
+
class Foo {
+   class func foo(param1: Int,
+                  param2: Bool,
+                  param3: @escaping (Int, (Int) -> Void) -> Void = { (x: Int, f: (Int) -> Void) in }) { }
+}
+
+
class Foo {
+   init(param1: Int,
+        param2: Bool,
+        param3: @escaping ((Int) -> Void)? = { _ in }) { }
+}
+
+
//
+// allows_single_line: false
+//
+
+func foo() { }
+
+
+
//
+// allows_single_line: false
+//
+
+func foo(param1: Int) { }
+
+
+
//
+// allows_single_line: false
+//
+
+protocol Foo {
+    func foo(param1: Int,
+             param2: Bool,
+             param3: [String]) { }
+}
+
+
+
//
+// allows_single_line: false
+//
+
+protocol Foo {
+    func foo(
+        param1: Int
+    ) { }
+}
+
+
+
//
+// allows_single_line: false
+//
+
+protocol Foo {
+    func foo(
+        param1: Int,
+        param2: Bool,
+        param3: [String]
+    ) { }
+}
+
+
+
//
+// max_number_of_single_line_parameters: 3
+//
+
+func foo(param1: Int, param2: Bool, param3: [String]) { }
+
+
+
//
+// max_number_of_single_line_parameters: 3
+//
+
+func foo(param1: Int,
+         param2: Bool,
+         param3: [String]) { }
+
+
+

Triggering Examples

+
func ↓foo(_ param1: Int,
+          param2: Int, param3: Int) -> (Int) -> Int {
+   return { x in x + param1 + param2 + param3 }
+}
+
+
protocol Foo {
+   func ↓foo(param1: Int,
+             param2: Bool, param3: [String]) { }
+}
+
+
protocol Foo {
+   func ↓foo(param1: Int, param2: Bool,
+             param3: [String]) { }
+}
+
+
protocol Foo {
+   static func ↓foo(param1: Int,
+                    param2: Bool, param3: [String]) { }
+}
+
+
protocol Foo {
+   static func ↓foo(param1: Int, param2: Bool,
+                    param3: [String]) { }
+}
+
+
protocol Foo {
+   class func ↓foo(param1: Int,
+                   param2: Bool, param3: [String]) { }
+}
+
+
protocol Foo {
+   class func ↓foo(param1: Int, param2: Bool,
+                   param3: [String]) { }
+}
+
+
enum Foo {
+   func ↓foo(param1: Int,
+             param2: Bool, param3: [String]) { }
+}
+
+
enum Foo {
+   func ↓foo(param1: Int, param2: Bool,
+             param3: [String]) { }
+}
+
+
enum Foo {
+   static func ↓foo(param1: Int,
+                    param2: Bool, param3: [String]) { }
+}
+
+
enum Foo {
+   static func ↓foo(param1: Int, param2: Bool,
+                    param3: [String]) { }
+}
+
+
struct Foo {
+   func ↓foo(param1: Int,
+             param2: Bool, param3: [String]) { }
+}
+
+
struct Foo {
+   func ↓foo(param1: Int, param2: Bool,
+             param3: [String]) { }
+}
+
+
struct Foo {
+   static func ↓foo(param1: Int,
+                    param2: Bool, param3: [String]) { }
+}
+
+
struct Foo {
+   static func ↓foo(param1: Int, param2: Bool,
+                    param3: [String]) { }
+}
+
+
class Foo {
+   func ↓foo(param1: Int,
+             param2: Bool, param3: [String]) { }
+}
+
+
class Foo {
+   func ↓foo(param1: Int, param2: Bool,
+             param3: [String]) { }
+}
+
+
class Foo {
+   class func ↓foo(param1: Int,
+                   param2: Bool, param3: [String]) { }
+}
+
+
class Foo {
+   class func ↓foo(param1: Int, param2: Bool,
+                   param3: [String]) { }
+}
+
+
class Foo {
+   class func ↓foo(param1: Int,
+                  param2: Bool, param3: @escaping (Int, Int) -> Void = { _, _ in }) { }
+}
+
+
class Foo {
+   class func ↓foo(param1: Int,
+                  param2: Bool, param3: @escaping (Int) -> Void = { (x: Int) in }) { }
+}
+
+
class Foo {
+  ↓init(param1: Int, param2: Bool,
+        param3: @escaping ((Int) -> Void)? = { _ in }) { }
+}
+
+
//
+// allows_single_line: false
+//
+
+func ↓foo(param1: Int, param2: Bool) { }
+
+
+
//
+// allows_single_line: false
+//
+
+func ↓foo(param1: Int, param2: Bool, param3: [String]) { }
+
+
+
//
+// max_number_of_single_line_parameters: 2
+//
+
+func ↓foo(param1: Int, param2: Bool, param3: [String]) { }
+
+
+
//
+// max_number_of_single_line_parameters: 3
+//
+
+func ↓foo(param1: Int,
+          param2: Bool, param3: [String]) { }
+
+
+ +
+
+ + +
+
+ + + diff --git a/multiline_parameters_brackets.html b/multiline_parameters_brackets.html new file mode 100644 index 000000000..c24d978ec --- /dev/null +++ b/multiline_parameters_brackets.html @@ -0,0 +1,434 @@ + + + + multiline_parameters_brackets Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Multiline Parameters Brackets

+ +

Multiline parameters should have their surrounding brackets in a new line

+ +
    +
  • Identifier: multiline_parameters_brackets
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func foo(param1: String, param2: String, param3: String)
+
+
func foo(
+    param1: String, param2: String, param3: String
+)
+
+
func foo(
+    param1: String,
+    param2: String,
+    param3: String
+)
+
+
class SomeType {
+    func foo(param1: String, param2: String, param3: String)
+}
+
+
class SomeType {
+    func foo(
+        param1: String, param2: String, param3: String
+    )
+}
+
+
class SomeType {
+    func foo(
+        param1: String,
+        param2: String,
+        param3: String
+    )
+}
+
+
func foo<T>(param1: T, param2: String, param3: String) -> T { /* some code */ }
+
+
    func foo(a: [Int] = [
+        1
+    ])
+
+

Triggering Examples

+
func foo(↓param1: String, param2: String,
+         param3: String
+)
+
+
func foo(
+    param1: String,
+    param2: String,
+    param3: String↓)
+
+
class SomeType {
+    func foo(↓param1: String, param2: String,
+             param3: String
+    )
+}
+
+
class SomeType {
+    func foo(
+        param1: String,
+        param2: String,
+        param3: String↓)
+}
+
+
func foo<T>(↓param1: T, param2: String,
+         param3: String
+) -> T
+
+ +
+
+ + +
+
+ + + diff --git a/multiple_closures_with_trailing_closure.html b/multiple_closures_with_trailing_closure.html new file mode 100644 index 000000000..099132987 --- /dev/null +++ b/multiple_closures_with_trailing_closure.html @@ -0,0 +1,402 @@ + + + + multiple_closures_with_trailing_closure Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Multiple Closures with Trailing Closure

+ +

Trailing closure syntax should not be used when passing more than one closure argument

+ +
    +
  • Identifier: multiple_closures_with_trailing_closure
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
foo.map { $0 + 1 }
+
+
foo.reduce(0) { $0 + $1 }
+
+
if let foo = bar.map({ $0 + 1 }) {
+
+}
+
+
foo.something(param1: { $0 }, param2: { $0 + 1 })
+
+
UIView.animate(withDuration: 1.0) {
+    someView.alpha = 0.0
+}
+
+
foo.method { print(0) } arg2: { print(1) }
+
+
foo.methodWithParenArgs((0, 1), arg2: (0, 1, 2)) { $0 } arg4: { $0 }
+
+

Triggering Examples

+
foo.something(param1: { $0 }) ↓{ $0 + 1 }
+
+
UIView.animate(withDuration: 1.0, animations: {
+    someView.alpha = 0.0
+}) ↓{ _ in
+    someView.removeFromSuperview()
+}
+
+
foo.multipleTrailing(arg1: { $0 }) { $0 } arg3: { $0 }
+
+
foo.methodWithParenArgs(param1: { $0 }, param2: (0, 1), (0, 1)) { $0 }
+
+ +
+
+ + +
+
+ + + diff --git a/nesting.html b/nesting.html new file mode 100644 index 000000000..9e95d371e --- /dev/null +++ b/nesting.html @@ -0,0 +1,1566 @@ + + + + nesting Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Nesting

+ +

Types should be nested at most 1 level deep, and functions should be nested at most 2 levels deep.

+ +
    +
  • Identifier: nesting
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: metrics
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +type_level + + + + + + + + + + + +
    KeyValue
    +warning + +1 +
    +
    +function_level + + + + + + + + + + + +
    KeyValue
    +warning + +2 +
    +
    +check_nesting_in_closures_and_statements + +true +
    +always_allow_one_type_in_functions + +false +
    +ignore_typealiases_and_associatedtypes + +false +
  • +
+

Non Triggering Examples

+
actor Example_0 {
+    actor Example_1 {}
+}
+
+
var example: Int {
+    actor Example_0 {
+        actor Example_1 {}
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        actor Example_0 {
+            actor Example_1 {}
+        }
+    }
+}
+
+
extension Example_0 {
+    actor Example_1 {}
+}
+
+
class Example_0 {
+    class Example_1 {}
+}
+
+
var example: Int {
+    class Example_0 {
+        class Example_1 {}
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        class Example_0 {
+            class Example_1 {}
+        }
+    }
+}
+
+
extension Example_0 {
+    class Example_1 {}
+}
+
+
struct Example_0 {
+    struct Example_1 {}
+}
+
+
var example: Int {
+    struct Example_0 {
+        struct Example_1 {}
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        struct Example_0 {
+            struct Example_1 {}
+        }
+    }
+}
+
+
extension Example_0 {
+    struct Example_1 {}
+}
+
+
enum Example_0 {
+    enum Example_1 {}
+}
+
+
var example: Int {
+    enum Example_0 {
+        enum Example_1 {}
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        enum Example_0 {
+            enum Example_1 {}
+        }
+    }
+}
+
+
extension Example_0 {
+    enum Example_1 {}
+}
+
+
func f_0() {
+    func f_1() {
+        func f_2() {}
+    }
+}
+
+
var example: Int {
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        func f_0() {
+            func f_1() {
+                func f_2() {}
+            }
+        }
+    }
+}
+
+
extension Example_0 {
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+}
+
+
switch example {
+case .exampleCase:
+    actor Example_0 {
+        actor Example_1 {}
+    }
+default:
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+}
+
+
var exampleClosure: () -> Void = {
+    actor Example_0 {
+        actor Example_1 {}
+    }
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+}
+
+
exampleFunc(closure: {
+    actor Example_0 {
+        actor Example_1 {}
+    }
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+})
+
+
switch example {
+case .exampleCase:
+    class Example_0 {
+        class Example_1 {}
+    }
+default:
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+}
+
+
var exampleClosure: () -> Void = {
+    class Example_0 {
+        class Example_1 {}
+    }
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+}
+
+
exampleFunc(closure: {
+    class Example_0 {
+        class Example_1 {}
+    }
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+})
+
+
switch example {
+case .exampleCase:
+    struct Example_0 {
+        struct Example_1 {}
+    }
+default:
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+}
+
+
var exampleClosure: () -> Void = {
+    struct Example_0 {
+        struct Example_1 {}
+    }
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+}
+
+
exampleFunc(closure: {
+    struct Example_0 {
+        struct Example_1 {}
+    }
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+})
+
+
switch example {
+case .exampleCase:
+    enum Example_0 {
+        enum Example_1 {}
+    }
+default:
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+}
+
+
var exampleClosure: () -> Void = {
+    enum Example_0 {
+        enum Example_1 {}
+    }
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+}
+
+
exampleFunc(closure: {
+    enum Example_0 {
+        enum Example_1 {}
+    }
+    func f_0() {
+        func f_1() {
+            func f_2() {}
+        }
+    }
+})
+
+
actor Example_0 {
+    protocol Example_1 {}
+}
+
+
var example: Int {
+    actor Example_0 {
+        protocol Example_1 {}
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        actor Example_0 {
+            protocol Example_1 {}
+        }
+    }
+}
+
+
extension Example_0 {
+    protocol Example_1 {}
+}
+
+
class Example_0 {
+    protocol Example_1 {}
+}
+
+
var example: Int {
+    class Example_0 {
+        protocol Example_1 {}
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        class Example_0 {
+            protocol Example_1 {}
+        }
+    }
+}
+
+
extension Example_0 {
+    protocol Example_1 {}
+}
+
+
struct Example_0 {
+    protocol Example_1 {}
+}
+
+
var example: Int {
+    struct Example_0 {
+        protocol Example_1 {}
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        struct Example_0 {
+            protocol Example_1 {}
+        }
+    }
+}
+
+
extension Example_0 {
+    protocol Example_1 {}
+}
+
+
enum Example_0 {
+    protocol Example_1 {}
+}
+
+
var example: Int {
+    enum Example_0 {
+        protocol Example_1 {}
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        enum Example_0 {
+            protocol Example_1 {}
+        }
+    }
+}
+
+
extension Example_0 {
+    protocol Example_1 {}
+}
+
+
actor Example_0 {
+    func f_0() {
+        actor Example_1 {
+            func f_1() {
+                func f_2() {}
+            }
+        }
+        protocol P {}
+    }
+}
+
+
actor Example_0 {
+    func f_0() {
+        switch example {
+        case .exampleCase:
+            actor Example_1 {
+                func f_1() {
+                    func f_2() {}
+                }
+            }
+            protocol P {}
+        default:
+            exampleFunc(closure: {
+                actor Example_1 {
+                    func f_1() {
+                        func f_2() {}
+                    }
+                }
+                protocol P {}
+            })
+        }
+    }
+}
+
+
class Example_0 {
+    func f_0() {
+        class Example_1 {
+            func f_1() {
+                func f_2() {}
+            }
+        }
+        protocol P {}
+    }
+}
+
+
class Example_0 {
+    func f_0() {
+        switch example {
+        case .exampleCase:
+            class Example_1 {
+                func f_1() {
+                    func f_2() {}
+                }
+            }
+            protocol P {}
+        default:
+            exampleFunc(closure: {
+                class Example_1 {
+                    func f_1() {
+                        func f_2() {}
+                    }
+                }
+                protocol P {}
+            })
+        }
+    }
+}
+
+
struct Example_0 {
+    func f_0() {
+        struct Example_1 {
+            func f_1() {
+                func f_2() {}
+            }
+        }
+        protocol P {}
+    }
+}
+
+
struct Example_0 {
+    func f_0() {
+        switch example {
+        case .exampleCase:
+            struct Example_1 {
+                func f_1() {
+                    func f_2() {}
+                }
+            }
+            protocol P {}
+        default:
+            exampleFunc(closure: {
+                struct Example_1 {
+                    func f_1() {
+                        func f_2() {}
+                    }
+                }
+                protocol P {}
+            })
+        }
+    }
+}
+
+
enum Example_0 {
+    func f_0() {
+        enum Example_1 {
+            func f_1() {
+                func f_2() {}
+            }
+        }
+        protocol P {}
+    }
+}
+
+
enum Example_0 {
+    func f_0() {
+        switch example {
+        case .exampleCase:
+            enum Example_1 {
+                func f_1() {
+                    func f_2() {}
+                }
+            }
+            protocol P {}
+        default:
+            exampleFunc(closure: {
+                enum Example_1 {
+                    func f_1() {
+                        func f_2() {}
+                    }
+                }
+                protocol P {}
+            })
+        }
+    }
+}
+
+

Triggering Examples

+
actor Example_0 {
+    actor Example_1 {
+        ↓actor Example_2 {}
+    }
+}
+
+
var example: Int {
+    actor Example_0 {
+        actor Example_1 {
+            ↓actor Example_2 {}
+        }
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        actor Example_0 {
+            actor Example_1 {
+                ↓actor Example_2 {}
+            }
+        }
+    }
+}
+
+
extension Example_0 {
+    actor Example_1 {
+        ↓actor Example_2 {}
+    }
+}
+
+
class Example_0 {
+    class Example_1 {
+        ↓class Example_2 {}
+    }
+}
+
+
var example: Int {
+    class Example_0 {
+        class Example_1 {
+            ↓class Example_2 {}
+        }
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        class Example_0 {
+            class Example_1 {
+                ↓class Example_2 {}
+            }
+        }
+    }
+}
+
+
extension Example_0 {
+    class Example_1 {
+        ↓class Example_2 {}
+    }
+}
+
+
struct Example_0 {
+    struct Example_1 {
+        ↓struct Example_2 {}
+    }
+}
+
+
var example: Int {
+    struct Example_0 {
+        struct Example_1 {
+            ↓struct Example_2 {}
+        }
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        struct Example_0 {
+            struct Example_1 {
+                ↓struct Example_2 {}
+            }
+        }
+    }
+}
+
+
extension Example_0 {
+    struct Example_1 {
+        ↓struct Example_2 {}
+    }
+}
+
+
enum Example_0 {
+    enum Example_1 {
+        ↓enum Example_2 {}
+    }
+}
+
+
var example: Int {
+    enum Example_0 {
+        enum Example_1 {
+            ↓enum Example_2 {}
+        }
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        enum Example_0 {
+            enum Example_1 {
+                ↓enum Example_2 {}
+            }
+        }
+    }
+}
+
+
extension Example_0 {
+    enum Example_1 {
+        ↓enum Example_2 {}
+    }
+}
+
+
func f_0() {
+    func f_1() {
+        func f_2() {
+            ↓func f_3() {}
+        }
+    }
+}
+
+
var example: Int {
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        func f_0() {
+            func f_1() {
+                func f_2() {
+                    ↓func f_3() {}
+                }
+            }
+        }
+    }
+}
+
+
extension Example_0 {
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+}
+
+
switch example {
+case .exampleCase:
+    actor Example_0 {
+        actor Example_1 {
+            ↓actor Example_2 {}
+        }
+    }
+default:
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+}
+
+
var exampleClosure: () -> Void = {
+    actor Example_0 {
+        actor Example_1 {
+            ↓actor Example_2 {}
+        }
+        }
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+}
+
+
exampleFunc(closure: {
+    actor Example_0 {
+        actor Example_1 {}
+    }
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+})
+
+
switch example {
+case .exampleCase:
+    class Example_0 {
+        class Example_1 {
+            ↓class Example_2 {}
+        }
+    }
+default:
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+}
+
+
var exampleClosure: () -> Void = {
+    class Example_0 {
+        class Example_1 {
+            ↓class Example_2 {}
+        }
+        }
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+}
+
+
exampleFunc(closure: {
+    class Example_0 {
+        class Example_1 {}
+    }
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+})
+
+
switch example {
+case .exampleCase:
+    struct Example_0 {
+        struct Example_1 {
+            ↓struct Example_2 {}
+        }
+    }
+default:
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+}
+
+
var exampleClosure: () -> Void = {
+    struct Example_0 {
+        struct Example_1 {
+            ↓struct Example_2 {}
+        }
+        }
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+}
+
+
exampleFunc(closure: {
+    struct Example_0 {
+        struct Example_1 {}
+    }
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+})
+
+
switch example {
+case .exampleCase:
+    enum Example_0 {
+        enum Example_1 {
+            ↓enum Example_2 {}
+        }
+    }
+default:
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+}
+
+
var exampleClosure: () -> Void = {
+    enum Example_0 {
+        enum Example_1 {
+            ↓enum Example_2 {}
+        }
+        }
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+}
+
+
exampleFunc(closure: {
+    enum Example_0 {
+        enum Example_1 {}
+    }
+    func f_0() {
+        func f_1() {
+            func f_2() {
+                ↓func f_3() {}
+            }
+        }
+    }
+})
+
+
actor Example_0 {
+    actor Example_1 {
+        ↓protocol Example_2 {}
+    }
+}
+
+
var example: Int {
+    actor Example_0 {
+        actor Example_1 {
+            ↓protocol Example_2 {}
+        }
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        actor Example_0 {
+            actor Example_1 {
+                ↓protocol Example_2 {}
+            }
+        }
+    }
+}
+
+
extension Example_0 {
+    actor Example_1 {
+        ↓protocol Example_2 {}
+    }
+}
+
+
class Example_0 {
+    class Example_1 {
+        ↓protocol Example_2 {}
+    }
+}
+
+
var example: Int {
+    class Example_0 {
+        class Example_1 {
+            ↓protocol Example_2 {}
+        }
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        class Example_0 {
+            class Example_1 {
+                ↓protocol Example_2 {}
+            }
+        }
+    }
+}
+
+
extension Example_0 {
+    class Example_1 {
+        ↓protocol Example_2 {}
+    }
+}
+
+
struct Example_0 {
+    struct Example_1 {
+        ↓protocol Example_2 {}
+    }
+}
+
+
var example: Int {
+    struct Example_0 {
+        struct Example_1 {
+            ↓protocol Example_2 {}
+        }
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        struct Example_0 {
+            struct Example_1 {
+                ↓protocol Example_2 {}
+            }
+        }
+    }
+}
+
+
extension Example_0 {
+    struct Example_1 {
+        ↓protocol Example_2 {}
+    }
+}
+
+
enum Example_0 {
+    enum Example_1 {
+        ↓protocol Example_2 {}
+    }
+}
+
+
var example: Int {
+    enum Example_0 {
+        enum Example_1 {
+            ↓protocol Example_2 {}
+        }
+    }
+    return 5
+}
+
+
var example: Int = 5 {
+    didSet {
+        enum Example_0 {
+            enum Example_1 {
+                ↓protocol Example_2 {}
+            }
+        }
+    }
+}
+
+
extension Example_0 {
+    enum Example_1 {
+        ↓protocol Example_2 {}
+    }
+}
+
+
actor Example_0 {
+    func f_0() {
+        actor Example_1 {
+            func f_1() {
+                func f_2() {
+                    ↓actor Example_2 {}
+                    ↓func f_3() {}
+                    ↓protocol P {}
+                }
+            }
+        }
+    }
+}
+
+
actor Example_0 {
+    func f_0() {
+        switch example {
+        case .exampleCase:
+            actor Example_1 {
+                func f_1() {
+                    func f_2() {
+                        ↓actor Example_2 {}
+                        ↓func f_3() {}
+                        ↓protocol P {}
+                    }
+                }
+            }
+        default:
+            exampleFunc(closure: {
+                actor Example_1 {
+                    func f_1() {
+                        func f_2() {
+                            ↓actor Example_2 {}
+                            ↓func f_3() {}
+                            ↓protocol P {}
+                        }
+                    }
+                }
+            })
+        }
+    }
+}
+
+
class Example_0 {
+    func f_0() {
+        class Example_1 {
+            func f_1() {
+                func f_2() {
+                    ↓class Example_2 {}
+                    ↓func f_3() {}
+                    ↓protocol P {}
+                }
+            }
+        }
+    }
+}
+
+
class Example_0 {
+    func f_0() {
+        switch example {
+        case .exampleCase:
+            class Example_1 {
+                func f_1() {
+                    func f_2() {
+                        ↓class Example_2 {}
+                        ↓func f_3() {}
+                        ↓protocol P {}
+                    }
+                }
+            }
+        default:
+            exampleFunc(closure: {
+                class Example_1 {
+                    func f_1() {
+                        func f_2() {
+                            ↓class Example_2 {}
+                            ↓func f_3() {}
+                            ↓protocol P {}
+                        }
+                    }
+                }
+            })
+        }
+    }
+}
+
+
struct Example_0 {
+    func f_0() {
+        struct Example_1 {
+            func f_1() {
+                func f_2() {
+                    ↓struct Example_2 {}
+                    ↓func f_3() {}
+                    ↓protocol P {}
+                }
+            }
+        }
+    }
+}
+
+
struct Example_0 {
+    func f_0() {
+        switch example {
+        case .exampleCase:
+            struct Example_1 {
+                func f_1() {
+                    func f_2() {
+                        ↓struct Example_2 {}
+                        ↓func f_3() {}
+                        ↓protocol P {}
+                    }
+                }
+            }
+        default:
+            exampleFunc(closure: {
+                struct Example_1 {
+                    func f_1() {
+                        func f_2() {
+                            ↓struct Example_2 {}
+                            ↓func f_3() {}
+                            ↓protocol P {}
+                        }
+                    }
+                }
+            })
+        }
+    }
+}
+
+
enum Example_0 {
+    func f_0() {
+        enum Example_1 {
+            func f_1() {
+                func f_2() {
+                    ↓enum Example_2 {}
+                    ↓func f_3() {}
+                    ↓protocol P {}
+                }
+            }
+        }
+    }
+}
+
+
enum Example_0 {
+    func f_0() {
+        switch example {
+        case .exampleCase:
+            enum Example_1 {
+                func f_1() {
+                    func f_2() {
+                        ↓enum Example_2 {}
+                        ↓func f_3() {}
+                        ↓protocol P {}
+                    }
+                }
+            }
+        default:
+            exampleFunc(closure: {
+                enum Example_1 {
+                    func f_1() {
+                        func f_2() {
+                            ↓enum Example_2 {}
+                            ↓func f_3() {}
+                            ↓protocol P {}
+                        }
+                    }
+                }
+            })
+        }
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/nimble_operator.html b/nimble_operator.html new file mode 100644 index 000000000..be3145aed --- /dev/null +++ b/nimble_operator.html @@ -0,0 +1,432 @@ + + + + nimble_operator Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Nimble Operator

+ +

Prefer Nimble operator overloads over free matcher functions

+ +
    +
  • Identifier: nimble_operator
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
expect(seagull.squawk) != "Hi!"
+
+
expect("Hi!") == "Hi!"
+
+
expect(10) > 2
+
+
expect(10) >= 10
+
+
expect(10) < 11
+
+
expect(10) <= 10
+
+
expect(x) === x
+
+
expect(10) == 10
+
+
expect(success) == true
+
+
expect(value) == nil
+
+
expect(value) != nil
+
+
expect(object.asyncFunction()).toEventually(equal(1))
+
+
expect(actual).to(haveCount(expected))
+
+
foo.method {
+    expect(value).to(equal(expectedValue), description: "Failed")
+    return Bar(value: ())
+}
+
+

Triggering Examples

+
↓expect(seagull.squawk).toNot(equal("Hi"))
+
+
↓expect(12).toNot(equal(10))
+
+
↓expect(10).to(equal(10))
+
+
↓expect(10, line: 1).to(equal(10))
+
+
↓expect(10).to(beGreaterThan(8))
+
+
↓expect(10).to(beGreaterThanOrEqualTo(10))
+
+
↓expect(10).to(beLessThan(11))
+
+
↓expect(10).to(beLessThanOrEqualTo(10))
+
+
↓expect(x).to(beIdenticalTo(x))
+
+
↓expect(success).to(beTrue())
+
+
↓expect(success).to(beFalse())
+
+
↓expect(value).to(beNil())
+
+
↓expect(value).toNot(beNil())
+
+
expect(10) > 2
+ ↓expect(10).to(beGreaterThan(2))
+
+ +
+
+ + +
+
+ + + diff --git a/no_empty_block.html b/no_empty_block.html new file mode 100644 index 000000000..51a521915 --- /dev/null +++ b/no_empty_block.html @@ -0,0 +1,515 @@ + + + + no_empty_block Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

No Empty Block

+ +

Code blocks should contain at least one statement or comment

+ +
    +
  • Identifier: no_empty_block
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +disabled_block_types + +[] +
  • +
+

Non Triggering Examples

+
func f() {
+    /* do something */
+}
+
+var flag = true {
+    willSet { /* do something */ }
+}
+
+
class Apple {
+    init() { /* do something */ }
+
+    deinit { /* do something */ }
+}
+
+
for _ in 0..<10 { /* do something */ }
+
+do {
+    /* do something */
+} catch {
+    /* do something */
+}
+
+func f() {
+    defer {
+        /* do something */
+    }
+    print("other code")
+}
+
+if flag {
+    /* do something */
+} else {
+    /* do something */
+}
+
+repeat { /* do something */ } while (flag)
+
+while i < 10 { /* do something */ }
+
+
//
+// disabled_block_types: [function_bodies]
+//
+
+func f() {}
+
+var flag = true {
+    willSet {}
+}
+
+
+
//
+// disabled_block_types: [initializer_bodies]
+//
+
+class Apple {
+    init() {}
+
+    deinit {}
+}
+
+
+
//
+// disabled_block_types: [statement_blocks]
+//
+
+for _ in 0..<10 {}
+
+do {
+} catch {
+}
+
+func f() {
+    defer {}
+    print("other code")
+}
+
+if flag {
+} else {
+}
+
+repeat {} while (flag)
+
+while i < 10 {}
+
+
+
f { _ in /* comment */ }
+f { _ in // comment
+}
+f { _ in
+    // comment
+}
+
+
//
+// disabled_block_types: [closure_blocks]
+//
+
+f {}
+{}()
+
+
+

Triggering Examples

+
func f() ↓{}
+
+var flag = true {
+    willSet ↓{}
+}
+
+
class Apple {
+    init() ↓{}
+
+    deinit ↓{}
+}
+
+
for _ in 0..<10 ↓{}
+
+do ↓{
+} catch ↓{
+}
+
+func f() {
+    defer ↓{}
+    print("other code")
+}
+
+if flag ↓{
+} else ↓{
+}
+
+repeat ↓{} while (flag)
+
+while i < 10 ↓{}
+
+
f ↓{}
+
+
Button ↓{} label: ↓{}
+
+ +
+
+ + +
+
+ + + diff --git a/no_extension_access_modifier.html b/no_extension_access_modifier.html new file mode 100644 index 000000000..c05c9c2a0 --- /dev/null +++ b/no_extension_access_modifier.html @@ -0,0 +1,389 @@ + + + + no_extension_access_modifier Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

No Extension Access Modifier

+ +

Prefer not to use extension access modifiers

+ +
    +
  • Identifier: no_extension_access_modifier
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +error +
  • +
+

Non Triggering Examples

+
extension String {}
+
+

+
+ extension String {}
+
+

Triggering Examples

+
↓private extension String {}
+
+
↓public 
+ extension String {}
+
+
↓open extension String {}
+
+
↓internal extension String {}
+
+
↓fileprivate extension String {}
+
+ +
+
+ + +
+
+ + + diff --git a/no_fallthrough_only.html b/no_fallthrough_only.html new file mode 100644 index 000000000..66831469e --- /dev/null +++ b/no_fallthrough_only.html @@ -0,0 +1,508 @@ + + + + no_fallthrough_only Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

No Fallthrough only

+ +

Fallthroughs can only be used if the case contains at least one other statement

+ +
    +
  • Identifier: no_fallthrough_only
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
switch myvar {
+case 1:
+    var a = 1
+    fallthrough
+case 2:
+    var a = 2
+}
+
+
switch myvar {
+case "a":
+    var one = 1
+    var two = 2
+    fallthrough
+case "b": /* comment */
+    var three = 3
+}
+
+
switch myvar {
+case 1:
+    let one = 1
+case 2:
+    // comment
+    var two = 2
+}
+
+
switch myvar {
+case MyFunc(x: [1, 2, YourFunc(a: 23)], y: 2):
+    var three = 3
+    fallthrough
+default:
+    var three = 4
+}
+
+
switch myvar {
+case .alpha:
+    var one = 1
+case .beta:
+    var three = 3
+    fallthrough
+default:
+    var four = 4
+}
+
+
let aPoint = (1, -1)
+switch aPoint {
+case let (x, y) where x == y:
+    let A = "A"
+case let (x, y) where x == -y:
+    let B = "B"
+    fallthrough
+default:
+    let C = "C"
+}
+
+
switch myvar {
+case MyFun(with: { $1 }):
+    let one = 1
+    fallthrough
+case "abc":
+    let two = 2
+}
+
+
switch enumInstance {
+case .caseA:
+    print("it's a")
+case .caseB:
+    fallthrough
+@unknown default:
+    print("it's not a")
+}
+
+

Triggering Examples

+
switch myvar {
+case 1:
+    ↓fallthrough
+case 2:
+    var a = 1
+}
+
+
switch myvar {
+case 1:
+    var a = 2
+case 2:
+    ↓fallthrough
+case 3:
+    var a = 3
+}
+
+
switch myvar {
+case 1: // comment
+    ↓fallthrough
+}
+
+
switch myvar {
+case 1: /* multi
+    line
+    comment */
+    ↓fallthrough
+case 2:
+    var a = 2
+}
+
+
switch myvar {
+case MyFunc(x: [1, 2, YourFunc(a: 23)], y: 2):
+    ↓fallthrough
+default:
+    var three = 4
+}
+
+
switch myvar {
+case .alpha:
+    var one = 1
+case .beta:
+    ↓fallthrough
+case .gamma:
+    var three = 3
+default:
+    var four = 4
+}
+
+
let aPoint = (1, -1)
+switch aPoint {
+case let (x, y) where x == y:
+    let A = "A"
+case let (x, y) where x == -y:
+    ↓fallthrough
+default:
+    let B = "B"
+}
+
+
switch myvar {
+case MyFun(with: { $1 }):
+    ↓fallthrough
+case "abc":
+    let two = 2
+}
+
+ +
+
+ + +
+
+ + + diff --git a/no_grouping_extension.html b/no_grouping_extension.html new file mode 100644 index 000000000..3a80cc28f --- /dev/null +++ b/no_grouping_extension.html @@ -0,0 +1,393 @@ + + + + no_grouping_extension Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

No Grouping Extension

+ +

Extensions shouldn’t be used to group code within the same source file

+ +
    +
  • Identifier: no_grouping_extension
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
protocol Food {}
+extension Food {}
+
+
class Apples {}
+extension Oranges {}
+
+
class Box<T> {}
+extension Box where T: Vegetable {}
+
+

Triggering Examples

+
enum Fruit {}
+↓extension Fruit {}
+
+
↓extension Tea: Error {}
+struct Tea {}
+
+
class Ham { class Spam {}}
+↓extension Ham.Spam {}
+
+
extension External { struct Gotcha {}}
+↓extension External.Gotcha {}
+
+ +
+
+ + +
+
+ + + diff --git a/no_magic_numbers.html b/no_magic_numbers.html new file mode 100644 index 000000000..32fa035d1 --- /dev/null +++ b/no_magic_numbers.html @@ -0,0 +1,504 @@ + + + + no_magic_numbers Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

No Magic Numbers

+ +

Magic numbers should be replaced by named constants

+ +
    +
  • Identifier: no_magic_numbers
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +test_parent_classes + +[“QuickSpec”, “XCTestCase”] +
  • +
+

Non Triggering Examples

+
var foo = 123
+
+
static let bar: Double = 0.123
+
+
let a = b + 1.0
+
+
array[0] + array[1] 
+
+
let foo = 1_000.000_01
+
+
// array[1337]
+
+
baz("9999")
+
+
func foo() {
+    let x: Int = 2
+    let y = 3
+    let vector = [x, y, -1]
+}
+
+
class A {
+    var foo: Double = 132
+    static let bar: Double = 0.98
+}
+
+
@available(iOS 13, *)
+func version() {
+    if #available(iOS 13, OSX 10.10, *) {
+        return
+    }
+}
+
+
enum Example: Int {
+    case positive = 2
+    case negative = -2
+}
+
+
class FooTests: XCTestCase {
+    let array: [Int] = []
+    let bar = array[42]
+}
+
+
class FooTests: XCTestCase {
+    class Bar {
+        let array: [Int] = []
+        let bar = array[42]
+    }
+}
+
+
class MyTest: XCTestCase {}
+extension MyTest {
+    let a = Int(3)
+}
+
+
extension MyTest {
+    let a = Int(3)
+}
+class MyTest: XCTestCase {}
+
+
let foo = 1 << 2
+
+
let foo = 1 >> 2
+
+
let foo = 2 >> 2
+
+
let foo = 2 << 2
+
+
let a = b / 100.0
+
+
let range = 2 ..< 12
+
+
let range = ...12
+
+
let range = 12...
+
+
let (lowerBound, upperBound) = (400, 599)
+
+
let a = (5, 10)
+
+
let notFound = (statusCode: 404, description: "Not Found", isError: true)
+
+
#Preview {
+    ContentView(value: 5)
+}
+
+

Triggering Examples

+
foo(↓321)
+
+
bar(↓1_000.005_01)
+
+
array[↓42]
+
+
let box = array[↓12 + ↓14]
+
+
let a = b + ↓2.0
+
+
let range = 2 ... ↓12 + 1
+
+
let range = ↓2*↓6...
+
+
let slice = array[↓2...↓4]
+
+
for i in ↓3 ..< ↓8 {}
+
+
let n: Int = Int(r * ↓255) << ↓16 | Int(g * ↓255) << ↓8
+
+
Color.primary.opacity(isAnimate ? ↓0.1 : ↓1.5)
+
+
        class MyTest: XCTestCase {}
+        extension NSObject {
+            let a = Int(↓3)
+        }
+
+
if (fileSize > ↓1000000) {
+    return
+}
+
+
let imageHeight = (width - ↓24)
+
+
return (↓5, ↓10, ↓15)
+
+
#ExampleMacro {
+    ContentView(value: ↓5)
+}
+
+ +
+
+ + +
+
+ + + diff --git a/no_space_in_method_call.html b/no_space_in_method_call.html new file mode 100644 index 000000000..4bed73f84 --- /dev/null +++ b/no_space_in_method_call.html @@ -0,0 +1,406 @@ + + + + no_space_in_method_call Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

No Space in Method Call

+ +

Don’t add a space between the method name and the parentheses

+ +
    +
  • Identifier: no_space_in_method_call
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
foo()
+
+
object.foo()
+
+
object.foo(1)
+
+
object.foo(value: 1)
+
+
object.foo { print($0 }
+
+
list.sorted { $0.0 < $1.0 }.map { $0.value }
+
+
self.init(rgb: (Int) (colorInt))
+
+
Button {
+    print("Button tapped")
+} label: {
+    Text("Button")
+}
+
+

Triggering Examples

+
foo↓ ()
+
+
object.foo↓ ()
+
+
object.foo↓ (1)
+
+
object.foo↓ (value: 1)
+
+
object.foo↓ () {}
+
+
object.foo↓     ()
+
+
object.foo↓     (value: 1) { x in print(x) }
+
+ +
+
+ + +
+
+ + + diff --git a/non_optional_string_data_conversion.html b/non_optional_string_data_conversion.html new file mode 100644 index 000000000..057dfcdde --- /dev/null +++ b/non_optional_string_data_conversion.html @@ -0,0 +1,376 @@ + + + + non_optional_string_data_conversion Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Non-optional String -> Data Conversion

+ +

Prefer non-optional Data(_:) initializer when converting String to Data

+ +
    +
  • Identifier: non_optional_string_data_conversion
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
Data("foo".utf8)
+
+

Triggering Examples

+
"foo".data(using: .utf8)
+
+ +
+
+ + +
+
+ + + diff --git a/non_overridable_class_declaration.html b/non_overridable_class_declaration.html new file mode 100644 index 000000000..90972c995 --- /dev/null +++ b/non_overridable_class_declaration.html @@ -0,0 +1,430 @@ + + + + non_overridable_class_declaration Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Class Declaration in Final Class

+ +

Class methods and properties in final classes should themselves be final, just as if the declarations +are private. In both cases, they cannot be overridden. Using final class or static makes this explicit.

+ +
    +
  • Identifier: non_overridable_class_declaration
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +final_class_modifier + +final class +
  • +
+

Non Triggering Examples

+
final class C {
+    final class var b: Bool { true }
+    final class func f() {}
+}
+
+
class C {
+    final class var b: Bool { true }
+    final class func f() {}
+}
+
+
class C {
+    class var b: Bool { true }
+    class func f() {}
+}
+
+
class C {
+    static var b: Bool { true }
+    static func f() {}
+}
+
+
final class C {
+    static var b: Bool { true }
+    static func f() {}
+}
+
+
final class C {
+    class D {
+        class var b: Bool { true }
+        class func f() {}
+    }
+}
+
+

Triggering Examples

+
final class C {
+    ↓class var b: Bool { true }
+    ↓class func f() {}
+}
+
+
class C {
+    final class D {
+        ↓class var b: Bool { true }
+        ↓class func f() {}
+    }
+}
+
+
class C {
+    private ↓class var b: Bool { true }
+    private ↓class func f() {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/notification_center_detachment.html b/notification_center_detachment.html new file mode 100644 index 000000000..265930662 --- /dev/null +++ b/notification_center_detachment.html @@ -0,0 +1,390 @@ + + + + notification_center_detachment Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Notification Center Detachment

+ +

An object should only remove itself as an observer in deinit

+ +
    +
  • Identifier: notification_center_detachment
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class Foo {
+   deinit {
+       NotificationCenter.default.removeObserver(self)
+   }
+}
+
+
class Foo {
+   func bar() {
+       NotificationCenter.default.removeObserver(otherObject)
+   }
+}
+
+

Triggering Examples

+
class Foo {
+   func bar() {
+       ↓NotificationCenter.default.removeObserver(self)
+   }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/ns_number_init_as_function_reference.html b/ns_number_init_as_function_reference.html new file mode 100644 index 000000000..2ed8f01f7 --- /dev/null +++ b/ns_number_init_as_function_reference.html @@ -0,0 +1,386 @@ + + + + ns_number_init_as_function_reference Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

NSNumber Init as Function Reference

+ +

Passing NSNumber.init or NSDecimalNumber.init as a function reference is dangerous as it can cause the wrong initializer to be used, causing crashes; use .init(value:) instead

+ +
    +
  • Identifier: ns_number_init_as_function_reference
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
[0, 0.2].map(NSNumber.init(value:))
+
+
let value = NSNumber.init(value: 0.0)
+
+
[0, 0.2].map { NSNumber(value: $0) }
+
+
[0, 0.2].map(NSDecimalNumber.init(value:))
+
+
[0, 0.2].map { NSDecimalNumber(value: $0) }
+
+

Triggering Examples

+
[0, 0.2].map(↓NSNumber.init)
+
+
[0, 0.2].map(↓NSDecimalNumber.init)
+
+ +
+
+ + +
+
+ + + diff --git a/nslocalizedstring_key.html b/nslocalizedstring_key.html new file mode 100644 index 000000000..8d435bc9b --- /dev/null +++ b/nslocalizedstring_key.html @@ -0,0 +1,393 @@ + + + + nslocalizedstring_key Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

NSLocalizedString Key

+ +

Static strings should be used as key/comment in NSLocalizedString in order for genstrings to work

+ +
    +
  • Identifier: nslocalizedstring_key
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
NSLocalizedString("key", comment: "")
+
+
NSLocalizedString("key" + "2", comment: "")
+
+
NSLocalizedString("key", comment: "comment")
+
+
NSLocalizedString("This is a multi-" +
+    "line string", comment: "")
+
+
let format = NSLocalizedString("%@, %@.", comment: "Accessibility label for a post in the post list." +
+" The parameters are the title, and date respectively." +
+" For example, "Let it Go, 1 hour ago."")
+
+

Triggering Examples

+
NSLocalizedString(↓method(), comment: "")
+
+
NSLocalizedString(↓"key_\(param)", comment: "")
+
+
NSLocalizedString("key", comment: ↓"comment with \(param)")
+
+
NSLocalizedString(↓"key_\(param)", comment: ↓method())
+
+ +
+
+ + +
+
+ + + diff --git a/nslocalizedstring_require_bundle.html b/nslocalizedstring_require_bundle.html new file mode 100644 index 000000000..45b45cfd0 --- /dev/null +++ b/nslocalizedstring_require_bundle.html @@ -0,0 +1,391 @@ + + + + nslocalizedstring_require_bundle Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

NSLocalizedString Require Bundle

+ +

Calls to NSLocalizedString should specify the bundle which contains the strings file

+ +
    +
  • Identifier: nslocalizedstring_require_bundle
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
NSLocalizedString("someKey", bundle: .main, comment: "test")
+
+
NSLocalizedString("someKey", tableName: "a",
+                  bundle: Bundle(for: A.self),
+                  comment: "test")
+
+
NSLocalizedString("someKey", tableName: "xyz",
+                  bundle: someBundle, value: "test"
+                  comment: "test")
+
+
arbitraryFunctionCall("something")
+
+

Triggering Examples

+
↓NSLocalizedString("someKey", comment: "test")
+
+
↓NSLocalizedString("someKey", tableName: "a", comment: "test")
+
+
↓NSLocalizedString("someKey", tableName: "xyz",
+                  value: "test", comment: "test")
+
+ +
+
+ + +
+
+ + + diff --git a/nsobject_prefer_isequal.html b/nsobject_prefer_isequal.html new file mode 100644 index 000000000..e12bd0e4c --- /dev/null +++ b/nsobject_prefer_isequal.html @@ -0,0 +1,444 @@ + + + + nsobject_prefer_isequal Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

NSObject Prefer isEqual

+ +

NSObject subclasses should implement isEqual instead of ==

+ +
    +
  • Identifier: nsobject_prefer_isequal
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class AClass: NSObject {
+}
+
+
@objc class AClass: SomeNSObjectSubclass {
+}
+
+
class AClass: Equatable {
+    static func ==(lhs: AClass, rhs: AClass) -> Bool {
+        return true
+    }
+
+
class AClass: NSObject {
+    override func isEqual(_ object: Any?) -> Bool {
+        return true
+    }
+}
+
+
@objc class AClass: SomeNSObjectSubclass {
+    override func isEqual(_ object: Any?) -> Bool {
+        return false
+    }
+}
+
+
class AClass: NSObject {
+    static func ==(lhs: AClass, rhs: BClass) -> Bool {
+        return true
+    }
+}
+
+
struct AStruct: Equatable {
+    static func ==(lhs: AStruct, rhs: AStruct) -> Bool {
+        return false
+    }
+}
+
+
enum AnEnum: Equatable {
+    static func ==(lhs: AnEnum, rhs: AnEnum) -> Bool {
+        return true
+    }
+}
+
+

Triggering Examples

+
class AClass: NSObject {
+    ↓static func ==(lhs: AClass, rhs: AClass) -> Bool {
+        return false
+    }
+}
+
+
@objc class AClass: SomeOtherNSObjectSubclass {
+    ↓static func ==(lhs: AClass, rhs: AClass) -> Bool {
+        return true
+    }
+}
+
+
class AClass: NSObject, Equatable {
+    ↓static func ==(lhs: AClass, rhs: AClass) -> Bool {
+        return false
+    }
+}
+
+
class AClass: NSObject {
+    override func isEqual(_ object: Any?) -> Bool {
+        guard let other = object as? AClass else {
+            return false
+        }
+        return true
+    }
+
+    ↓static func ==(lhs: AClass, rhs: AClass) -> Bool {
+        return false
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/number_separator.html b/number_separator.html new file mode 100644 index 000000000..5df22038a --- /dev/null +++ b/number_separator.html @@ -0,0 +1,625 @@ + + + + number_separator Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Number Separator

+ +

Underscores should be used as thousand separator in large numbers with a configurable number of digits. In other words, there should be an underscore after every 3 digits in the integral as well as the fractional part of a number.

+ +
    +
  • Identifier: number_separator
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +minimum_length + +0 +
    +exclude_ranges + +[] +
  • +
+

Non Triggering Examples

+
let foo = -100
+
+
let foo = -1_000
+
+
let foo = -1_000_000
+
+
let foo = -1.0001
+
+
let foo = -1_000_000.0000001
+
+
let binary = -0b10000
+
+
let binary = -0b1000_0001
+
+
let hex = -0xA
+
+
let hex = -0xAA_BB
+
+
let octal = -0o21
+
+
let octal = -0o21_1
+
+
let exp = -1_000_000.000000e2
+
+
let foo: Double = -(200)
+
+
let foo: Double = -(200 / 447.214)
+
+
let foo = -6.2832e-6
+
+
let foo = +100
+
+
let foo = +1_000
+
+
let foo = +1_000_000
+
+
let foo = +1.0001
+
+
let foo = +1_000_000.0000001
+
+
let binary = +0b10000
+
+
let binary = +0b1000_0001
+
+
let hex = +0xA
+
+
let hex = +0xAA_BB
+
+
let octal = +0o21
+
+
let octal = +0o21_1
+
+
let exp = +1_000_000.000000e2
+
+
let foo: Double = +(200)
+
+
let foo: Double = +(200 / 447.214)
+
+
let foo = +6.2832e-6
+
+
let foo = 100
+
+
let foo = 1_000
+
+
let foo = 1_000_000
+
+
let foo = 1.0001
+
+
let foo = 1_000_000.0000001
+
+
let binary = 0b10000
+
+
let binary = 0b1000_0001
+
+
let hex = 0xA
+
+
let hex = 0xAA_BB
+
+
let octal = 0o21
+
+
let octal = 0o21_1
+
+
let exp = 1_000_000.000000e2
+
+
let foo: Double = (200)
+
+
let foo: Double = (200 / 447.214)
+
+
let foo = 6.2832e-6
+
+

Triggering Examples

+
let foo = -↓10_0
+
+
let foo = -↓1000
+
+
let foo = -↓1000e2
+
+
let foo = -↓1000E2
+
+
let foo = -↓1__000
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo = -↓1.0001
+
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo = -↓1_000_000.000000_1
+
+
+
let foo = -↓1000000.000000_1
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo = -↓6.2832e-6
+
+
+
let foo = +↓10_0
+
+
let foo = +↓1000
+
+
let foo = +↓1000e2
+
+
let foo = +↓1000E2
+
+
let foo = +↓1__000
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo = +↓1.0001
+
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo = +↓1_000_000.000000_1
+
+
+
let foo = +↓1000000.000000_1
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo = +↓6.2832e-6
+
+
+
let foo = ↓10_0
+
+
let foo = ↓1000
+
+
let foo = ↓1000e2
+
+
let foo = ↓1000E2
+
+
let foo = ↓1__000
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo = ↓1.0001
+
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo = ↓1_000_000.000000_1
+
+
+
let foo = ↓1000000.000000_1
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo = ↓6.2832e-6
+
+
+
let foo: Double = -(↓100000)
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo: Double = -(↓10.000000_1)
+
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo: Double = -(↓123456 / ↓447.214214)
+
+
+
let foo: Double = +(↓100000)
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo: Double = +(↓10.000000_1)
+
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo: Double = +(↓123456 / ↓447.214214)
+
+
+
let foo: Double = (↓100000)
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo: Double = (↓10.000000_1)
+
+
+
//
+// minimum_fraction_length: 3
+//
+
+let foo: Double = (↓123456 / ↓447.214214)
+
+
+ +
+
+ + +
+
+ + + diff --git a/object_literal.html b/object_literal.html new file mode 100644 index 000000000..76e4272b7 --- /dev/null +++ b/object_literal.html @@ -0,0 +1,436 @@ + + + + object_literal Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Object Literal

+ +

Prefer object literals over image and color inits

+ +
    +
  • Identifier: object_literal
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +image_literal + +true +
    +color_literal + +true +
  • +
+

Non Triggering Examples

+
let image = #imageLiteral(resourceName: "image.jpg")
+
+
let color = #colorLiteral(red: 0.9607843161, green: 0.7058823705, blue: 0.200000003, alpha: 1)
+
+
let image = UIImage(named: aVariable)
+
+
let image = UIImage(named: "interpolated \(variable)")
+
+
let color = UIColor(red: value, green: value, blue: value, alpha: 1)
+
+
let image = NSImage(named: aVariable)
+
+
let image = NSImage(named: "interpolated \(variable)")
+
+
let color = NSColor(red: value, green: value, blue: value, alpha: 1)
+
+

Triggering Examples

+
let image = ↓UIImage(named: "foo")
+
+
let color = ↓UIColor(red: 0.3, green: 0.3, blue: 0.3, alpha: 1)
+
+
let color = ↓UIColor(red: 100 / 255.0, green: 50 / 255.0, blue: 0, alpha: 1)
+
+
let color = ↓UIColor(white: 0.5, alpha: 1)
+
+
let image = ↓NSImage(named: "foo")
+
+
let color = ↓NSColor(red: 0.3, green: 0.3, blue: 0.3, alpha: 1)
+
+
let color = ↓NSColor(red: 100 / 255.0, green: 50 / 255.0, blue: 0, alpha: 1)
+
+
let color = ↓NSColor(white: 0.5, alpha: 1)
+
+
let image = ↓UIImage.init(named: "foo")
+
+
let color = ↓UIColor.init(red: 0.3, green: 0.3, blue: 0.3, alpha: 1)
+
+
let color = ↓UIColor.init(red: 100 / 255.0, green: 50 / 255.0, blue: 0, alpha: 1)
+
+
let color = ↓UIColor.init(white: 0.5, alpha: 1)
+
+
let image = ↓NSImage.init(named: "foo")
+
+
let color = ↓NSColor.init(red: 0.3, green: 0.3, blue: 0.3, alpha: 1)
+
+
let color = ↓NSColor.init(red: 100 / 255.0, green: 50 / 255.0, blue: 0, alpha: 1)
+
+
let color = ↓NSColor.init(white: 0.5, alpha: 1)
+
+ +
+
+ + +
+
+ + + diff --git a/one_declaration_per_file.html b/one_declaration_per_file.html new file mode 100644 index 000000000..a01039e36 --- /dev/null +++ b/one_declaration_per_file.html @@ -0,0 +1,390 @@ + + + + one_declaration_per_file Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

One Declaration per File

+ +

Only a single declaration is allowed in a file

+ +
    +
  • Identifier: one_declaration_per_file
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
actor Foo {}
+
+
class Foo {}
+extension Foo {}
+
+
struct S {
+    struct N {}
+}
+
+

Triggering Examples

+
class Foo {}
+↓class Bar {}
+
+
protocol Foo {}
+↓enum Bar {}
+
+
struct Foo {}
+↓struct Bar {}
+
+ +
+
+ + +
+
+ + + diff --git a/opening_brace.html b/opening_brace.html new file mode 100644 index 000000000..a63e2c76a --- /dev/null +++ b/opening_brace.html @@ -0,0 +1,638 @@ + + + + opening_brace Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Opening Brace Spacing

+ +

The correct positioning of braces that introduce a block of code or member list is highly controversial. No matter which style is preferred, consistency is key. Apart from different tastes, the positioning of braces can also have a significant impact on the readability of the code, especially for visually impaired developers. This rule ensures that braces are preceded by a single space and on the same line as the declaration. Comments between the declaration and the opening brace are respected. Check out the contrasted_opening_brace rule for a different style.

+ +
    +
  • Identifier: opening_brace
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +ignore_multiline_type_headers + +false +
    +ignore_multiline_statement_conditions + +false +
    +ignore_multiline_function_signatures + +false +
    +allow_multiline_func + +false +
  • +
+

Non Triggering Examples

+
func abc() {
+}
+
+
[].map() { $0 }
+
+
[].map({ })
+
+
if let a = b { }
+
+
while a == b { }
+
+
guard let a = b else { }
+
+
struct Rule {}
+
+
struct Parent {
+    struct Child {
+        let foo: Int
+    }
+}
+
+
func f(rect: CGRect) {
+    {
+        let centre = CGPoint(x: rect.midX, y: rect.midY)
+        print(centre)
+    }()
+}
+
+
func f(rect: CGRect) -> () -> Void {
+    {
+        let centre = CGPoint(x: rect.midX, y: rect.midY)
+        print(centre)
+    }
+}
+
+
func f() -> () -> Void {
+    {}
+}
+
+
class Rule:
+  NSObject {
+  var a: String {
+    return ""
+  }
+}
+
+
self.foo(
+    (
+        "String parameter",
+        { "Do something here" }
+    )
+)
+
+
let pattern = #/(\{(?<key>\w+)\})/#
+
+
if c {}
+else {}
+
+
    if c /* comment */ {
+        return
+    }
+
+

Triggering Examples

+
func abc()↓{
+}
+
+
func abc()
+    ↓{ }
+
+
func abc(a: A,
+    b: B)
+↓{
+
+
[].map()↓{ $0 }
+
+
struct OldContentView: View {
+  @State private var showOptions = false
+
+  var body: some View {
+    Button(action: {
+      self.showOptions.toggle()
+    })↓{
+      Image(systemName: "gear")
+    }
+  }
+}
+
+
struct OldContentView: View {
+  @State private var showOptions = false
+
+  var body: some View {
+    Button(action: {
+      self.showOptions.toggle()
+    })
+   ↓{
+      Image(systemName: "gear")
+    }
+  }
+}
+
+
struct OldContentView: View {
+  @State private var showOptions = false
+
+  var body: some View {
+    Button {
+      self.showOptions.toggle()
+    } label:↓{
+      Image(systemName: "gear")
+    }
+  }
+}
+
+
if let a = b↓{ }
+
+
while a == b↓{ }
+
+
guard let a = b else↓{ }
+
+
if
+    let a = b,
+    let c = d
+    where a == c↓{ }
+
+
while
+    let a = b,
+    let c = d
+    where a == c↓{ }
+
+
guard
+    let a = b,
+    let c = d
+    where a == c else↓{ }
+
+
struct Rule↓{}
+
+
struct Rule
+↓{
+}
+
+
struct Rule
+
+    ↓{
+}
+
+
struct Parent {
+    struct Child
+    ↓{
+        let foo: Int
+    }
+}
+
+
switch a↓{}
+
+
if
+    let a = b,
+    let c = d,
+    a == c
+↓{ }
+
+
while
+    let a = b,
+    let c = d,
+    a == c
+↓{ }
+
+
guard
+    let a = b,
+    let c = d,
+    a == c else
+↓{ }
+
+
class Rule↓{}
+
+
+
actor Rule↓{}
+
+
+
enum Rule↓{}
+
+
+
protocol Rule↓{}
+
+
+
extension Rule↓{}
+
+
+
class Rule {
+  var a: String↓{
+    return ""
+  }
+}
+
+
class Rule {
+  var a: String {
+    willSet↓{
+
+    }
+    didSet  ↓{
+
+    }
+  }
+}
+
+
precedencegroup Group↓{
+  assignment: true
+}
+
+
if
+    "test".isEmpty
+↓{
+    // code here
+}
+
+
func fooFun() {
+    let foo: String? = "foo"
+    let bar: String? = "bar"
+
+    if
+        let foo = foo,
+        let bar = bar
+    ↓{
+        print(foo + bar)
+    }
+}
+
+
if
+    let a = ["A", "B"].first,
+    let b = ["B"].first
+↓{
+    print(a)
+}
+
+
if c  ↓{}
+else /* comment */  ↓{}
+
+ +
+
+ + +
+
+ + + diff --git a/operator_usage_whitespace.html b/operator_usage_whitespace.html new file mode 100644 index 000000000..0d07e7f5b --- /dev/null +++ b/operator_usage_whitespace.html @@ -0,0 +1,544 @@ + + + + operator_usage_whitespace Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Operator Usage Whitespace

+ +

Operators should be surrounded by a single whitespace when they are being used

+ +
    +
  • Identifier: operator_usage_whitespace
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +lines_look_around + +2 +
    +skip_aligned_constants + +true +
    +allowed_no_space_operators + +[“…”, “..<”] +
  • +
+

Non Triggering Examples

+
let foo = 1 + 2
+
+
let foo = 1 > 2
+
+
let foo = !false
+
+
let foo: Int?
+
+
let foo: Array<String>
+
+
let model = CustomView<Container<Button>, NSAttributedString>()
+
+
let foo: [String]
+
+
let foo = 1 + 
+  2
+
+
let range = 1...3
+
+
let range = 1 ... 3
+
+
let range = 1..<3
+
+
#if swift(>=3.0)
+    foo()
+#endif
+
+
array.removeAtIndex(-200)
+
+
let name = "image-1"
+
+
button.setImage(#imageLiteral(resourceName: "image-1"), for: .normal)
+
+
let doubleValue = -9e-11
+
+
let foo = GenericType<(UIViewController) -> Void>()
+
+
let foo = Foo<Bar<T>, Baz>()
+
+
let foo = SignalProducer<Signal<Value, Error>, Error>([ self.signal, next ]).flatten(.concat)
+
+
"let foo =  1"
+
+
enum Enum {
+case hello   = 1
+case hello2  = 1
+}
+
+
let something = Something<GenericParameter1,
+                          GenericParameter2>()
+
+
return path.flatMap { path in
+    return compileCommands[path] ??
+        compileCommands[path.path(relativeTo: FileManager.default.currentDirectoryPath)]
+}
+
+
internal static func == (lhs: Vertex, rhs: Vertex) -> Bool {
+    return lhs.filePath == rhs.filePath
+        && lhs.originalRemoteString == rhs.originalRemoteString
+        && lhs.rootDirectory == rhs.rootDirectory
+}
+
+
internal static func == (lhs: Vertex, rhs: Vertex) -> Bool {
+    return lhs.filePath == rhs.filePath &&
+        lhs.originalRemoteString == rhs.originalRemoteString &&
+        lhs.rootDirectory == rhs.rootDirectory
+}
+
+
private static let pattern =
+    "\\S\(mainPatternGroups)" + // Regexp will match if expression not begin with comma
+    "|" +                       // or
+    "\(mainPatternGroups)"      // Regexp will match if expression begins with comma
+
+
private static let pattern =
+    "\\S\(mainPatternGroups)" + // Regexp will match if expression not begin with comma
+    "|"                       + // or
+    "\(mainPatternGroups)"      // Regexp will match if expression begins with comma
+
+
typealias Foo = Bar
+
+
protocol A {
+    associatedtype B = C
+}
+
+
tabbedViewController.title = nil
+
+

Triggering Examples

+
let foo = 1↓+2
+
+
let foo = 1↓   + 2
+
+
let foo = 1↓   +    2
+
+
let foo = 1↓ +    2
+
+
let foo↓=1↓+2
+
+
let foo↓=1 + 2
+
+
let foo↓=bar
+
+
let range = 1↓ ..<  3
+
+
let foo = bar↓   ?? 0
+
+
let foo = bar↓ !=  0
+
+
let foo = bar↓ !==  bar2
+
+
let v8 = Int8(1)↓  << 6
+
+
let v8 = 1↓ <<  (6)
+
+
let v8 = 1↓ <<  (6)
+ let foo = 1 > 2
+
+
let foo↓  = [1]
+
+
let foo↓  = "1"
+
+
let foo↓ =  "1"
+
+
enum Enum {
+case one↓  =  1
+case two  = 1
+}
+
+
enum Enum {
+case one  = 1
+case two↓  =  1
+}
+
+
enum Enum {
+case one↓   = 1
+case two↓  = 1
+}
+
+
typealias Foo↓ =  Bar
+
+
protocol A {
+    associatedtype B↓  = C
+}
+
+
tabbedViewController.title↓  = nil
+
+
let foo = bar ? 0↓:1
+
+
let foo = bar↓ ?   0 : 1
+
+ +
+
+ + +
+
+ + + diff --git a/operator_whitespace.html b/operator_whitespace.html new file mode 100644 index 000000000..afaa01034 --- /dev/null +++ b/operator_whitespace.html @@ -0,0 +1,390 @@ + + + + operator_whitespace Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Operator Function Whitespace

+ +

Operators should be surrounded by a single whitespace when defining them

+ +
    +
  • Identifier: operator_whitespace
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func <| (lhs: Int, rhs: Int) -> Int {}
+
+
func <|< <A>(lhs: A, rhs: A) -> A {}
+
+
func abc(lhs: Int, rhs: Int) -> Int {}
+
+

Triggering Examples

+
↓func <|(lhs: Int, rhs: Int) -> Int {}
+
+
↓func <|<<A>(lhs: A, rhs: A) -> A {}
+
+
↓func <|  (lhs: Int, rhs: Int) -> Int {}
+
+
↓func <|<  <A>(lhs: A, rhs: A) -> A {}
+
+
↓func  <| (lhs: Int, rhs: Int) -> Int {}
+
+
↓func  <|< <A>(lhs: A, rhs: A) -> A {}
+
+ +
+
+ + +
+
+ + + diff --git a/optional_data_string_conversion.html b/optional_data_string_conversion.html new file mode 100644 index 000000000..76f2d19d6 --- /dev/null +++ b/optional_data_string_conversion.html @@ -0,0 +1,384 @@ + + + + optional_data_string_conversion Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Optional Data -> String Conversion

+ +

Prefer failable String(bytes:encoding:) initializer when converting Data to String

+ +
    +
  • Identifier: optional_data_string_conversion
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
String(data: data, encoding: .utf8)
+
+
String(bytes: data, encoding: .utf8)
+
+
String(UTF8.self)
+
+
String(a, b, c, UTF8.self)
+
+
String(decoding: data, encoding: UTF8.self)
+
+

Triggering Examples

+
String(decoding: data, as: UTF8.self)
+
+ +
+
+ + +
+
+ + + diff --git a/optional_enum_case_matching.html b/optional_enum_case_matching.html new file mode 100644 index 000000000..ff108f0b4 --- /dev/null +++ b/optional_enum_case_matching.html @@ -0,0 +1,424 @@ + + + + optional_enum_case_matching Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Optional Enum Case Match

+ +

Matching an enum case against an optional enum without ‘?’ is supported on Swift 5.1 and above

+ +
    +
  • Identifier: optional_enum_case_matching
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.1.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
switch foo {
+ case .bar: break
+ case .baz: break
+ default: break
+}
+
+
switch foo {
+ case (.bar, .baz): break
+ case (.bar, _): break
+ case (_, .baz): break
+ default: break
+}
+
+
switch (x, y) {
+case (.c, _?):
+    break
+case (.c, nil):
+    break
+case (_, _):
+    break
+}
+
+

Triggering Examples

+
switch foo {
+ case .bar↓?: break
+ case .baz: break
+ default: break
+}
+
+
switch foo {
+ case Foo.bar↓?: break
+ case .baz: break
+ default: break
+}
+
+
switch foo {
+ case .bar↓?, .baz↓?: break
+ default: break
+}
+
+
switch foo {
+ case .bar↓? where x > 1: break
+ case .baz: break
+ default: break
+}
+
+
switch foo {
+ case (.bar↓?, .baz↓?): break
+ case (.bar↓?, _): break
+ case (_, .bar↓?): break
+ default: break
+}
+
+ +
+
+ + +
+
+ + + diff --git a/orphaned_doc_comment.html b/orphaned_doc_comment.html new file mode 100644 index 000000000..d44f92ff9 --- /dev/null +++ b/orphaned_doc_comment.html @@ -0,0 +1,416 @@ + + + + orphaned_doc_comment Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Orphaned Doc Comment

+ +

A doc comment should be attached to a declaration

+ +
    +
  • Identifier: orphaned_doc_comment
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
/// My great property
+var myGreatProperty: String!
+
+
//////////////////////////////////////
+//
+// Copyright header.
+//
+//////////////////////////////////////
+
+
/// Look here for more info: https://github.com.
+var myGreatProperty: String!
+
+
/// Look here for more info:
+/// https://github.com.
+var myGreatProperty: String!
+
+

Triggering Examples

+
↓/// My great property
+// Not a doc string
+var myGreatProperty: String!
+
+
↓/// Look here for more info: https://github.com.
+// Not a doc string
+var myGreatProperty: String!
+
+
↓/// Look here for more info: https://github.com.
+
+
+// Not a doc string
+var myGreatProperty: String!
+
+
↓/// Look here for more info: https://github.com.
+// Not a doc string
+↓/// My great property
+// Not a doc string
+var myGreatProperty: String!
+
+
extension Nested {
+    ↓///
+    /// Look here for more info: https://github.com.
+
+    // Not a doc string
+    var myGreatProperty: String!
+}
+
+ +
+
+ + +
+
+ + + diff --git a/overridden_super_call.html b/overridden_super_call.html new file mode 100644 index 000000000..79a2d161d --- /dev/null +++ b/overridden_super_call.html @@ -0,0 +1,440 @@ + + + + overridden_super_call Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Overridden Method Calls Super

+ +

Some overridden methods should always call super.

+ +
    +
  • Identifier: overridden_super_call
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +excluded + +[] +
    +included + +[“*”] +
  • +
+

Non Triggering Examples

+
class VC: UIViewController {
+    override func viewWillAppear(_ animated: Bool) {
+        super.viewWillAppear(animated)
+    }
+}
+
+
class VC: UIViewController {
+    override func viewWillAppear(_ animated: Bool) {
+        self.method1()
+        super.viewWillAppear(animated)
+        self.method2()
+    }
+}
+
+
class VC: UIViewController {
+    override func loadView() {
+    }
+}
+
+
class Some {
+    func viewWillAppear(_ animated: Bool) {
+    }
+}
+
+
class VC: UIViewController {
+    override func viewDidLoad() {
+    defer {
+        super.viewDidLoad()
+        }
+    }
+}
+
+

Triggering Examples

+
class VC: UIViewController {
+    override func viewWillAppear(_ animated: Bool) {↓
+        //Not calling to super
+        self.method()
+    }
+}
+
+
class VC: UIViewController {
+    override func viewWillAppear(_ animated: Bool) {↓
+        super.viewWillAppear(animated)
+        //Other code
+        super.viewWillAppear(animated)
+    }
+}
+
+
class VC: UIViewController {
+    override func didReceiveMemoryWarning() {↓
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/override_in_extension.html b/override_in_extension.html new file mode 100644 index 000000000..c2fd8368a --- /dev/null +++ b/override_in_extension.html @@ -0,0 +1,404 @@ + + + + override_in_extension Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Override in Extension

+ +

Extensions shouldn’t override declarations

+ +
    +
  • Identifier: override_in_extension
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
extension Person {
+  var age: Int { return 42 }
+}
+
+
extension Person {
+  func celebrateBirthday() {}
+}
+
+
class Employee: Person {
+  override func celebrateBirthday() {}
+}
+
+
class Foo: NSObject {}
+extension Foo {
+    override var description: String { return "" }
+}
+
+
struct Foo {
+    class Bar: NSObject {}
+}
+extension Foo.Bar {
+    override var description: String { return "" }
+}
+
+

Triggering Examples

+
extension Person {
+  override ↓var age: Int { return 42 }
+}
+
+
extension Person {
+  override ↓func celebrateBirthday() {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/pattern_matching_keywords.html b/pattern_matching_keywords.html new file mode 100644 index 000000000..5f33b5f0e --- /dev/null +++ b/pattern_matching_keywords.html @@ -0,0 +1,464 @@ + + + + pattern_matching_keywords Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Pattern Matching Keywords

+ +

Combine multiple pattern matching bindings by moving keywords out of tuples

+ +
    +
  • Identifier: pattern_matching_keywords
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
switch foo {
+    default: break
+}
+
+
switch foo {
+    case 1: break
+}
+
+
switch foo {
+    case bar: break
+}
+
+
switch foo {
+    case let (x, y): break
+}
+
+
switch foo {
+    case .foo(let x): break
+}
+
+
switch foo {
+    case let .foo(x, y): break
+}
+
+
switch foo {
+    case .foo(let x), .bar(let x): break
+}
+
+
switch foo {
+    case .foo(let x, var y): break
+}
+
+
switch foo {
+    case var (x, y): break
+}
+
+
switch foo {
+    case .foo(var x): break
+}
+
+
switch foo {
+    case var .foo(x, y): break
+}
+
+
switch foo {
+    case (y, let x, z): break
+}
+
+

Triggering Examples

+
switch foo {
+    case (↓let x,  ↓let y): break
+}
+
+
switch foo {
+    case (↓let x,  ↓let y, .foo): break
+}
+
+
switch foo {
+    case (↓let x,  ↓let y, _): break
+}
+
+
switch foo {
+    case (↓let x,  ↓let y, f()): break
+}
+
+
switch foo {
+    case (↓let x,  ↓let y, s.f()): break
+}
+
+
switch foo {
+    case (↓let x,  ↓let y, s.t): break
+}
+
+
switch foo {
+    case .foo(↓let x, ↓let y): break
+}
+
+
switch foo {
+    case (.yamlParsing(↓let x), .yamlParsing(↓let y)): break
+}
+
+
switch foo {
+    case (↓var x,  ↓var y): break
+}
+
+
switch foo {
+    case .foo(↓var x, ↓var y): break
+}
+
+
switch foo {
+    case (.yamlParsing(↓var x), .yamlParsing(↓var y)): break
+}
+
+ +
+
+ + +
+
+ + + diff --git a/period_spacing.html b/period_spacing.html new file mode 100644 index 000000000..cc2623b2d --- /dev/null +++ b/period_spacing.html @@ -0,0 +1,405 @@ + + + + period_spacing Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Period Spacing

+ +

Periods should not be followed by more than one space

+ +
    +
  • Identifier: period_spacing
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let pi = 3.2
+
+
let pi = Double.pi
+
+
let pi = Double. pi
+
+
let pi = Double.  pi
+
+
// A. Single.
+
+
///   - code: Identifier of the error. Integer.
+
+
// value: Multiline.
+//        Comment.
+
+
/**
+Sentence ended in period.
+
+- Sentence 2 new line characters after.
+**/
+
+

Triggering Examples

+
/* Only god knows why. ↓ This symbol does nothing. */
+
+
// Only god knows why. ↓ This symbol does nothing.
+
+
// Single. Double. ↓ End.
+
+
// Single. Double. ↓ Triple. ↓  End.
+
+
// Triple. ↓  Quad. ↓   End.
+
+
///   - code: Identifier of the error. ↓ Integer.
+
+ +
+
+ + +
+
+ + + diff --git a/prefer_key_path.html b/prefer_key_path.html new file mode 100644 index 000000000..7f19d00b0 --- /dev/null +++ b/prefer_key_path.html @@ -0,0 +1,497 @@ + + + + prefer_key_path Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Prefer Key Path

+ +

Use a key path argument instead of a closure with property access

+ +
    +
  • Identifier: prefer_key_path
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.2.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +restrict_to_standard_functions + +true +
  • +
+

Non Triggering Examples

+
f {}
+
+
f { $0 }
+
+
f { $0.a }
+
+
let f = { $0.a }(b)
+
+
//
+// restrict_to_standard_functions: false
+//
+
+f {}
+
+
+
//
+// restrict_to_standard_functions: false
+//
+
+f() { g() }
+
+
+
//
+// restrict_to_standard_functions: false
+//
+
+f { a.b.c }
+
+
+
//
+// restrict_to_standard_functions: false
+//
+
+f { a, b in a.b }
+
+
+
//
+// restrict_to_standard_functions: false
+//
+
+f { (a, b) in a.b }
+
+
+
//
+// restrict_to_standard_functions: false
+//
+
+f { $0.a } g: { $0.b }
+
+
+
//
+// restrict_to_standard_functions: false
+//
+
+[1, 2, 3].reduce(1) { $0 + $1 }
+
+
+
f.map(1) { $0.a }
+
+
f.filter({ $0.a }, x)
+
+
#Predicate { $0.a }
+
+
let transform: (Int) -> Int = nil ?? { $0.a }
+
+

Triggering Examples

+
f.map ↓{ $0.a }
+
+
f.filter ↓{ $0.a }
+
+
f.first ↓{ $0.a }
+
+
f.contains ↓{ $0.a }
+
+
f.contains(where: ↓{ $0.a })
+
+
//
+// restrict_to_standard_functions: false
+//
+
+f(↓{ $0.a })
+
+
+
//
+// restrict_to_standard_functions: false
+//
+
+f(a: ↓{ $0.b })
+
+
+
//
+// restrict_to_standard_functions: false
+//
+
+f(a: ↓{ a in a.b }, x)
+
+
+
f.map ↓{ a in a.b.c }
+
+
f.allSatisfy ↓{ (a: A) in a.b }
+
+
f.first ↓{ (a b: A) in b.c }
+
+
f.contains ↓{ $0.0.a }
+
+
f.compactMap ↓{ $0.a.b.c.d }
+
+
f.flatMap ↓{ $0.a.b }
+
+
//
+// restrict_to_standard_functions: false
+//
+
+let f: (Int) -> Int = ↓{ $0.bigEndian }
+
+
+
transform = ↓{ $0.a }
+
+ +
+
+ + +
+
+ + + diff --git a/prefer_nimble.html b/prefer_nimble.html new file mode 100644 index 000000000..48ec6a54b --- /dev/null +++ b/prefer_nimble.html @@ -0,0 +1,388 @@ + + + + prefer_nimble Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Prefer Nimble

+ +

Prefer Nimble matchers over XCTAssert functions

+ +
    +
  • Identifier: prefer_nimble
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
expect(foo) == 1
+
+
expect(foo).to(equal(1))
+
+

Triggering Examples

+
↓XCTAssertTrue(foo)
+
+
↓XCTAssertEqual(foo, 2)
+
+
↓XCTAssertNotEqual(foo, 2)
+
+
↓XCTAssertNil(foo)
+
+
↓XCTAssert(foo)
+
+
↓XCTAssertGreaterThan(foo, 10)
+
+ +
+
+ + +
+
+ + + diff --git a/prefer_self_in_static_references.html b/prefer_self_in_static_references.html new file mode 100644 index 000000000..f20e1bf58 --- /dev/null +++ b/prefer_self_in_static_references.html @@ -0,0 +1,443 @@ + + + + prefer_self_in_static_references Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Prefer Self in Static References

+ +

Use Self to refer to the surrounding type name

+ +
    +
  • Identifier: prefer_self_in_static_references
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class C {
+    static let primes = [2, 3, 5, 7]
+    func isPrime(i: Int) -> Bool { Self.primes.contains(i) }
+
+
struct T {
+    static let i = 0
+}
+struct S {
+    static let i = 0
+}
+extension T {
+    static let j = S.i + T.i
+    static let k = { T.j }()
+}
+
+
class `Self` {
+    static let i = 0
+    func f() -> Int { Self.i }
+}
+
+

Triggering Examples

+
final class CheckCellView: NSTableCellView {
+    @IBOutlet var checkButton: NSButton!
+
+    override func awakeFromNib() {
+    checkButton.action = #selector(↓CheckCellView.check(_:))
+    }
+
+    @objc func check(_ button: AnyObject?) {}
+}
+
+
class C {
+    static let i = 1
+    var j: Int {
+        let ii = ↓C.i
+        return ii
+    }
+}
+
+
class C {
+    func f() {
+        _ = [↓C]()
+        _ = [Int: ↓C]()
+    }
+}
+
+
struct S {
+    let j: Int
+    static let i = 1
+    static func f() -> Int { ↓S.i }
+    func g() -> Any { ↓S.self }
+    func h() -> ↓S { ↓S(j: 2) }
+    func i() -> KeyPath<↓S, Int> { \↓S.j }
+    func j(@Wrap(-↓S.i, ↓S.i) n: Int = ↓S.i) {}
+}
+
+
struct S {
+    struct T {
+        static let i = 3
+    }
+    struct R {
+        static let j = S.T.i
+    }
+    static let h = ↓S.T.i + ↓S.R.j
+}
+
+
enum E {
+    case A
+    static func f() -> ↓E { ↓E.A }
+    static func g() -> ↓E { ↓E.f() }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/prefer_self_type_over_type_of_self.html b/prefer_self_type_over_type_of_self.html new file mode 100644 index 000000000..7a6fcac9e --- /dev/null +++ b/prefer_self_type_over_type_of_self.html @@ -0,0 +1,414 @@ + + + + prefer_self_type_over_type_of_self Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Prefer Self Type Over Type of Self

+ +

Prefer Self over type(of: self) when accessing properties or calling methods

+ +
    +
  • Identifier: prefer_self_type_over_type_of_self
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.1.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class Foo {
+    func bar() {
+        Self.baz()
+    }
+}
+
+
class Foo {
+    func bar() {
+        print(Self.baz)
+    }
+}
+
+
class A {
+    func foo(param: B) {
+        type(of: param).bar()
+    }
+}
+
+
class A {
+    func foo() {
+        print(type(of: self))
+    }
+}
+
+

Triggering Examples

+
class Foo {
+    func bar() {
+        ↓type(of: self).baz()
+    }
+}
+
+
class Foo {
+    func bar() {
+        print(↓type(of: self).baz)
+    }
+}
+
+
class Foo {
+    func bar() {
+        print(↓Swift.type(of: self).baz)
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/prefer_type_checking.html b/prefer_type_checking.html new file mode 100644 index 000000000..cfd1600ec --- /dev/null +++ b/prefer_type_checking.html @@ -0,0 +1,406 @@ + + + + prefer_type_checking Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Prefer Type Checking

+ +

Prefer a is X to a as? X != nil

+ +
    +
  • Identifier: prefer_type_checking
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let foo = bar as? Foo
+
+
bar is Foo
+
+
2*x is X
+
+
if foo is Bar {
+    doSomeThing()
+}
+
+
if let bar = foo as? Bar {
+    foo.run()
+}
+
+
bar as Foo != nil
+
+
nil != bar as Foo
+
+
bar as Foo? != nil
+
+
bar as? Foo? != nil
+
+

Triggering Examples

+
bar ↓as? Foo != nil
+
+
2*x as? X != nil
+
+
if foo ↓as? Bar != nil {
+    doSomeThing()
+}
+
+
nil != bar ↓as? Foo
+
+
nil != 2*x ↓as? X
+
+ +
+
+ + +
+
+ + + diff --git a/prefer_zero_over_explicit_init.html b/prefer_zero_over_explicit_init.html new file mode 100644 index 000000000..97cb01b68 --- /dev/null +++ b/prefer_zero_over_explicit_init.html @@ -0,0 +1,396 @@ + + + + prefer_zero_over_explicit_init Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Prefer Zero Over Explicit Init

+ +

Prefer .zero over explicit init with zero parameters (e.g. CGPoint(x: 0, y: 0))

+ +
    +
  • Identifier: prefer_zero_over_explicit_init
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
CGRect(x: 0, y: 0, width: 0, height: 1)
+
+
CGPoint(x: 0, y: -1)
+
+
CGSize(width: 2, height: 4)
+
+
CGVector(dx: -5, dy: 0)
+
+
UIEdgeInsets(top: 0, left: 1, bottom: 0, right: 1)
+
+

Triggering Examples

+
↓CGPoint(x: 0, y: 0)
+
+
↓CGPoint(x: 0.000000, y: 0)
+
+
↓CGPoint(x: 0.000000, y: 0.000)
+
+
↓CGRect(x: 0, y: 0, width: 0, height: 0)
+
+
↓CGSize(width: 0, height: 0)
+
+
↓CGVector(dx: 0, dy: 0)
+
+
↓UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
+
+ +
+
+ + +
+
+ + + diff --git a/prefixed_toplevel_constant.html b/prefixed_toplevel_constant.html new file mode 100644 index 000000000..126578ee1 --- /dev/null +++ b/prefixed_toplevel_constant.html @@ -0,0 +1,457 @@ + + + + prefixed_toplevel_constant Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Prefixed Top-Level Constant

+ +

Top-level constants should be prefixed by k

+ +
    +
  • Identifier: prefixed_toplevel_constant
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +only_private + +false +
  • +
+

Non Triggering Examples

+
private let kFoo = 20.0
+
+
public let kFoo = false
+
+
internal let kFoo = "Foo"
+
+
let kFoo = true
+
+
//
+// only_private: true
+//
+
+let Foo = true
+
+
+
struct Foo {
+    let bar = 20.0
+}
+
+
private var foo = 20.0
+
+
public var foo = false
+
+
internal var foo = "Foo"
+
+
var foo = true
+
+
var foo = true, bar = true
+
+
var foo = true, let kFoo = true
+
+
let
+    kFoo = true
+
+
var foo: Int {
+    return a + b
+}
+
+
let kFoo = {
+    return a + b
+}()
+
+
var foo: String {
+    let bar = ""
+    return bar
+}
+
+
if condition() {
+    let result = somethingElse()
+    print(result)
+    exit()
+}
+
+
[1, 2, 3, 1000, 4000].forEach { number in
+    let isSmall = number < 10
+    if isSmall {
+        print("\(number) is a small number")
+    }
+}
+
+

Triggering Examples

+
private let ↓Foo = 20.0
+
+
public let ↓Foo = false
+
+
internal let ↓Foo = "Foo"
+
+
let ↓Foo = true
+
+
let ↓foo = 2, ↓bar = true
+
+
let
+    ↓foo = true
+
+
let ↓foo = {
+    return a + b
+}()
+
+ +
+
+ + +
+
+ + + diff --git a/private_action.html b/private_action.html new file mode 100644 index 000000000..66bbad396 --- /dev/null +++ b/private_action.html @@ -0,0 +1,440 @@ + + + + private_action Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Private Actions

+ +

IBActions should be private

+ +
    +
  • Identifier: private_action
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class Foo {
+    @IBAction private func barButtonTapped(_ sender: UIButton) {}
+}
+
+
struct Foo {
+    @IBAction private func barButtonTapped(_ sender: UIButton) {}
+}
+
+
class Foo {
+    @IBAction fileprivate func barButtonTapped(_ sender: UIButton) {}
+}
+
+
struct Foo {
+    @IBAction fileprivate func barButtonTapped(_ sender: UIButton) {}
+}
+
+
private extension Foo {
+    @IBAction func barButtonTapped(_ sender: UIButton) {}
+}
+
+
fileprivate extension Foo {
+    @IBAction func barButtonTapped(_ sender: UIButton) {}
+}
+
+

Triggering Examples

+
class Foo {
+    @IBAction ↓func barButtonTapped(_ sender: UIButton) {}
+}
+
+
struct Foo {
+    @IBAction ↓func barButtonTapped(_ sender: UIButton) {}
+}
+
+
class Foo {
+    @IBAction public ↓func barButtonTapped(_ sender: UIButton) {}
+}
+
+
struct Foo {
+    @IBAction public ↓func barButtonTapped(_ sender: UIButton) {}
+}
+
+
class Foo {
+    @IBAction internal ↓func barButtonTapped(_ sender: UIButton) {}
+}
+
+
struct Foo {
+    @IBAction internal ↓func barButtonTapped(_ sender: UIButton) {}
+}
+
+
extension Foo {
+    @IBAction ↓func barButtonTapped(_ sender: UIButton) {}
+}
+
+
extension Foo {
+    @IBAction public ↓func barButtonTapped(_ sender: UIButton) {}
+}
+
+
extension Foo {
+    @IBAction internal ↓func barButtonTapped(_ sender: UIButton) {}
+}
+
+
public extension Foo {
+    @IBAction ↓func barButtonTapped(_ sender: UIButton) {}
+}
+
+
internal extension Foo {
+    @IBAction ↓func barButtonTapped(_ sender: UIButton) {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/private_outlet.html b/private_outlet.html new file mode 100644 index 000000000..51572f188 --- /dev/null +++ b/private_outlet.html @@ -0,0 +1,435 @@ + + + + private_outlet Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Private Outlets

+ +

IBOutlets should be private to avoid leaking UIKit to higher layers

+ +
    +
  • Identifier: private_outlet
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +allow_private_set + +false +
  • +
+

Non Triggering Examples

+
class Foo { @IBOutlet private var label: UILabel? }
+
+
class Foo { @IBOutlet private var label: UILabel! }
+
+
class Foo { var notAnOutlet: UILabel }
+
+
class Foo { @IBOutlet weak private var label: UILabel? }
+
+
class Foo { @IBOutlet private weak var label: UILabel? }
+
+
class Foo { @IBOutlet fileprivate weak var label: UILabel? }
+
+
//
+// allow_private_set: true
+//
+
+class Foo { @IBOutlet private(set) var label: UILabel? }
+
+
+
//
+// allow_private_set: true
+//
+
+class Foo { @IBOutlet private(set) var label: UILabel! }
+
+
+
//
+// allow_private_set: true
+//
+
+class Foo { @IBOutlet weak private(set) var label: UILabel? }
+
+
+
//
+// allow_private_set: true
+//
+
+class Foo { @IBOutlet private(set) weak var label: UILabel? }
+
+
+
//
+// allow_private_set: true
+//
+
+class Foo { @IBOutlet fileprivate(set) weak var label: UILabel? }
+
+
+

Triggering Examples

+
class Foo { @IBOutlet ↓var label: UILabel? }
+
+
class Foo { @IBOutlet ↓var label: UILabel! }
+
+
class Foo { @IBOutlet private(set) ↓var label: UILabel? }
+
+
class Foo { @IBOutlet fileprivate(set) ↓var label: UILabel? }
+
+ +
+
+ + +
+
+ + + diff --git a/private_over_fileprivate.html b/private_over_fileprivate.html new file mode 100644 index 000000000..b3065b5c3 --- /dev/null +++ b/private_over_fileprivate.html @@ -0,0 +1,428 @@ + + + + private_over_fileprivate Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Private over Fileprivate

+ +

Prefer private over fileprivate declarations

+ +
    +
  • Identifier: private_over_fileprivate
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +validate_extensions + +false +
  • +
+

Non Triggering Examples

+
extension String {}
+
+
private extension String {}
+
+
public protocol P {}
+
+
open extension 
+ String {}
+
+
internal extension String {}
+
+
package typealias P = Int
+
+
extension String {
+  fileprivate func Something(){}
+}
+
+
class MyClass {
+  fileprivate let myInt = 4
+}
+
+
actor MyActor {
+  fileprivate let myInt = 4
+}
+
+
class MyClass {
+  fileprivate(set) var myInt = 4
+}
+
+
struct Outer {
+  struct Inter {
+    fileprivate struct Inner {}
+  }
+}
+
+

Triggering Examples

+
↓fileprivate enum MyEnum {}
+
+
↓fileprivate class MyClass {
+  fileprivate(set) var myInt = 4
+}
+
+
↓fileprivate actor MyActor {
+  fileprivate let myInt = 4
+}
+
+
    ↓fileprivate func f() {}
+    ↓fileprivate var x = 0
+
+ +
+
+ + +
+
+ + + diff --git a/private_subject.html b/private_subject.html new file mode 100644 index 000000000..1b89e77a7 --- /dev/null +++ b/private_subject.html @@ -0,0 +1,534 @@ + + + + private_subject Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Private Combine Subject

+ +

Combine Subject should be private

+ +
    +
  • Identifier: private_subject
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
final class Foobar {
+    private let goodSubject = PassthroughSubject<Bool, Never>()
+}
+
+
final class Foobar {
+    private let goodSubject: PassthroughSubject<Bool, Never>
+}
+
+
final class Foobar {
+    fileprivate let goodSubject: PassthroughSubject<Bool, Never>
+}
+
+
final class Foobar {
+    private let goodSubject: PassthroughSubject<Bool, Never> = .init()
+}
+
+
final class Foobar {
+    private let goodSubject = CurrentValueSubject<Bool, Never>(false)
+}
+
+
final class Foobar {
+    private let goodSubject: CurrentValueSubject<Bool, Never>
+}
+
+
final class Foobar {
+    fileprivate let goodSubject: CurrentValueSubject<String, Never>
+}
+
+
final class Foobar {
+    private let goodSubject: CurrentValueSubject<String, Never> = .init("toto")
+}
+
+
final class Foobar {
+    private let goodSubject = PassthroughSubject<Set<String>, Never>()
+}
+
+
final class Foobar {
+    private let goodSubject: PassthroughSubject<Set<String>, Never> = .init()
+}
+
+
final class Foobar {
+    private let goodSubject: CurrentValueSubject<Set<String>, Never> = .init([])
+}
+
+
final class Foobar {
+    private let goodSubject =
+        PassthroughSubject<Bool, Never>()
+}
+
+
final class Foobar {
+    private let goodSubject:
+        PassthroughSubject<Bool, Never> = .init()
+}
+
+
final class Foobar {
+    private let goodSubject =
+        CurrentValueSubject<Bool, Never>(true)
+}
+
+
final class Foobar {
+    private let goodSubject: CurrentValueSubject<Bool, Never>
+    init() {
+        let goodSubject = CurrentValueSubject<Bool, Never>(true)
+        self.goosSubject = goodSubject
+    }
+}
+
+
func foo() {
+    let goodSubject = PassthroughSubject<Bool, Never>(true)
+}
+
+

Triggering Examples

+
final class Foobar {
+    let ↓badSubject = PassthroughSubject<Bool, Never>()
+}
+
+
final class Foobar {
+    let ↓badSubject: PassthroughSubject<Bool, Never>
+}
+
+
final class Foobar {
+    private(set) let ↓badSubject: PassthroughSubject<Bool, Never>
+}
+
+
final class Foobar {
+    private(set) let ↓badSubject = PassthroughSubject<Bool, Never>()
+}
+
+
final class Foobar {
+    let goodSubject: PassthroughSubject<Bool, Never> = .init()
+}
+
+
final class Foobar {
+    private let goodSubject: PassthroughSubject<Bool, Never>
+    private(set) let ↓badSubject = PassthroughSubject<Bool, Never>()
+    private(set) let ↓anotherBadSubject = PassthroughSubject<Bool, Never>()
+}
+
+
final class Foobar {
+    private(set) let ↓badSubject = PassthroughSubject<Bool, Never>()
+    private let goodSubject: PassthroughSubject<Bool, Never>
+    private(set) let ↓anotherBadSubject = PassthroughSubject<Bool, Never>()
+}
+
+
final class Foobar {
+    let ↓badSubject = CurrentValueSubject<Bool, Never>(true)
+}
+
+
final class Foobar {
+    let ↓badSubject: CurrentValueSubject<Bool, Never>
+}
+
+
final class Foobar {
+    private(set) let ↓badSubject: CurrentValueSubject<Bool, Never>
+}
+
+
final class Foobar {
+    private(set) let ↓badSubject = CurrentValueSubject<Bool, Never>(false)
+}
+
+
final class Foobar {
+    let goodSubject: CurrentValueSubject<String, Never> = .init("toto")
+}
+
+
final class Foobar {
+    private let goodSubject: CurrentValueSubject<Bool, Never>
+    private(set) let ↓badSubject = CurrentValueSubject<Bool, Never>(false)
+    private(set) let ↓anotherBadSubject = CurrentValueSubject<Bool, Never>(false)
+}
+
+
final class Foobar {
+    private(set) let ↓badSubject = CurrentValueSubject<Bool, Never>(false)
+    private let goodSubject: CurrentValueSubject<Bool, Never>
+    private(set) let ↓anotherBadSubject = CurrentValueSubject<Bool, Never>(true)
+}
+
+
final class Foobar {
+    let ↓badSubject = PassthroughSubject<Set<String>, Never>()
+}
+
+
final class Foobar {
+    let ↓badSubject: PassthroughSubject<Set<String>, Never> = .init()
+}
+
+
final class Foobar {
+    let ↓badSubject: CurrentValueSubject<Set<String>, Never> = .init([])
+}
+
+
final class Foobar {
+    let ↓badSubject =
+        PassthroughSubject<Bool, Never>()
+}
+
+
final class Foobar {
+    let ↓badSubject:
+        PassthroughSubject<Bool, Never> = .init()
+}
+
+
final class Foobar {
+    let ↓badSubject =
+        CurrentValueSubject<Bool, Never>(true)
+}
+
+ +
+
+ + +
+
+ + + diff --git a/private_swiftui_state.html b/private_swiftui_state.html new file mode 100644 index 000000000..e15342e6e --- /dev/null +++ b/private_swiftui_state.html @@ -0,0 +1,524 @@ + + + + private_swiftui_state Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Private SwiftUI State Properties

+ +

SwiftUI state properties should be private

+ +
    +
  • Identifier: private_swiftui_state
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
struct MyApp: App {
+    @State private var isPlaying: Bool = false
+}
+
+
struct MyScene: Scene {
+    @State private var isPlaying: Bool = false
+}
+
+
struct CofntentView: View {
+    @State private var isPlaying: Bool = false
+}
+
+
struct ContentView: View {
+    @State private var isPlaying: Bool = false
+
+    struct InnerView: View {
+        @State private var showsIndicator: Bool = false
+    }
+}
+
+
struct MyStruct {
+    struct ContentView: View {
+        @State private var isPlaying: Bool = false
+    }
+}
+
+
struct MyStruct {
+    struct ContentView: View {
+        @State private var isPlaying: Bool = false
+    }
+
+    @State var nonTriggeringState: Bool = false
+}
+
+
struct ContentView: View {
+    var s: Int {
+        @State
+        var s: Int = 3
+        return s
+    }
+
+    var body: some View { Text("") }
+}
+
+
struct ContentView: View {
+    var isPlaying = false
+}
+
+
struct MyApp: App {
+    @StateObject private var model = DataModel()
+}
+
+
struct MyScene: Scene {
+    @StateObject private var model = DataModel()
+}
+
+
struct ContentView: View {
+    @StateObject private var model = DataModel()
+}
+
+
struct MyStruct {
+    struct ContentView: View {
+        @StateObject private var dataModel = DataModel()
+    }
+
+    @StateObject var nonTriggeringObject = MyModel()
+}
+
+
struct Foo {
+    @State var bar = false
+}
+
+
class Foo: ObservableObject {
+    @State var bar = Bar()
+}
+
+
extension MyObject {
+    struct ContentView: View {
+        @State private var isPlaying: Bool = false
+    }
+}
+
+
actor ContentView: View {
+    @State private var isPlaying: Bool = false
+}
+
+

Triggering Examples

+
struct MyApp: App {
+    @State ↓var isPlaying: Bool = false
+}
+
+
struct MyScene: Scene {
+    @State ↓public var isPlaying: Bool = false
+}
+
+
struct ContentView: View {
+    @State ↓var isPlaying: Bool = false
+}
+
+
struct ContentView: View {
+    struct InnerView: View {
+        @State private var showsIndicator: Bool = false
+    }
+
+    @State ↓var isPlaying: Bool = false
+}
+
+
struct MyStruct {
+    struct ContentView: View {
+        @State ↓var isPlaying: Bool = false
+    }
+}
+
+
struct MyStruct {
+    struct ContentView: View {
+        @State ↓var isPlaying: Bool = false
+    }
+
+    @State var isPlaying: Bool = false
+}
+
+
final class ContentView: View {
+    @State ↓var isPlaying: Bool = false
+}
+
+
extension MyObject {
+    struct ContentView: View {
+        @State ↓var isPlaying: Bool = false
+    }
+}
+
+
actor ContentView: View {
+    @State ↓var isPlaying: Bool = false
+}
+
+
struct MyApp: App {
+    @StateObject ↓var model = DataModel()
+}
+
+
struct MyScene: Scene {
+    @StateObject ↓var model = DataModel()
+}
+
+
struct ContentView: View {
+    @StateObject ↓var model = DataModel()
+}
+
+
struct ContentView: View {
+    @State ↓private(set) var isPlaying = false
+
+
struct ContentView: View {
+    @State ↓fileprivate(set) public var isPlaying = false
+
+ +
+
+ + +
+
+ + + diff --git a/private_unit_test.html b/private_unit_test.html new file mode 100644 index 000000000..97f749316 --- /dev/null +++ b/private_unit_test.html @@ -0,0 +1,451 @@ + + + + private_unit_test Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Private Unit Test

+ +

Unit tests marked private are silently skipped

+ +
    +
  • Identifier: private_unit_test
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +test_parent_classes + +[“QuickSpec”, “XCTestCase”] +
  • +
+

Non Triggering Examples

+
class FooTest: XCTestCase {
+    func test1() {}
+    internal func test2() {}
+    public func test3() {}
+}
+
+
internal class FooTest: XCTestCase {
+    func test1() {}
+    internal func test2() {}
+    public func test3() {}
+}
+
+
public class FooTest: XCTestCase {
+    func test1() {}
+    internal func test2() {}
+    public func test3() {}
+}
+
+
@objc private class FooTest: XCTestCase {
+    @objc private func test1() {}
+    internal func test2() {}
+    public func test3() {}
+}
+
+
private class Foo: NSObject {
+    func test1() {}
+    internal func test2() {}
+    public func test3() {}
+}
+
+
private class Foo {
+    func test1() {}
+    internal func test2() {}
+    public func test3() {}
+}
+
+
public class FooTest: XCTestCase {
+    private func test1(param: Int) {}
+    private func test2() -> String { "" }
+    private func atest() {}
+    private static func test3() {}
+}
+
+

Triggering Examples

+
private ↓class FooTest: XCTestCase {
+    func test1() {}
+    internal func test2() {}
+    public func test3() {}
+    private func test4() {}
+}
+
+
class FooTest: XCTestCase {
+    func test1() {}
+    internal func test2() {}
+    public func test3() {}
+    private ↓func test4() {}
+}
+
+
internal class FooTest: XCTestCase {
+    func test1() {}
+    internal func test2() {}
+    public func test3() {}
+    private ↓func test4() {}
+}
+
+
public class FooTest: XCTestCase {
+    func test1() {}
+    internal func test2() {}
+    public func test3() {}
+    private ↓func test4() {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/prohibited_interface_builder.html b/prohibited_interface_builder.html new file mode 100644 index 000000000..ccf454750 --- /dev/null +++ b/prohibited_interface_builder.html @@ -0,0 +1,388 @@ + + + + prohibited_interface_builder Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Prohibited Interface Builder

+ +

Creating views using Interface Builder should be avoided

+ +
    +
  • Identifier: prohibited_interface_builder
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class ViewController: UIViewController {
+    var label: UILabel!
+}
+
+
class ViewController: UIViewController {
+    @objc func buttonTapped(_ sender: UIButton) {}
+}
+
+

Triggering Examples

+
class ViewController: UIViewController {
+    @IBOutlet ↓var label: UILabel!
+}
+
+
class ViewController: UIViewController {
+    @IBAction ↓func buttonTapped(_ sender: UIButton) {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/prohibited_super_call.html b/prohibited_super_call.html new file mode 100644 index 000000000..d244264c9 --- /dev/null +++ b/prohibited_super_call.html @@ -0,0 +1,437 @@ + + + + prohibited_super_call Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Prohibited Calls to Super

+ +

Some methods should not call super.

+ +
    +
  • Identifier: prohibited_super_call
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +excluded + +[] +
    +included + +[“*”] +
  • +
+

Non Triggering Examples

+
class VC: UIViewController {
+    override func loadView() {
+    }
+}
+
+
class NSView {
+    func updateLayer() {
+        self.method1()
+    }
+}
+
+
public class FileProviderExtension: NSFileProviderExtension {
+    override func providePlaceholder(at url: URL, completionHandler: @escaping (Error?) -> Void) {
+        guard let identifier = persistentIdentifierForItem(at: url) else {
+            completionHandler(NSFileProviderError(.noSuchItem))
+            return
+        }
+    }
+}
+
+

Triggering Examples

+
class VC: UIViewController {
+    override func loadView() {↓
+        super.loadView()
+    }
+}
+
+
class VC: NSFileProviderExtension {
+    override func providePlaceholder(at url: URL, completionHandler: @escaping (Error?) -> Void) {↓
+        self.method1()
+        super.providePlaceholder(at:url, completionHandler: completionHandler)
+    }
+}
+
+
class VC: NSView {
+    override func updateLayer() {↓
+        self.method1()
+        super.updateLayer()
+        self.method2()
+    }
+}
+
+
class VC: NSView {
+    override func updateLayer() {↓
+        defer {
+            super.updateLayer()
+        }
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/protocol_property_accessors_order.html b/protocol_property_accessors_order.html new file mode 100644 index 000000000..2d1ccc560 --- /dev/null +++ b/protocol_property_accessors_order.html @@ -0,0 +1,388 @@ + + + + protocol_property_accessors_order Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Protocol Property Accessors Order

+ +

When declaring properties in protocols, the order of accessors should be get set

+ +
    +
  • Identifier: protocol_property_accessors_order
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
protocol Foo {
+ var bar: String { get set }
+ }
+
+
protocol Foo {
+ var bar: String { get }
+ }
+
+
protocol Foo {
+ var bar: String { set }
+ }
+
+

Triggering Examples

+
protocol Foo {
+ var bar: String { ↓set get }
+ }
+
+ +
+
+ + +
+
+ + + diff --git a/quick_discouraged_call.html b/quick_discouraged_call.html new file mode 100644 index 000000000..aafc4e9b8 --- /dev/null +++ b/quick_discouraged_call.html @@ -0,0 +1,664 @@ + + + + quick_discouraged_call Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Quick Discouraged Call

+ +

Discouraged call inside ‘describe’ and/or ‘context’ block.

+ +
    +
  • Identifier: quick_discouraged_call
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class TotoTests {
+   override func spec() {
+       describe("foo") {
+           let foo = Foo()
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           beforeEach {
+               let foo = Foo()
+               foo.toto()
+           }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           beforeEach {
+               let foo = Foo()
+               foo.toto()
+           }
+           afterEach {
+               let foo = Foo()
+               foo.toto()
+           }
+           describe("bar") {
+           }
+           context("bar") {
+           }
+           it("bar") {
+               let foo = Foo()
+               foo.toto()
+           }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           justBeforeEach {
+               let foo = Foo()
+               foo.toto()
+           }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           aroundEach {
+               let foo = Foo()
+               foo.toto()
+           }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+          itBehavesLike("bar")
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           it("does something") {
+               let foo = Foo()
+               foo.toto()
+           }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       context("foo") {
+           afterEach { toto.append(foo) }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       xcontext("foo") {
+           afterEach { toto.append(foo) }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       xdescribe("foo") {
+           afterEach { toto.append(foo) }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           xit("does something") {
+               let foo = Foo()
+               foo.toto()
+           }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       fcontext("foo") {
+           afterEach { toto.append(foo) }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       fdescribe("foo") {
+           afterEach { toto.append(foo) }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           fit("does something") {
+               let foo = Foo()
+               foo.toto()
+           }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       fitBehavesLike("foo")
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       xitBehavesLike("foo")
+   }
+}
+
+

Triggering Examples

+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           let foo = ↓Foo()
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override static func spec() {
+       describe("foo") {
+           let foo = ↓Foo()
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           let foo = ↓Foo()
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           context("foo") {
+               let foo = ↓Foo()
+           }
+           context("bar") {
+               let foo = ↓Foo()
+               ↓foo.bar()
+               it("does something") {
+                   let foo = Foo()
+                   foo.toto()
+               }
+           }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           context("foo") {
+               context("foo") {
+                   beforeEach {
+                       let foo = Foo()
+                       foo.toto()
+                   }
+                   it("bar") {
+                   }
+                   context("foo") {
+                       let foo = ↓Foo()
+                   }
+               }
+           }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       context("foo") {
+           let foo = ↓Foo()
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       sharedExamples("foo") {
+           let foo = ↓Foo()
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           ↓foo()
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       context("foo") {
+           ↓foo()
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       sharedExamples("foo") {
+           ↓foo()
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       xdescribe("foo") {
+           let foo = ↓Foo()
+       }
+       fdescribe("foo") {
+           let foo = ↓Foo()
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       xcontext("foo") {
+           let foo = ↓Foo()
+       }
+       fcontext("foo") {
+           let foo = ↓Foo()
+       }
+   }
+}
+
+
class TotoTests: QuickSpecSubclass {
+   override func spec() {
+       xcontext("foo") {
+           let foo = ↓Foo()
+       }
+       fcontext("foo") {
+           let foo = ↓Foo()
+       }
+   }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/quick_discouraged_focused_test.html b/quick_discouraged_focused_test.html new file mode 100644 index 000000000..cefb450d2 --- /dev/null +++ b/quick_discouraged_focused_test.html @@ -0,0 +1,441 @@ + + + + quick_discouraged_focused_test Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Quick Discouraged Focused Test

+ +

Non-focused tests won’t run as long as this test is focused

+ +
    +
  • Identifier: quick_discouraged_focused_test
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           describe("bar") { }
+           context("bar") {
+               it("bar") { }
+           }
+           it("bar") { }
+           itBehavesLike("bar")
+       }
+   }
+}
+
+

Triggering Examples

+
class TotoTests: QuickSpec {
+   override func spec() {
+       ↓fdescribe("foo") { }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       ↓fcontext("foo") { }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       ↓fit("foo") { }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           ↓fit("bar") { }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       context("foo") {
+           ↓fit("bar") { }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           context("bar") {
+               ↓fit("toto") { }
+           }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       ↓fitBehavesLike("foo")
+   }
+}
+
+
class TotoTests: QuickSpecSubclass {
+   override func spec() {
+       ↓fitBehavesLike("foo")
+   }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/quick_discouraged_pending_test.html b/quick_discouraged_pending_test.html new file mode 100644 index 000000000..961f61e10 --- /dev/null +++ b/quick_discouraged_pending_test.html @@ -0,0 +1,447 @@ + + + + quick_discouraged_pending_test Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Quick Discouraged Pending Test

+ +

This test won’t run as long as it’s marked pending

+ +
    +
  • Identifier: quick_discouraged_pending_test
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           describe("bar") { }
+           context("bar") {
+               it("bar") { }
+           }
+           it("bar") { }
+           itBehavesLike("bar")
+       }
+   }
+}
+
+

Triggering Examples

+
class TotoTests: QuickSpec {
+   override func spec() {
+       ↓xdescribe("foo") { }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       ↓xcontext("foo") { }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       ↓xit("foo") { }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           ↓xit("bar") { }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       context("foo") {
+           ↓xit("bar") { }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       describe("foo") {
+           context("bar") {
+               ↓xit("toto") { }
+           }
+       }
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       ↓pending("foo")
+   }
+}
+
+
class TotoTests: QuickSpec {
+   override func spec() {
+       ↓xitBehavesLike("foo")
+   }
+}
+
+
class TotoTests: QuickSpecSubclass {
+   override func spec() {
+       ↓xitBehavesLike("foo")
+   }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/raw_value_for_camel_cased_codable_enum.html b/raw_value_for_camel_cased_codable_enum.html new file mode 100644 index 000000000..d18abb932 --- /dev/null +++ b/raw_value_for_camel_cased_codable_enum.html @@ -0,0 +1,437 @@ + + + + raw_value_for_camel_cased_codable_enum Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Raw Value for Camel Cased Codable Enum

+ +

Camel cased cases of Codable String enums should have raw values

+ +
    +
  • Identifier: raw_value_for_camel_cased_codable_enum
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
enum Numbers: Codable {
+  case int(Int)
+  case short(Int16)
+}
+
+
enum Numbers: Int, Codable {
+  case one = 1
+  case two = 2
+}
+
+
enum Numbers: Double, Codable {
+  case one = 1.1
+  case two = 2.2
+}
+
+
enum Numbers: String, Codable {
+  case one = "one"
+  case two = "two"
+}
+
+
enum Status: String, Codable {
+    case OK, ACCEPTABLE
+}
+
+
enum Status: String, Codable {
+    case ok
+    case maybeAcceptable = "maybe_acceptable"
+}
+
+
enum Status: String {
+    case ok
+    case notAcceptable
+    case maybeAcceptable = "maybe_acceptable"
+}
+
+
enum Status: Int, Codable {
+    case ok
+    case notAcceptable
+    case maybeAcceptable = -1
+}
+
+

Triggering Examples

+
enum Status: String, Codable {
+    case ok
+    case ↓notAcceptable
+    case maybeAcceptable = "maybe_acceptable"
+}
+
+
enum Status: String, Decodable {
+   case ok
+   case ↓notAcceptable
+   case maybeAcceptable = "maybe_acceptable"
+}
+
+
enum Status: String, Encodable {
+   case ok
+   case ↓notAcceptable
+   case maybeAcceptable = "maybe_acceptable"
+}
+
+
enum Status: String, Codable {
+    case ok
+    case ↓notAcceptable
+    case maybeAcceptable = "maybe_acceptable"
+}
+
+ +
+
+ + +
+
+ + + diff --git a/reduce_boolean.html b/reduce_boolean.html new file mode 100644 index 000000000..5290d6e8b --- /dev/null +++ b/reduce_boolean.html @@ -0,0 +1,396 @@ + + + + reduce_boolean Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Reduce Boolean

+ +

Prefer using .allSatisfy() or .contains() over reduce(true) or reduce(false).

+ +
    +
  • Identifier: reduce_boolean
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
nums.reduce(0) { $0.0 + $0.1 }
+
+
nums.reduce(0.0) { $0.0 + $0.1 }
+
+
nums.reduce(initial: true) { $0.0 && $0.1 == 3 }
+
+

Triggering Examples

+
let allNines = nums.↓reduce(true) { $0.0 && $0.1 == 9 }
+
+
let anyNines = nums.↓reduce(false) { $0.0 || $0.1 == 9 }
+
+
let allValid = validators.↓reduce(true) { $0 && $1(input) }
+
+
let anyValid = validators.↓reduce(false) { $0 || $1(input) }
+
+
let allNines = nums.↓reduce(true, { $0.0 && $0.1 == 9 })
+
+
let anyNines = nums.↓reduce(false, { $0.0 || $0.1 == 9 })
+
+
let allValid = validators.↓reduce(true, { $0 && $1(input) })
+
+
let anyValid = validators.↓reduce(false, { $0 || $1(input) })
+
+
nums.reduce(into: true) { (r: inout Bool, s) in r = r && (s == 3) }
+
+ +
+
+ + +
+
+ + + diff --git a/reduce_into.html b/reduce_into.html new file mode 100644 index 000000000..437a435bf --- /dev/null +++ b/reduce_into.html @@ -0,0 +1,447 @@ + + + + reduce_into Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Reduce into

+ +

Prefer reduce(into:_:) over reduce(_:_:) for copy-on-write types

+ +
    +
  • Identifier: reduce_into
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let foo = values.reduce(into: "abc") { $0 += "\($1)" }
+
+
values.reduce(into: Array<Int>()) { result, value in
+    result.append(value)
+}
+
+
let rows = violations.enumerated().reduce(into: "") { rows, indexAndViolation in
+    rows.append(generateSingleRow(for: indexAndViolation.1, at: indexAndViolation.0 + 1))
+}
+
+
zip(group, group.dropFirst()).reduce(into: []) { result, pair in
+    result.append(pair.0 + pair.1)
+}
+
+
let foo = values.reduce(into: [String: Int]()) { result, value in
+    result["\(value)"] = value
+}
+
+
let foo = values.reduce(into: Dictionary<String, Int>.init()) { result, value in
+    result["\(value)"] = value
+}
+
+
let foo = values.reduce(into: [Int](repeating: 0, count: 10)) { result, value in
+    result.append(value)
+}
+
+
let foo = values.reduce(MyClass()) { result, value in
+    result.handleValue(value)
+    return result
+}
+
+

Triggering Examples

+
let bar = values.↓reduce("abc") { $0 + "\($1)" }
+
+
values.↓reduce(Array<Int>()) { result, value in
+    result += [value]
+}
+
+
[1, 2, 3].↓reduce(Set<Int>()) { acc, value in
+    var result = acc
+    result.insert(value)
+    return result
+}
+
+
let rows = violations.enumerated().↓reduce("") { rows, indexAndViolation in
+    return rows + generateSingleRow(for: indexAndViolation.1, at: indexAndViolation.0 + 1)
+}
+
+
zip(group, group.dropFirst()).↓reduce([]) { result, pair in
+    result + [pair.0 + pair.1]
+}
+
+
let foo = values.↓reduce([String: Int]()) { result, value in
+    var result = result
+    result["\(value)"] = value
+    return result
+}
+
+
let bar = values.↓reduce(Dictionary<String, Int>.init()) { result, value in
+    var result = result
+    result["\(value)"] = value
+    return result
+}
+
+
let bar = values.↓reduce([Int](repeating: 0, count: 10)) { result, value in
+    return result + [value]
+}
+
+
extension Data {
+    var hexString: String {
+        return ↓reduce("") { (output, byte) -> String in
+            output + String(format: "%02x", byte)
+        }
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/redundant_discardable_let.html b/redundant_discardable_let.html new file mode 100644 index 000000000..702e888ed --- /dev/null +++ b/redundant_discardable_let.html @@ -0,0 +1,411 @@ + + + + redundant_discardable_let Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Redundant Discardable Let

+ +

Prefer _ = foo() over let _ = foo() when discarding a result from a function

+ +
    +
  • Identifier: redundant_discardable_let
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +ignore_swiftui_view_bodies + +false +
  • +
+

Non Triggering Examples

+
_ = foo()
+
+
if let _ = foo() { }
+
+
guard let _ = foo() else { return }
+
+
let _: ExplicitType = foo()
+
+
while let _ = SplashStyle(rawValue: maxValue) { maxValue += 1 }
+
+
async let _ = await foo()
+
+
//
+// ignore_swiftui_view_bodies: true
+//
+
+var body: some View {
+    let _ = foo()
+    return Text("Hello, World!")
+}
+
+
+

Triggering Examples

+
↓let _ = foo()
+
+
if _ = foo() { ↓let _ = bar() }
+
+
var body: some View {
+    ↓let _ = foo()
+    Text("Hello, World!")
+}
+
+ +
+
+ + +
+
+ + + diff --git a/redundant_nil_coalescing.html b/redundant_nil_coalescing.html new file mode 100644 index 000000000..196f138b0 --- /dev/null +++ b/redundant_nil_coalescing.html @@ -0,0 +1,376 @@ + + + + redundant_nil_coalescing Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Redundant Nil Coalescing

+ +

nil coalescing operator is only evaluated if the lhs is nil, coalescing operator with nil as rhs is redundant

+ +
    +
  • Identifier: redundant_nil_coalescing
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
var myVar: Int?; myVar ?? 0
+
+

Triggering Examples

+
var myVar: Int? = nil; myVar ↓?? nil
+
+ +
+
+ + +
+
+ + + diff --git a/redundant_objc_attribute.html b/redundant_objc_attribute.html new file mode 100644 index 000000000..c28159db9 --- /dev/null +++ b/redundant_objc_attribute.html @@ -0,0 +1,562 @@ + + + + redundant_objc_attribute Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Redundant @objc Attribute

+ +

Objective-C attribute (@objc) is redundant in declaration

+ +
    +
  • Identifier: redundant_objc_attribute
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
@objc private var foo: String? {}
+
+
@IBInspectable private var foo: String? {}
+
+
@objc private func foo(_ sender: Any) {}
+
+
@IBAction private func foo(_ sender: Any) {}
+
+
@GKInspectable private var foo: String! {}
+
+
private @GKInspectable var foo: String! {}
+
+
@NSManaged var foo: String!
+
+
@objc @NSCopying var foo: String!
+
+
@objcMembers
+class Foo {
+    var bar: Any?
+    @objc
+    class Bar: NSObject {
+        @objc
+        var foo: Any?
+    }
+}
+
+
@objc
+extension Foo {
+    var bar: Int {
+        return 0
+    }
+}
+
+
extension Foo {
+    @objc
+    var bar: Int { return 0 }
+}
+
+
@objc @IBDesignable
+extension Foo {
+    var bar: Int { return 0 }
+}
+
+
@IBDesignable
+extension Foo {
+    @objc
+    var bar: Int { return 0 }
+    var fooBar: Int { return 1 }
+}
+
+
@objcMembers
+class Foo: NSObject {
+    @objc
+    private var bar: Int {
+        return 0
+    }
+}
+
+
@objcMembers
+class Foo {
+    @objc
+    class Bar: NSObject {
+        @objc var foo: Any?
+    }
+}
+
+
@objcMembers
+class Foo: NSObject {
+    @objc class Bar {}
+}
+
+
extension BlockEditorSettings {
+    @objc(addElementsObject:)
+    @NSManaged public func addToElements(_ value: BlockEditorSettingElement)
+}
+
+
@objcMembers
+public class Foo: NSObject {
+    @objc
+    private func handler(_ notification: Notification) {
+    }
+
+    func registerForNotifications() {
+        NotificationCenter.default.addObserver(self, selector: #selector(handler(_:)), name: nil, object: nil)
+    }
+}
+
+
class Foo: NSObject { }
+
+@objc extension Foo {
+    @objc enum Bar: Int {
+       case bar
+    }
+
+    var bar: Bar { .bar }
+}
+
+
class Foo: NSObject { }
+
+@objc extension Foo {
+    @objc private enum Baz: Int {
+      case baz
+    }
+
+    private var baz: Baz { .baz }
+}
+
+
@objcMembers
+internal class Foo: NSObject {
+    @objc
+    private var baz: Int = 1
+
+    var x: Any? {
+        value(forKey: "baz")
+    }
+}
+
+
@objcMembers
+class Foo: NSObject {
+    @objc enum Bar: Int {
+       case bar
+    }
+}
+
+

Triggering Examples

+
↓@objc @IBInspectable private var foo: String? {}
+
+
@IBInspectable ↓@objc private var foo: String? {}
+
+
↓@objc @IBAction private func foo(_ sender: Any) {}
+
+
@IBAction ↓@objc private func foo(_ sender: Any) {}
+
+
↓@objc @GKInspectable private var foo: String! {}
+
+
@GKInspectable ↓@objc private var foo: String! {}
+
+
↓@objc @NSManaged private var foo: String!
+
+
@NSManaged ↓@objc private var foo: String!
+
+
↓@objc @IBDesignable class Foo {}
+
+
@objcMembers
+class Foo: NSObject {
+    ↓@objc var bar: Any?
+}
+
+
@objcMembers
+class Foo: NSObject {
+    ↓@objc var bar: Any?
+    ↓@objc var foo: Any?
+    @objc
+    class Bar {
+        @objc
+        var foo: Any?
+    }
+}
+
+
@objc
+extension Foo {
+    ↓@objc
+    var bar: Int {
+        return 0
+    }
+}
+
+
@objc @IBDesignable
+extension Foo {
+    ↓@objc
+    var bar: Int {
+        return 0
+    }
+}
+
+
@objcMembers
+class Foo: NSObject {
+    @objcMembers
+    class Bar: NSObject {
+        ↓@objc var foo: Any
+    }
+}
+
+
@objc
+extension Foo {
+    ↓@objc
+    private var bar: Int {
+        return 0
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/redundant_optional_initialization.html b/redundant_optional_initialization.html new file mode 100644 index 000000000..e92f7a198 --- /dev/null +++ b/redundant_optional_initialization.html @@ -0,0 +1,423 @@ + + + + redundant_optional_initialization Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Redundant Optional Initialization

+ +

Initializing an optional variable with nil is redundant

+ +
    +
  • Identifier: redundant_optional_initialization
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
var myVar: Int?
+
+
let myVar: Int? = nil
+
+
var myVar: Int? = 0
+
+
func foo(bar: Int? = 0) { }
+
+
var myVar: Optional<Int>
+
+
let myVar: Optional<Int> = nil
+
+
var myVar: Optional<Int> = 0
+
+
var foo: Int? {
+  if bar != nil { }
+  return 0
+}
+
+
var foo: Int? = {
+  if bar != nil { }
+  return 0
+}()
+
+
lazy var test: Int? = nil
+
+
func funcName() {
+  var myVar: String?
+}
+
+
func funcName() {
+  let myVar: String? = nil
+}
+
+

Triggering Examples

+
var myVar: Int?↓ = nil
+
+
var myVar: Optional<Int>↓ = nil
+
+
var myVar: Int?↓=nil
+
+
var myVar: Optional<Int>↓=nil
+)
+
+
var myVar: String?↓ = nil {
+  didSet { print("didSet") }
+}
+
+
func funcName() {
+    var myVar: String?↓ = nil
+}
+
+ +
+
+ + +
+
+ + + diff --git a/redundant_self_in_closure.html b/redundant_self_in_closure.html new file mode 100644 index 000000000..c0eeec369 --- /dev/null +++ b/redundant_self_in_closure.html @@ -0,0 +1,541 @@ + + + + redundant_self_in_closure Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Redundant Self in Closure

+ +

Explicit use of ‘self’ is not required

+ +
    +
  • Identifier: redundant_self_in_closure
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
struct S {
+    var x = 0
+    func f(_ work: @escaping () -> Void) { work() }
+    func g() {
+        f {
+            x = 1
+            f { x = 1 }
+            g()
+        }
+    }
+}
+
+
class C {
+    var x = 0
+    func f(_ work: @escaping () -> Void) { work() }
+    func g() {
+        f { [weak self] in
+            self?.x = 1
+            self?.g()
+            guard let self = self ?? C() else { return }
+            self?.x = 1
+        }
+        C().f { self.x = 1 }
+        f { [weak self] in if let self { x = 1 } }
+    }
+}
+
+
struct S {
+    var x = 0, error = 0, exception = 0
+    var y: Int?, z: Int?, u: Int, v: Int?, w: Int?
+    func f(_ work: @escaping (Int) -> Void) { work() }
+    func g(x: Int) {
+        f { u in
+            self.x = x
+            let x = 1
+            self.x = 2
+            if let y, let v {
+                self.y = 3
+                self.v = 1
+            }
+            guard let z else {
+                let v = 4
+                self.x = 5
+                self.v = 6
+                return
+            }
+            self.z = 7
+            while let v { self.v = 8 }
+            for w in [Int]() { self.w = 9 }
+            self.u = u
+            do {} catch { self.error = 10 }
+            do {} catch let exception { self.exception = 11 }
+        }
+    }
+}
+
+
enum E {
+    case a(Int)
+    case b(Int, Int)
+}
+struct S {
+    var x: E = .a(3), y: Int, z: Int
+    func f(_ work: @escaping () -> Void) { work() }
+    func g(x: Int) {
+        f {
+            switch x {
+            case let .a(y):
+                self.y = 1
+            case .b(let y, var z):
+                self.y = 2
+                self.z = 3
+            }
+        }
+    }
+}
+
+

Triggering Examples

+
struct S {
+    var x = 0
+    func f(_ work: @escaping () -> Void) { work() }
+    func g() {
+        f {
+            ↓self.x = 1
+            if ↓self.x == 1 { ↓self.g() }
+        }
+    }
+}
+
+
class C {
+    var x = 0
+    func g() {
+        {
+            ↓self.x = 1
+            ↓self.g()
+        }()
+    }
+}
+
+
class C {
+    var x = 0
+    func f(_ work: @escaping () -> Void) { work() }
+    func g() {
+        f { [self] in
+            ↓self.x = 1
+            ↓self.g()
+            f { self.x = 1 }
+        }
+    }
+}
+
+
class C {
+    var x = 0
+    func f(_ work: @escaping () -> Void) { work() }
+    func g() {
+        f { [unowned self] in ↓self.x = 1 }
+        f { [self = self] in ↓self.x = 1 }
+        f { [s = self] in s.x = 1 }
+    }
+}
+
+
struct S {
+    var x = 0
+    var y: Int?, z: Int?, v: Int?, w: Int?
+    func f(_ work: @escaping () -> Void) { work() }
+    func g(w: Int, _ v: Int) {
+        f {
+            self.w = 1
+            ↓self.x = 2
+            if let y { ↓self.x = 3 }
+            else { ↓self.y = 3 }
+            guard let z else {
+                ↓self.z = 4
+                ↓self.x = 5
+                return
+            }
+            ↓self.y = 6
+            while let y { ↓self.x = 7 }
+            for y in [Int]() { ↓self.x = 8 }
+            self.v = 9
+            do {
+                let x = 10
+                self.x = 11
+            }
+            ↓self.x = 12
+        }
+    }
+}
+
+
class C {
+    var x = 0
+    func f(_ work: @escaping () -> Void) { work() }
+    func g() {
+        f { [weak self] in
+            self?.x = 1
+            guard let self else { return }
+            ↓self.x = 1
+        }
+        f { [weak self] in
+            self?.x = 1
+            if let self = self else { ↓self.x = 1 }
+            self?.x = 1
+        }
+        f { [weak self] in
+            self?.x = 1
+            while let self else { ↓self.x = 1 }
+            self?.x = 1
+        }
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/redundant_sendable.html b/redundant_sendable.html new file mode 100644 index 000000000..3df730895 --- /dev/null +++ b/redundant_sendable.html @@ -0,0 +1,401 @@ + + + + redundant_sendable Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Redundant Sendable

+ +

Sendable conformance is redundant on an actor-isolated type

+ +
    +
  • Identifier: redundant_sendable
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +global_actors + +[] +
  • +
+

Non Triggering Examples

+
struct S: Sendable {}
+
+
class C: Sendable {}
+
+
actor A {}
+
+
@MainActor struct S {}
+
+
@MyActor enum E: Sendable { case a }
+
+

Triggering Examples

+
@MainActor struct ↓S: Sendable {}
+
+
actor ↓A: Sendable {}
+
+
//
+// global_actors: ["MyActor"]
+//
+
+@MyActor enum ↓E: Sendable { case a }
+
+
+ +
+
+ + +
+
+ + + diff --git a/redundant_set_access_control.html b/redundant_set_access_control.html new file mode 100644 index 000000000..0a49bcd47 --- /dev/null +++ b/redundant_set_access_control.html @@ -0,0 +1,412 @@ + + + + redundant_set_access_control Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Redundant Access Control for Setter

+ +

Property setter access level shouldn’t be explicit if it’s the same as the variable access level

+ +
    +
  • Identifier: redundant_set_access_control
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
private(set) public var foo: Int
+
+
public let foo: Int
+
+
public var foo: Int
+
+
var foo: Int
+
+
private final class A {
+  private(set) var value: Int
+}
+
+
extension Color {
+    public internal(set) static var someColor = Color.anotherColor
+}
+
+

Triggering Examples

+
↓private(set) private var foo: Int
+
+
↓fileprivate(set) fileprivate var foo: Int
+
+
↓internal(set) internal var foo: Int
+
+
↓public(set) public var foo: Int
+
+
open class Foo {
+  ↓open(set) open var bar: Int
+}
+
+
class A {
+  ↓internal(set) var value: Int
+}
+
+
internal class A {
+  ↓internal(set) var value: Int
+}
+
+
fileprivate class A {
+  ↓fileprivate(set) var value: Int
+}
+
+ +
+
+ + +
+
+ + + diff --git a/redundant_string_enum_value.html b/redundant_string_enum_value.html new file mode 100644 index 000000000..3d4181862 --- /dev/null +++ b/redundant_string_enum_value.html @@ -0,0 +1,409 @@ + + + + redundant_string_enum_value Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Redundant String Enum Value

+ +

String enum values can be omitted when they are equal to the enumcase name

+ +
    +
  • Identifier: redundant_string_enum_value
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
enum Numbers: String {
+  case one
+  case two
+}
+
+
enum Numbers: Int {
+  case one = 1
+  case two = 2
+}
+
+
enum Numbers: String {
+  case one = "ONE"
+  case two = "TWO"
+}
+
+
enum Numbers: String {
+  case one = "ONE"
+  case two = "two"
+}
+
+
enum Numbers: String {
+  case one, two
+}
+
+

Triggering Examples

+
enum Numbers: String {
+  case one = ↓"one"
+  case two = ↓"two"
+}
+
+
enum Numbers: String {
+  case one = ↓"one", two = ↓"two"
+}
+
+
enum Numbers: String {
+  case one, two = ↓"two"
+}
+
+ +
+
+ + +
+
+ + + diff --git a/redundant_type_annotation.html b/redundant_type_annotation.html new file mode 100644 index 000000000..a413c655c --- /dev/null +++ b/redundant_type_annotation.html @@ -0,0 +1,601 @@ + + + + redundant_type_annotation Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Redundant Type Annotation

+ +

Variables should not have redundant type annotation

+ +
    +
  • Identifier: redundant_type_annotation
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +ignore_attributes + +[“IBInspectable”] +
    +ignore_properties + +false +
    +consider_default_literal_types_redundant + +false +
  • +
+

Non Triggering Examples

+
var url = URL()
+
+
var url: CustomStringConvertible = URL()
+
+
var one: Int = 1, two: Int = 2, three: Int
+
+
guard let url = URL() else { return }
+
+
if let url = URL() { return }
+
+
let alphanumerics = CharacterSet.alphanumerics
+
+
var set: Set<Int> = Set([])
+
+
var set: Set<Int> = Set.init([])
+
+
var set = Set<Int>([])
+
+
var set = Set<Int>.init([])
+
+
guard var set: Set<Int> = Set([]) else { return }
+
+
if var set: Set<Int> = Set.init([]) { return }
+
+
guard var set = Set<Int>([]) else { return }
+
+
if var set = Set<Int>.init([]) { return }
+
+
var one: A<T> = B()
+
+
var one: A = B<T>()
+
+
var one: A<T> = B<T>()
+
+
let a = A.b.c.d
+
+
let a: B = A.b.c.d
+
+
enum Direction {
+    case up
+    case down
+}
+
+var direction: Direction = .up
+
+
enum Direction {
+    case up
+    case down
+}
+
+var direction = Direction.up
+
+
//
+// ignore_attributes: ["IgnoreMe"]
+//
+
+@IgnoreMe var a: Int = Int(5)
+
+
+
//
+// ignore_attributes: ["IgnoreMe"]
+//
+
+var a: Int {
+    @IgnoreMe let i: Int = Int(1)
+    return i
+}
+
+
+
var bol: Bool = true
+
+
var dbl: Double = 0.0
+
+
var int: Int = 0
+
+
var str: String = "str"
+
+
//
+// ignore_properties: true
+//
+
+struct Foo {
+    var url: URL = URL()
+    let myVar: Int? = 0, s: String = ""
+}
+
+
+

Triggering Examples

+
var url↓:URL=URL()
+
+
var url↓:URL = URL(string: "")
+
+
var url↓: URL = URL()
+
+
let url↓: URL = URL()
+
+
lazy var url↓: URL = URL()
+
+
let url↓: URL = URL()!
+
+
var one: Int = 1, two↓: Int = Int(5), three: Int
+
+
guard let url↓: URL = URL() else { return }
+
+
if let url↓: URL = URL() { return }
+
+
let alphanumerics↓: CharacterSet = CharacterSet.alphanumerics
+
+
var set↓: Set<Int> = Set<Int>([])
+
+
var set↓: Set<Int> = Set<Int>.init([])
+
+
var set↓: Set = Set<Int>([])
+
+
var set↓: Set = Set<Int>.init([])
+
+
guard var set↓: Set = Set<Int>([]) else { return }
+
+
if var set↓: Set = Set<Int>.init([]) { return }
+
+
guard var set↓: Set<Int> = Set<Int>([]) else { return }
+
+
if var set↓: Set<Int> = Set<Int>.init([]) { return }
+
+
var set↓: Set = Set<Int>([]), otherSet: Set<Int>
+
+
var num↓: Int = Int.random(0..<10)
+
+
let a↓: A = A.b.c.d
+
+
let a↓: A = A.f().b
+
+
class ViewController: UIViewController {
+  func someMethod() {
+    let myVar↓: Int = Int(5)
+  }
+}
+
+
//
+// ignore_properties: true
+//
+
+class ViewController: UIViewController {
+  func someMethod() {
+    let myVar↓: Int = Int(5)
+  }
+}
+
+
+
let a↓: [Int] = [Int]()
+
+
let a↓: A.B = A.B()
+
+
enum Direction {
+    case up
+    case down
+}
+
+var direction↓: Direction = Direction.up
+
+
//
+// ignore_attributes: ["IgnoreMe"]
+//
+
+@DontIgnoreMe var a↓: Int = Int(5)
+
+
+
//
+// ignore_attributes: ["IgnoreMe"]
+//
+
+@IgnoreMe
+var a: Int {
+    let i↓: Int = Int(1)
+    return i
+}
+
+
+
//
+// consider_default_literal_types_redundant: true
+//
+
+var bol↓: Bool = true
+
+
+
//
+// consider_default_literal_types_redundant: true
+//
+
+var dbl↓: Double = 0.0
+
+
+
//
+// consider_default_literal_types_redundant: true
+//
+
+var int↓: Int = 0
+
+
+
//
+// consider_default_literal_types_redundant: true
+//
+
+var str↓: String = "str"
+
+
+ +
+
+ + +
+
+ + + diff --git a/redundant_void_return.html b/redundant_void_return.html new file mode 100644 index 000000000..028a7efa4 --- /dev/null +++ b/redundant_void_return.html @@ -0,0 +1,439 @@ + + + + redundant_void_return Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Redundant Void Return

+ +

Returning Void in a function declaration is redundant

+ +
    +
  • Identifier: redundant_void_return
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +include_closures + +true +
  • +
+

Non Triggering Examples

+
func foo() {}
+
+
func foo() -> Int {}
+
+
func foo() -> Int -> Void {}
+
+
func foo() -> VoidResponse
+
+
let foo: (Int) -> Void
+
+
func foo() -> Int -> () {}
+
+
let foo: (Int) -> ()
+
+
func foo() -> ()?
+
+
func foo() -> ()!
+
+
func foo() -> Void?
+
+
func foo() -> Void!
+
+
struct A {
+    subscript(key: String) {
+        print(key)
+    }
+}
+
+
//
+// include_closures: false
+//
+
+doSomething { arg -> Void in
+    print(arg)
+}
+
+
+

Triggering Examples

+
func foo()↓ -> Void {}
+
+
protocol Foo {
+  func foo()↓ -> Void
+}
+
+
func foo()↓ -> () {}
+
+
func foo()↓ -> ( ) {}
+
+
protocol Foo {
+  func foo()↓ -> ()
+}
+
+
doSomething { arg↓ -> () in
+    print(arg)
+}
+
+
doSomething { arg↓ -> Void in
+    print(arg)
+}
+
+ +
+
+ + +
+
+ + + diff --git a/required_deinit.html b/required_deinit.html new file mode 100644 index 000000000..7593798a9 --- /dev/null +++ b/required_deinit.html @@ -0,0 +1,417 @@ + + + + required_deinit Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Required Deinit

+ +

Classes should have an explicit deinit method

+ +
    +
  • Identifier: required_deinit
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class Apple {
+    deinit { }
+}
+
+
enum Banana { }
+
+
protocol Cherry { }
+
+
struct Damson { }
+
+
class Outer {
+    deinit { print("Deinit Outer") }
+    class Inner {
+        deinit { print("Deinit Inner") }
+    }
+}
+
+

Triggering Examples

+
↓class Apple { }
+
+
↓class Banana: NSObject, Equatable { }
+
+
↓class Cherry {
+    // deinit { }
+}
+
+
↓class Damson {
+    func deinitialize() { }
+}
+
+
class Outer {
+    func hello() -> String { return "outer" }
+    deinit { }
+    ↓class Inner {
+        func hello() -> String { return "inner" }
+    }
+}
+
+
↓class Outer {
+    func hello() -> String { return "outer" }
+    class Inner {
+        func hello() -> String { return "inner" }
+        deinit { }
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/required_enum_case.html b/required_enum_case.html new file mode 100644 index 000000000..e52887492 --- /dev/null +++ b/required_enum_case.html @@ -0,0 +1,496 @@ + + + + required_enum_case Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Required Enum Case

+ +

Enums conforming to a specified protocol must implement a specific case(s).

+ +
    +
  • Identifier: required_enum_case
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +{Protocol Name} + + + + + + + + + + + + + + + +
    KeyValue
    +{Case Name 1} + +{warning|error} +
    +{Case Name 2} + +{warning|error} +
    +
  • +
+

Non Triggering Examples

+
//
+// NetworkResponsable:
+//   error: warning
+//   notConnected: warning
+//   success: warning
+//
+
+enum MyNetworkResponse: String, NetworkResponsable {
+    case success, error, notConnected
+}
+
+
+
//
+// NetworkResponsable:
+//   error: warning
+//   notConnected: warning
+//   success: warning
+//
+
+enum MyNetworkResponse: String, NetworkResponsable {
+    case success, error, notConnected(error: Error)
+}
+
+
+
//
+// NetworkResponsable:
+//   error: warning
+//   notConnected: warning
+//   success: warning
+//
+
+enum MyNetworkResponse: String, NetworkResponsable {
+    case success
+    case error
+    case notConnected
+}
+
+
+
//
+// NetworkResponsable:
+//   error: warning
+//   notConnected: warning
+//   success: warning
+//
+
+enum MyNetworkResponse: String, NetworkResponsable {
+    case success
+    case error
+    case notConnected(error: Error)
+}
+
+
+

Triggering Examples

+
//
+// NetworkResponsable:
+//   error: warning
+//   notConnected: warning
+//   success: warning
+//
+
+↓enum MyNetworkResponse: String, NetworkResponsable {
+    case success, error
+}
+
+
+
//
+// NetworkResponsable:
+//   error: warning
+//   notConnected: warning
+//   success: warning
+//
+
+↓enum MyNetworkResponse: String, NetworkResponsable {
+    case success, error
+}
+
+
+
//
+// NetworkResponsable:
+//   error: warning
+//   notConnected: warning
+//   success: warning
+//
+
+↓enum MyNetworkResponse: String, NetworkResponsable {
+    case success
+    case error
+}
+
+
+
//
+// NetworkResponsable:
+//   error: warning
+//   notConnected: warning
+//   success: warning
+//
+
+↓enum MyNetworkResponse: String, NetworkResponsable {
+    case success
+    case error
+}
+
+
+ +
+
+ + +
+
+ + + diff --git a/return_arrow_whitespace.html b/return_arrow_whitespace.html new file mode 100644 index 000000000..2e9ebd10e --- /dev/null +++ b/return_arrow_whitespace.html @@ -0,0 +1,425 @@ + + + + return_arrow_whitespace Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Returning Whitespace

+ +

Return arrow and return type should be separated by a single space or on a separate line

+ +
    +
  • Identifier: return_arrow_whitespace
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func abc() -> Int {}
+
+
func abc() -> [Int] {}
+
+
func abc() -> (Int, Int) {}
+
+
var abc = {(param: Int) -> Void in }
+
+
func abc() ->
+    Int {}
+
+
func abc()
+    -> Int {}
+
+
func reallyLongFunctionMethods<T>(withParam1: Int, param2: String, param3: Bool) where T: AGenericConstraint
+    -> Int {
+    return 1
+}
+
+
typealias SuccessBlock = ((Data) -> Void)
+
+

Triggering Examples

+
func abc()↓->Int {}
+
+
func abc()↓->[Int] {}
+
+
func abc()↓->(Int, Int) {}
+
+
func abc()↓-> Int {}
+
+
func abc()↓->   Int {}
+
+
func abc()↓ ->Int {}
+
+
func abc()↓  ->  Int {}
+
+
var abc = {(param: Int)↓ ->Bool in }
+
+
var abc = {(param: Int)↓->Bool in }
+
+
typealias SuccessBlock = ((Data)↓->Void)
+
+
func abc()
+  ↓->  Int {}
+
+
func abc()
+ ↓->  Int {}
+
+
func abc()↓  ->
+  Int {}
+
+
func abc()↓  ->
+Int {}
+
+ +
+
+ + +
+
+ + + diff --git a/return_value_from_void_function.html b/return_value_from_void_function.html new file mode 100644 index 000000000..1c48316b5 --- /dev/null +++ b/return_value_from_void_function.html @@ -0,0 +1,586 @@ + + + + return_value_from_void_function Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Return Value from Void Function

+ +

Returning values from Void functions should be avoided

+ +
    +
  • Identifier: return_value_from_void_function
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.1.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func foo() {
+    return
+}
+
+
func foo() {
+    return /* a comment */
+}
+
+
func foo() -> Int {
+    return 1
+}
+
+
func foo() -> Void {
+    if condition {
+        return
+    }
+    bar()
+}
+
+
func foo() {
+    return;
+    bar()
+}
+
+
func test() {}
+
+
init?() {
+    guard condition else {
+        return nil
+    }
+}
+
+
init?(arg: String?) {
+    guard arg != nil else {
+        return nil
+    }
+}
+
+
func test() {
+    guard condition else {
+        return
+    }
+}
+
+
func test() -> Result<String, Error> {
+    func other() {}
+    func otherVoid() -> Void {}
+}
+
+
func test() -> Int? {
+    return nil
+}
+
+
func test() {
+    if bar {
+        print("")
+        return
+    }
+    let foo = [1, 2, 3].filter { return true }
+    return
+}
+
+
func test() {
+    guard foo else {
+        bar()
+        return
+    }
+}
+
+
func spec() {
+    var foo: Int {
+        return 0
+    }
+
+
func f() -> () { g() }
+
+
func f() { g() }
+
+
func f() { { return g() }() }
+
+
func f() {
+    func g() -> Int {
+        return 1
+    }
+}
+
+
init?() { return nil }
+
+
func f() {
+    var i: Int { return 1 }
+}
+
+

Triggering Examples

+
func foo() {
+    ↓return bar()
+}
+
+
func foo() -> () {
+    ↓return self.bar()
+}
+
+
func foo() -> Void {
+    ↓return bar()
+}
+
+
func foo() -> Void {
+    ↓return /* comment */ bar()
+}
+
+
func foo() {
+    ↓return
+    self.bar()
+}
+
+
func foo() {
+    variable += 1
+    ↓return
+    variable += 1
+}
+
+
func initThing() {
+    guard foo else {
+        ↓return print("")
+    }
+}
+
+
// Leading comment
+func test() {
+    guard condition else {
+        ↓return assertionfailure("")
+    }
+}
+
+
func test() -> Result<String, Error> {
+    func other() {
+        guard false else {
+            ↓return assertionfailure("")
+        }
+    }
+    func otherVoid() -> Void {}
+}
+
+
func test() {
+    guard conditionIsTrue else {
+        sideEffects()
+        return // comment
+    }
+    guard otherCondition else {
+        ↓return assertionfailure("")
+    }
+    differentSideEffect()
+}
+
+
func test() {
+    guard otherCondition else {
+        ↓return assertionfailure(""); // comment
+    }
+    differentSideEffect()
+}
+
+
func test() {
+  if x {
+    ↓return foo()
+  }
+  bar()
+}
+
+
func test() {
+  switch x {
+    case .a:
+      ↓return foo() // return to skip baz()
+    case .b:
+      bar()
+  }
+  baz()
+}
+
+
func test() {
+  if check {
+    if otherCheck {
+      ↓return foo()
+    }
+  }
+  bar()
+}
+
+
func test() {
+    ↓return foo()
+}
+
+
func test() {
+  ↓return foo({
+    return bar()
+  })
+}
+
+
func test() {
+  guard x else {
+    ↓return foo()
+  }
+  bar()
+}
+
+
func test() {
+  let closure: () -> () = {
+    return assert()
+  }
+  if check {
+    if otherCheck {
+      return // comments are fine
+    }
+  }
+  ↓return foo()
+}
+
+ +
+
+ + +
+
+ + + diff --git a/rule-directory.html b/rule-directory.html new file mode 100644 index 000000000..2d69999db --- /dev/null +++ b/rule-directory.html @@ -0,0 +1,599 @@ + + + + Rule Directory Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Rule Directory

+

Default Rules

+ + +

Opt-in Rules

+ + +

Analyzer Rules

+ + + +
+
+ + +
+
+ + + diff --git a/search.json b/search.json new file mode 100644 index 000000000..e9ff46d7a --- /dev/null +++ b/search.json @@ -0,0 +1 @@ +{"Macros.html#/s:13SwiftLintCore16AutoConfigParseryycfm":{"name":"AutoConfigParser()","abstract":"

Macro to be attached to rule configurations. It generates the configuration parsing logic"},"Macros.html#/s:13SwiftLintCore32AcceptableByConfigurationElementyycfm":{"name":"AcceptableByConfigurationElement()","abstract":"

Macro that lets an enum with a String raw type automatically conform to AcceptableByConfigurationElement.

"},"Macros.html#/s:13SwiftLintCore0A10SyntaxRule15foldExpressions16explicitRewriter11correctable5optInySb_S3btcfm":{"name":"SwiftSyntaxRule(foldExpressions:explicitRewriter:correctable:optIn:)","abstract":"

Macro that adds a conformance to the SwiftSyntaxRule protocol and a default makeVisitor(file:) implementation"},"Structs/SeverityLevelsConfiguration.html#/s:13SwiftLintCore27SeverityLevelsConfigurationV7warningSivp":{"name":"warning","abstract":"

The threshold for a violation to be a warning.

","parent_name":"SeverityLevelsConfiguration"},"Structs/SeverityLevelsConfiguration.html#/s:13SwiftLintCore27SeverityLevelsConfigurationV5errorSiSgvp":{"name":"error","abstract":"

The threshold for a violation to be an error.

","parent_name":"SeverityLevelsConfiguration"},"Structs/SeverityLevelsConfiguration.html#/s:13SwiftLintCore27SeverityLevelsConfigurationV7warning5errorACyxGSi_SiSgtcfc":{"name":"init(warning:error:)","abstract":"

Create a SeverityLevelsConfiguration based on the specified warning and error thresholds.

","parent_name":"SeverityLevelsConfiguration"},"Structs/SeverityLevelsConfiguration.html#/s:13SwiftLintCore27SeverityLevelsConfigurationV6paramsSayAA13RuleParameterVySiGGvp":{"name":"params","abstract":"

The rule parameters that define the thresholds that should map to each severity.

","parent_name":"SeverityLevelsConfiguration"},"Structs/SeverityLevelsConfiguration.html#/s:13SwiftLintCore17RuleConfigurationP5apply13configurationyyp_tKF":{"name":"apply(configuration:)","parent_name":"SeverityLevelsConfiguration"},"Structs/RegexConfiguration.html#/s:13SwiftLintCore18RegexConfigurationV10identifierSSvp":{"name":"identifier","abstract":"

The identifier for this custom rule.

","parent_name":"RegexConfiguration"},"Structs/RegexConfiguration.html#/s:13SwiftLintCore18RegexConfigurationV4nameSSSgvp":{"name":"name","abstract":"

The name for this custom rule.

","parent_name":"RegexConfiguration"},"Structs/RegexConfiguration.html#/s:13SwiftLintCore18RegexConfigurationV7messageSSvp":{"name":"message","abstract":"

The message to be presented when producing violations.

","parent_name":"RegexConfiguration"},"Structs/RegexConfiguration.html#/s:13SwiftLintCore18RegexConfigurationV8includedSayAA17RegularExpressionVGvp":{"name":"included","abstract":"

Regular expressions to include when matching the file path.

","parent_name":"RegexConfiguration"},"Structs/RegexConfiguration.html#/s:13SwiftLintCore18RegexConfigurationV8excludedSayAA17RegularExpressionVGvp":{"name":"excluded","abstract":"

Regular expressions to exclude when matching the file path.

","parent_name":"RegexConfiguration"},"Structs/RegexConfiguration.html#/s:13SwiftLintCore18RegexConfigurationV18excludedMatchKindsShy21SourceKittenFramework10SyntaxKindOGvp":{"name":"excludedMatchKinds","abstract":"

The syntax kinds to exclude from matches. If the regex matched syntax kinds from this list, it would","parent_name":"RegexConfiguration"},"Structs/RegexConfiguration.html#/s:13SwiftLintCore30SeverityBasedRuleConfigurationP08severityG0AA0dG0Vy6ParentQzGvp":{"name":"severityConfiguration","parent_name":"RegexConfiguration"},"Structs/RegexConfiguration.html#/s:13SwiftLintCore18RegexConfigurationV12captureGroupSivp":{"name":"captureGroup","abstract":"

The index of the regex capture group to match.

","parent_name":"RegexConfiguration"},"Structs/RegexConfiguration.html#/s:13SwiftLintCore24CacheDescriptionProviderP05cacheE0SSvp":{"name":"cacheDescription","parent_name":"RegexConfiguration"},"Structs/RegexConfiguration.html#/s:13SwiftLintCore18RegexConfigurationV11descriptionAA15RuleDescriptionVvp":{"name":"description","abstract":"

The RuleDescription for the custom rule defined here.

","parent_name":"RegexConfiguration"},"Structs/RegexConfiguration.html#/s:13SwiftLintCore18RegexConfigurationV10identifierACyxGSS_tcfc":{"name":"init(identifier:)","abstract":"

Create a RegexConfiguration with the specified identifier, with other properties to be set later.

","parent_name":"RegexConfiguration"},"Structs/RegexConfiguration.html#/s:13SwiftLintCore17RuleConfigurationP5apply13configurationyyp_tKF":{"name":"apply(configuration:)","parent_name":"RegexConfiguration"},"Structs/RegexConfiguration.html#/s:SH4hash4intoys6HasherVz_tF":{"name":"hash(into:)","parent_name":"RegexConfiguration"},"Structs/ReasonedRuleViolation/ViolationCorrection.html#/s:13SwiftLintCore21ReasonedRuleViolationV0F10CorrectionV5start3end11replacementAE0A6Syntax16AbsolutePositionV_AKSStcfc":{"name":"init(start:end:replacement:)","abstract":"

Create a ViolationCorrection.

","parent_name":"ViolationCorrection"},"Structs/ReasonedRuleViolation/ViolationCorrection.html":{"name":"ViolationCorrection","abstract":"

The correction of a violation that is basically the violation’s range in the source code and a","parent_name":"ReasonedRuleViolation"},"Structs/ReasonedRuleViolation.html#/s:13SwiftLintCore21ReasonedRuleViolationV8position0A6Syntax16AbsolutePositionVvp":{"name":"position","abstract":"

The violation’s position.

","parent_name":"ReasonedRuleViolation"},"Structs/ReasonedRuleViolation.html#/s:13SwiftLintCore21ReasonedRuleViolationV6reasonSSSgvp":{"name":"reason","abstract":"

A specific reason for the violation.

","parent_name":"ReasonedRuleViolation"},"Structs/ReasonedRuleViolation.html#/s:13SwiftLintCore21ReasonedRuleViolationV8severityAA0F8SeverityOSgvp":{"name":"severity","abstract":"

The violation’s severity.

","parent_name":"ReasonedRuleViolation"},"Structs/ReasonedRuleViolation.html#/s:13SwiftLintCore21ReasonedRuleViolationV10correctionAC0F10CorrectionVSgvp":{"name":"correction","abstract":"

An optional correction of the violation to be used in rewriting (see SwiftSyntaxCorrectableRule). Can be","parent_name":"ReasonedRuleViolation"},"Structs/ReasonedRuleViolation.html#/s:13SwiftLintCore21ReasonedRuleViolationV8position6reason8severity10correctionAC0A6Syntax16AbsolutePositionV_SSSgAA0F8SeverityOSgAC0F10CorrectionVSgtcfc":{"name":"init(position:reason:severity:correction:)","abstract":"

Creates a ReasonedRuleViolation.

","parent_name":"ReasonedRuleViolation"},"Structs/ReasonedRuleViolation.html#/s:SL1loiySbx_xtFZ":{"name":"<(_:_:)","parent_name":"ReasonedRuleViolation"},"Structs/SwiftVersion.html#/s:SY8RawValueQa":{"name":"RawValue","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:SY8rawValue03RawB0Qzvp":{"name":"rawValue","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:SY8rawValuexSg03RawB0Qz_tcfc":{"name":"init(rawValue:)","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:13SwiftLintCore0A7VersionV4fiveACvpZ":{"name":"five","abstract":"

Swift 5

","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:13SwiftLintCore0A7VersionV10fiveDotOneACvpZ":{"name":"fiveDotOne","abstract":"

Swift 5.1

","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:13SwiftLintCore0A7VersionV10fiveDotTwoACvpZ":{"name":"fiveDotTwo","abstract":"

Swift 5.2

","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:13SwiftLintCore0A7VersionV12fiveDotThreeACvpZ":{"name":"fiveDotThree","abstract":"

Swift 5.3

","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:13SwiftLintCore0A7VersionV11fiveDotFourACvpZ":{"name":"fiveDotFour","abstract":"

Swift 5.4

","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:13SwiftLintCore0A7VersionV11fiveDotFiveACvpZ":{"name":"fiveDotFive","abstract":"

Swift 5.5

","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:13SwiftLintCore0A7VersionV10fiveDotSixACvpZ":{"name":"fiveDotSix","abstract":"

Swift 5.6

","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:13SwiftLintCore0A7VersionV12fiveDotSevenACvpZ":{"name":"fiveDotSeven","abstract":"

Swift 5.7

","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:13SwiftLintCore0A7VersionV12fiveDotEightACvpZ":{"name":"fiveDotEight","abstract":"

Swift 5.8

","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:13SwiftLintCore0A7VersionV11fiveDotNineACvpZ":{"name":"fiveDotNine","abstract":"

Swift 5.9

","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:13SwiftLintCore0A7VersionV3sixACvpZ":{"name":"six","abstract":"

Swift 6

","parent_name":"SwiftVersion"},"Structs/SwiftVersion.html#/s:13SwiftLintCore0A7VersionV7currentACvpZ":{"name":"current","abstract":"

The current detected Swift compiler version, based on the currently accessible SourceKit version.

","parent_name":"SwiftVersion"},"Structs/SwiftLintSyntaxToken.html#/s:13SwiftLintCore0aB11SyntaxTokenV5value21SourceKittenFramework0dE0Vvp":{"name":"value","abstract":"

The raw SyntaxToken obtained by SourceKitten.

","parent_name":"SwiftLintSyntaxToken"},"Structs/SwiftLintSyntaxToken.html#/s:13SwiftLintCore0aB11SyntaxTokenV4kind21SourceKittenFramework0D4KindOSgvp":{"name":"kind","abstract":"

The syntax kind associated with is token.

","parent_name":"SwiftLintSyntaxToken"},"Structs/SwiftLintSyntaxToken.html#/s:13SwiftLintCore0aB11SyntaxTokenV5valueAC21SourceKittenFramework0dE0V_tcfc":{"name":"init(value:)","abstract":"

Creates a SwiftLintSyntaxToken from the raw SyntaxToken obtained by SourceKitten.

","parent_name":"SwiftLintSyntaxToken"},"Structs/SwiftLintSyntaxToken.html#/s:13SwiftLintCore0aB11SyntaxTokenV5range21SourceKittenFramework9ByteRangeVvp":{"name":"range","abstract":"

The byte range in a source file for this token.

","parent_name":"SwiftLintSyntaxToken"},"Structs/SwiftLintSyntaxToken.html#/s:13SwiftLintCore0aB11SyntaxTokenV6offset21SourceKittenFramework9ByteCountVvp":{"name":"offset","abstract":"

The starting byte offset in a source file for this token.

","parent_name":"SwiftLintSyntaxToken"},"Structs/SwiftLintSyntaxToken.html#/s:13SwiftLintCore0aB11SyntaxTokenV6length21SourceKittenFramework9ByteCountVvp":{"name":"length","abstract":"

The length in bytes for this token.

","parent_name":"SwiftLintSyntaxToken"},"Structs/SwiftLintSyntaxMap.html#/s:13SwiftLintCore0aB9SyntaxMapV5value21SourceKittenFramework0dE0Vvp":{"name":"value","abstract":"

The raw SyntaxMap obtained by SourceKitten.

","parent_name":"SwiftLintSyntaxMap"},"Structs/SwiftLintSyntaxMap.html#/s:13SwiftLintCore0aB9SyntaxMapV6tokensSayAA0abD5TokenVGvp":{"name":"tokens","abstract":"

The SwiftLint-specific syntax tokens for this syntax map.

","parent_name":"SwiftLintSyntaxMap"},"Structs/SwiftLintSyntaxMap.html#/s:13SwiftLintCore0aB9SyntaxMapV5valueAC21SourceKittenFramework0dE0V_tcfc":{"name":"init(value:)","abstract":"

Creates a SwiftLintSyntaxMap from the raw SyntaxMap obtained by SourceKitten.

","parent_name":"SwiftLintSyntaxMap"},"Structs/SwiftLintSyntaxMap.html#/s:13SwiftLintCore0aB9SyntaxMapV6tokens11inByteRangeSayAA0abD5TokenVG21SourceKittenFramework0hI0V_tF":{"name":"tokens(inByteRange:)","abstract":"

Returns array of syntax tokens intersecting with byte range.

","parent_name":"SwiftLintSyntaxMap"},"Structs/SwiftLintSyntaxMap.html#/s:13SwiftLintCore0aB9SyntaxMapV5kinds11inByteRangeSay21SourceKittenFramework0D4KindOGAF0hI0V_tF":{"name":"kinds(inByteRange:)","abstract":"

Returns the syntax kinds in the specified byte range.

","parent_name":"SwiftLintSyntaxMap"},"Structs/StyleViolation.html#/s:13SwiftLintCore14StyleViolationV14ruleIdentifierSSvp":{"name":"ruleIdentifier","abstract":"

The identifier of the rule that generated this violation.

","parent_name":"StyleViolation"},"Structs/StyleViolation.html#/s:13SwiftLintCore14StyleViolationV15ruleDescriptionSSvp":{"name":"ruleDescription","abstract":"

The description of the rule that generated this violation.

","parent_name":"StyleViolation"},"Structs/StyleViolation.html#/s:13SwiftLintCore14StyleViolationV8ruleNameSSvp":{"name":"ruleName","abstract":"

The name of the rule that generated this violation.

","parent_name":"StyleViolation"},"Structs/StyleViolation.html#/s:13SwiftLintCore14StyleViolationV8severityAA0E8SeverityOvp":{"name":"severity","abstract":"

The severity of this violation.

","parent_name":"StyleViolation"},"Structs/StyleViolation.html#/s:13SwiftLintCore14StyleViolationV8locationAA8LocationVvp":{"name":"location","abstract":"

The location of this violation.

","parent_name":"StyleViolation"},"Structs/StyleViolation.html#/s:13SwiftLintCore14StyleViolationV6reasonSSvp":{"name":"reason","abstract":"

The justification for this violation.

","parent_name":"StyleViolation"},"Structs/StyleViolation.html#/s:13SwiftLintCore14StyleViolationV11descriptionSSvp":{"name":"description","abstract":"

A printable description for this violation.

","parent_name":"StyleViolation"},"Structs/StyleViolation.html#/s:13SwiftLintCore14StyleViolationV15ruleDescription8severity8location6reasonAcA04RuleG0V_AA0E8SeverityOAA8LocationVSSSgtcfc":{"name":"init(ruleDescription:severity:location:reason:)","abstract":"

Creates a StyleViolation by specifying its properties directly.

","parent_name":"StyleViolation"},"Structs/StyleViolation.html#/s:13SwiftLintCore14StyleViolationV4with8severityAcA0E8SeverityO_tF":{"name":"with(severity:)","abstract":"

Returns the same violation, but with the severity that is passed in

","parent_name":"StyleViolation"},"Structs/StyleViolation.html#/s:13SwiftLintCore14StyleViolationV4with8locationAcA8LocationV_tF":{"name":"with(location:)","abstract":"

Returns the same violation, but with the location that is passed in

","parent_name":"StyleViolation"},"Structs/StyleViolation.html#/s:SH4hash4intoys6HasherVz_tF":{"name":"hash(into:)","parent_name":"StyleViolation"},"Structs/RuleParameter.html#/s:13SwiftLintCore13RuleParameterV8severityAA17ViolationSeverityOvp":{"name":"severity","abstract":"

The severity that should be assigned to the violation of this parameter’s value is met.

","parent_name":"RuleParameter"},"Structs/RuleParameter.html#/s:13SwiftLintCore13RuleParameterV5valuexvp":{"name":"value","abstract":"

The value to configure the rule.

","parent_name":"RuleParameter"},"Structs/RuleParameter.html#/s:13SwiftLintCore13RuleParameterV8severity5valueACyxGAA17ViolationSeverityO_xtcfc":{"name":"init(severity:value:)","abstract":"

Creates a RuleParameter by specifying its properties directly.

","parent_name":"RuleParameter"},"Structs/RuleList.html#/s:13SwiftLintCore8RuleListV4listSDySSAA0D0_pXpGvp":{"name":"list","abstract":"

The rules contained in this list.

","parent_name":"RuleList"},"Structs/RuleList.html#/s:13SwiftLintCore8RuleListV5rulesAcA0D0_pXpd_tcfc":{"name":"init(rules:)","abstract":"

Creates a RuleList by specifying all its rules.

","parent_name":"RuleList"},"Structs/RuleList.html#/s:13SwiftLintCore8RuleListV5rulesACSayAA0D0_pXpG_tcfc":{"name":"init(rules:)","abstract":"

Creates a RuleList by specifying all its rules.

","parent_name":"RuleList"},"Structs/RuleList.html#/s:SQ2eeoiySbx_xtFZ":{"name":"==(_:_:)","parent_name":"RuleList"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV10identifierSSvp":{"name":"identifier","abstract":"

The rule’s unique identifier, to be used in configuration files and SwiftLint commands.","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV4nameSSvp":{"name":"name","abstract":"

The rule’s human-readable name. Should be short, descriptive and formatted in Title Case. May contain spaces.

","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV11descriptionSSvp":{"name":"description","abstract":"

The rule’s verbose description. Should read as a sentence or short paragraph. Good things to include are an","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV4kindAA0D4KindOvp":{"name":"kind","abstract":"

The RuleKind that best categorizes this rule.

","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV21nonTriggeringExamplesSayAA7ExampleVGvp":{"name":"nonTriggeringExamples","abstract":"

Swift source examples that do not trigger a violation for this rule. Used for documentation purposes to inform","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV18triggeringExamplesSayAA7ExampleVGvp":{"name":"triggeringExamples","abstract":"

Swift source examples that do trigger one or more violations for this rule. Used for documentation purposes to","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV11correctionsSDyAA7ExampleVAFGvp":{"name":"corrections","abstract":"

Pairs of Swift source examples, where keys are examples that trigger violations for this rule, and the values","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV17deprecatedAliasesShySSGvp":{"name":"deprecatedAliases","abstract":"

Any previous iteration of the rule’s identifier that was previously shipped with SwiftLint.

","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV03minA7VersionAA0aG0Vvp":{"name":"minSwiftVersion","abstract":"

The oldest version of the Swift compiler supported by this rule.

","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV18requiresFileOnDiskSbvp":{"name":"requiresFileOnDisk","abstract":"

Whether or not this rule can only be executed on a file physically on-disk. Typically necessary for rules","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV07consoleE0SSvp":{"name":"consoleDescription","abstract":"

The console-printable string for this description.

","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV14allIdentifiersSaySSGvp":{"name":"allIdentifiers","abstract":"

All identifiers that have been used to uniquely identify this rule in past and current SwiftLint versions.

","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:13SwiftLintCore15RuleDescriptionV10identifier4name11description4kind03minA7Version21nonTriggeringExamples010triggeringN011corrections17deprecatedAliases18requiresFileOnDiskACSS_S2SAA0D4KindOAA0aK0VSayAA7ExampleVGATSDyA2SGShySSGSbtcfc":{"name":"init(identifier:name:description:kind:minSwiftVersion:nonTriggeringExamples:triggeringExamples:corrections:deprecatedAliases:requiresFileOnDisk:)","abstract":"

Creates a RuleDescription by specifying all its properties directly.

","parent_name":"RuleDescription"},"Structs/RuleDescription.html#/s:SQ2eeoiySbx_xtFZ":{"name":"==(_:_:)","parent_name":"RuleDescription"},"Structs/SeverityConfiguration.html#/s:13SwiftLintCore21SeverityConfigurationV5errorACyxGvpZ":{"name":"error","abstract":"

Configuration with a warning severity.

","parent_name":"SeverityConfiguration"},"Structs/SeverityConfiguration.html#/s:13SwiftLintCore21SeverityConfigurationV7warningACyxGvpZ":{"name":"warning","abstract":"

Configuration with an error severity.

","parent_name":"SeverityConfiguration"},"Structs/SeverityConfiguration.html#/s:13SwiftLintCore30SeverityBasedRuleConfigurationP08severityG0AA0dG0Vy6ParentQzGvp":{"name":"severityConfiguration","parent_name":"SeverityConfiguration"},"Structs/SeverityConfiguration.html#/s:13SwiftLintCore21SeverityConfigurationVyACyxGAA09ViolationD0Ocfc":{"name":"init(_:)","abstract":"

Create a SeverityConfiguration with the specified severity.

","parent_name":"SeverityConfiguration"},"Structs/SeverityConfiguration.html#/s:13SwiftLintCore17RuleConfigurationP5apply13configurationyyp_tKF":{"name":"apply(configuration:)","parent_name":"SeverityConfiguration"},"Structs/SeverityConfiguration.html#/s:13SwiftLintCore21SeverityConfigurationV13asDescription4withAA04RuleeG0VSS_tF":{"name":"asDescription(with:)","abstract":"

Severity configurations are special in that they shall not be nested when an option name is provided.","parent_name":"SeverityConfiguration"},"Structs/ConfigurationElement/DeprecationNotice.html#/s:13SwiftLintCore20ConfigurationElementV17DeprecationNoticeO18suggestAlternativeyAEyx_GSS_SStcAGmSQRzs8SendableRzAA012AcceptableBydE0RzlF":{"name":"suggestAlternative(ruleID:name:)","abstract":"

Warning suggesting an alternative option.

","parent_name":"DeprecationNotice"},"Structs/ConfigurationElement/DeprecationNotice.html":{"name":"DeprecationNotice","abstract":"

A deprecation notice.

","parent_name":"ConfigurationElement"},"Structs/ConfigurationElement.html#/s:13SwiftLintCore20ConfigurationElementV12wrappedValuexvp":{"name":"wrappedValue","abstract":"

Wrapped option value.

","parent_name":"ConfigurationElement"},"Structs/ConfigurationElement.html#/s:13SwiftLintCore20ConfigurationElementV14projectedValueACyxGvp":{"name":"projectedValue","abstract":"

The wrapper itself providing access to all its data. This field can only be accessed by the","parent_name":"ConfigurationElement"},"Structs/ConfigurationElement.html#/s:13SwiftLintCore20ConfigurationElementV3keySSvp":{"name":"key","abstract":"

Name of this configuration entry.

","parent_name":"ConfigurationElement"},"Structs/ConfigurationElement.html#/s:13SwiftLintCore20ConfigurationElementV6inlineSbvp":{"name":"inline","abstract":"

Whether this configuration element will be inlined into its description.

","parent_name":"ConfigurationElement"},"Structs/ConfigurationElement.html#/s:13SwiftLintCore20ConfigurationElementV12wrappedValue3key17deprecationNotice13postprocessorACyxGx_SSAC011DeprecationJ0Oyx_GSgyxzYbctcfc":{"name":"init(wrappedValue:key:deprecationNotice:postprocessor:)","abstract":"

Default constructor.

","parent_name":"ConfigurationElement"},"Structs/ConfigurationElement.html#/s:13SwiftLintCore20ConfigurationElementV3keyACyqd__SgGSS_tcAERszSQRd__s8SendableRd__AA012AcceptableBydE0Rd__lufc":{"name":"init(key:)","abstract":"

Constructor for optional values.

","parent_name":"ConfigurationElement"},"Structs/ConfigurationElement.html#/s:13SwiftLintCore20ConfigurationElementV12wrappedValue6inlineACyxGx_SbtcAA19InlinableOptionTypeRzrlufc":{"name":"init(wrappedValue:inline:)","abstract":"

Constructor for an InlinableOptionType without a key.

","parent_name":"ConfigurationElement"},"Structs/ConfigurationElement.html#/s:13SwiftLintCore20ConfigurationElementV12wrappedValue3keyACyxGx_SStcAA19InlinableOptionTypeRzrlufc":{"name":"init(wrappedValue:key:)","abstract":"

Constructor for an InlinableOptionType with a name. The configuration will explicitly not be inlined.

","parent_name":"ConfigurationElement"},"Structs/ConfigurationElement.html#/s:SQ2eeoiySbx_xtFZ":{"name":"==(_:_:)","parent_name":"ConfigurationElement"},"Structs/RuleConfigurationOption.html#/s:13SwiftLintCore23RuleConfigurationOptionV9noOptionsACvpZ":{"name":"noOptions","abstract":"

An option serving as a marker for an empty configuration description.

","parent_name":"RuleConfigurationOption"},"Structs/RuleConfigurationOption.html#/s:13SwiftLintCore12DocumentableP10hasContentSbvp":{"name":"hasContent","parent_name":"RuleConfigurationOption"},"Structs/RuleConfigurationOption.html#/s:13SwiftLintCore12DocumentableP8markdownSSyF":{"name":"markdown()","parent_name":"RuleConfigurationOption"},"Structs/RuleConfigurationOption.html#/s:13SwiftLintCore12DocumentableP8oneLinerSSyF":{"name":"oneLiner()","parent_name":"RuleConfigurationOption"},"Structs/RuleConfigurationOption.html#/s:13SwiftLintCore12DocumentableP4yamlSSyF":{"name":"yaml()","parent_name":"RuleConfigurationOption"},"Structs/RuleConfigurationDescription.html#/s:13SwiftLintCore12DocumentableP10hasContentSbvp":{"name":"hasContent","parent_name":"RuleConfigurationDescription"},"Structs/RuleConfigurationDescription.html#/s:13SwiftLintCore12DocumentableP8oneLinerSSyF":{"name":"oneLiner()","parent_name":"RuleConfigurationDescription"},"Structs/RuleConfigurationDescription.html#/s:13SwiftLintCore12DocumentableP8markdownSSyF":{"name":"markdown()","parent_name":"RuleConfigurationDescription"},"Structs/RuleConfigurationDescription.html#/s:13SwiftLintCore12DocumentableP4yamlSSyF":{"name":"yaml()","parent_name":"RuleConfigurationDescription"},"Structs/Region.html#/s:13SwiftLintCore6RegionV5startAA8LocationVvp":{"name":"start","abstract":"

The location describing the start of the region. All locations that are less than this value","parent_name":"Region"},"Structs/Region.html#/s:13SwiftLintCore6RegionV3endAA8LocationVvp":{"name":"end","abstract":"

The location describing the end of the region. All locations that are greater than this value","parent_name":"Region"},"Structs/Region.html#/s:13SwiftLintCore6RegionV23disabledRuleIdentifiersShyAA0F10IdentifierOGvp":{"name":"disabledRuleIdentifiers","abstract":"

All SwiftLint rule identifiers that are disabled in this region.

","parent_name":"Region"},"Structs/Region.html#/s:13SwiftLintCore6RegionV5start3end23disabledRuleIdentifiersAcA8LocationV_AHShyAA0H10IdentifierOGtcfc":{"name":"init(start:end:disabledRuleIdentifiers:)","abstract":"

Creates a Region by setting explicit values for all its properties.

","parent_name":"Region"},"Structs/Region.html#/s:13SwiftLintCore6RegionV8containsySbAA8LocationVF":{"name":"contains(_:)","abstract":"

Whether the specific location is contained in this region.

","parent_name":"Region"},"Structs/Region.html#/s:13SwiftLintCore6RegionV13isRuleEnabledySbxAA0F0RzlF":{"name":"isRuleEnabled(_:)","abstract":"

Whether the specified rule is enabled in this region.

","parent_name":"Region"},"Structs/Region.html#/s:13SwiftLintCore6RegionV14isRuleDisabledySbxAA0F0RzlF":{"name":"isRuleDisabled(_:)","abstract":"

Whether the specified rule is disabled in this region.

","parent_name":"Region"},"Structs/Region.html#/s:13SwiftLintCore6RegionV16areRulesDisabled7ruleIDsSbSaySSG_tF":{"name":"areRulesDisabled(ruleIDs:)","abstract":"

Whether the given rules are disabled in this region.

","parent_name":"Region"},"Structs/Region.html#/s:13SwiftLintCore6RegionV26deprecatedAliasesDisabling4ruleShySSGx_tAA4RuleRzlF":{"name":"deprecatedAliasesDisabling(rule:)","abstract":"

Returns the deprecated rule aliases that are disabling the specified rule in this region.","parent_name":"Region"},"Structs/Location.html#/s:13SwiftLintCore8LocationV4fileSSSgvp":{"name":"file","abstract":"

The file path on disk for this location.

","parent_name":"Location"},"Structs/Location.html#/s:13SwiftLintCore8LocationV4lineSiSgvp":{"name":"line","abstract":"

The line offset in the file for this location. 1-indexed.

","parent_name":"Location"},"Structs/Location.html#/s:13SwiftLintCore8LocationV9characterSiSgvp":{"name":"character","abstract":"

The character offset in the file for this location. 1-indexed.

","parent_name":"Location"},"Structs/Location.html#/s:13SwiftLintCore8LocationV11descriptionSSvp":{"name":"description","abstract":"

A lossless printable description of this location.

","parent_name":"Location"},"Structs/Location.html#/s:13SwiftLintCore8LocationV12relativeFileSSSgvp":{"name":"relativeFile","abstract":"

The file path for this location relative to the current working directory.

","parent_name":"Location"},"Structs/Location.html#/s:13SwiftLintCore8LocationV4file4line9characterACSSSg_SiSgAHtcfc":{"name":"init(file:line:character:)","abstract":"

Creates a Location by specifying its properties directly.

","parent_name":"Location"},"Structs/Location.html#/s:13SwiftLintCore8LocationV4file10byteOffsetAcA0aB4FileC_21SourceKittenFramework9ByteCountVtcfc":{"name":"init(file:byteOffset:)","abstract":"

Creates a Location based on a SwiftLintFile and a byte-offset into the file.","parent_name":"Location"},"Structs/Location.html#/s:13SwiftLintCore8LocationV4file8positionAcA0aB4FileC_0A6Syntax16AbsolutePositionVtcfc":{"name":"init(file:position:)","abstract":"

Creates a Location based on a SwiftLintFile and a SwiftSyntax AbsolutePosition into the file.","parent_name":"Location"},"Structs/Location.html#/s:13SwiftLintCore8LocationV4file15characterOffsetAcA0aB4FileC_Sitcfc":{"name":"init(file:characterOffset:)","abstract":"

Creates a Location based on a SwiftLintFile and a UTF8 character-offset into the file.","parent_name":"Location"},"Structs/Location.html#/s:SL1loiySbx_xtFZ":{"name":"<(_:_:)","parent_name":"Location"},"Structs/Example.html#/s:13SwiftLintCore7ExampleV4codeSSvp":{"name":"code","abstract":"

The contents of the example

","parent_name":"Example"},"Structs/Example.html#/s:13SwiftLintCore7ExampleV13configurationSDySSs8Sendable_pGSgvp":{"name":"configuration","abstract":"

The untyped configuration to apply to the rule, if deviating from the default configuration.","parent_name":"Example"},"Structs/Example.html#/s:13SwiftLintCore7ExampleV20testMultiByteOffsetsSbvp":{"name":"testMultiByteOffsets","abstract":"

Whether the example should be tested by prepending multibyte grapheme clusters

","parent_name":"Example"},"Structs/Example.html#/s:13SwiftLintCore7ExampleV11testOnLinuxSbvp":{"name":"testOnLinux","abstract":"

Whether the example should be tested on Linux

","parent_name":"Example"},"Structs/Example.html#/s:13SwiftLintCore7ExampleV4files12StaticStringVvp":{"name":"file","abstract":"

The path to the file where the example was created

","parent_name":"Example"},"Structs/Example.html#/s:13SwiftLintCore7ExampleV4lineSuvp":{"name":"line","abstract":"

The line in the file where the example was created

","parent_name":"Example"},"Structs/Example.html#/s:13SwiftLintCore7ExampleV_13configuration20testMultiByteOffsets0F17WrappingInComment0fjK6String0F14DisableCommand0F7OnLinux4file4line24excludeFromDocumentationACSS_SDySSs8Sendable_pGSgS5bs06StaticM0VSuSbtcfc":{"name":"init(_:configuration:testMultiByteOffsets:testWrappingInComment:testWrappingInString:testDisableCommand:testOnLinux:file:line:excludeFromDocumentation:)","abstract":"

Create a new Example with the specified code, file, and line.

","parent_name":"Example"},"Structs/Example.html#/s:13SwiftLintCore7ExampleV4with4codeACSS_tF":{"name":"with(code:)","abstract":"

Returns the same example, but with the code that is passed in

","parent_name":"Example"},"Structs/Example.html#/s:13SwiftLintCore7ExampleV24removingViolationMarkersACyF":{"name":"removingViolationMarkers()","abstract":"

Returns a copy of the Example with all instances of the “↓” character removed.

","parent_name":"Example"},"Structs/Example.html#/s:13SwiftLintCore7ExampleV7focusedACyF":{"name":"focused()","abstract":"

Makes the current example focused. This is for debugging purposes only.

","parent_name":"Example"},"Structs/Example.html#/s:SQ2eeoiySbx_xtFZ":{"name":"==(_:_:)","parent_name":"Example"},"Structs/Example.html#/s:SH4hash4intoys6HasherVz_tF":{"name":"hash(into:)","parent_name":"Example"},"Structs/Example.html#/s:SL1loiySbx_xtFZ":{"name":"<(_:_:)","parent_name":"Example"},"Structs/Correction.html#/s:13SwiftLintCore10CorrectionV15ruleDescriptionAA04RuleF0Vvp":{"name":"ruleDescription","abstract":"

The description of the rule for which this correction was applied.

","parent_name":"Correction"},"Structs/Correction.html#/s:13SwiftLintCore10CorrectionV8locationAA8LocationVvp":{"name":"location","abstract":"

The location of the original violation that was corrected.

","parent_name":"Correction"},"Structs/Correction.html#/s:13SwiftLintCore10CorrectionV18consoleDescriptionSSvp":{"name":"consoleDescription","abstract":"

The console-printable description for this correction.

","parent_name":"Correction"},"Structs/Correction.html#/s:13SwiftLintCore10CorrectionV15ruleDescription8locationAcA04RuleF0V_AA8LocationVtcfc":{"name":"init(ruleDescription:location:)","abstract":"

Memberwise initializer.

","parent_name":"Correction"},"Structs/Command/Modifier.html#/s:13SwiftLintCore7CommandV8ModifierO8previousyA2EmF":{"name":"previous","abstract":"

The command should only apply to the line preceding its definition.

","parent_name":"Modifier"},"Structs/Command/Modifier.html#/s:13SwiftLintCore7CommandV8ModifierO4thisyA2EmF":{"name":"this","abstract":"

The command should only apply to the same line as its definition.

","parent_name":"Modifier"},"Structs/Command/Modifier.html#/s:13SwiftLintCore7CommandV8ModifierO4nextyA2EmF":{"name":"next","abstract":"

The command should only apply to the line following its definition.

","parent_name":"Modifier"},"Structs/Command/Modifier.html#/s:13SwiftLintCore7CommandV8ModifierO7invalidyA2EmF":{"name":"invalid","abstract":"

The modifier string was invalid.

","parent_name":"Modifier"},"Structs/Command/Action.html#/s:13SwiftLintCore7CommandV6ActionO6enableyA2EmF":{"name":"enable","abstract":"

The rule(s) associated with this command should be enabled by the SwiftLint engine.

","parent_name":"Action"},"Structs/Command/Action.html#/s:13SwiftLintCore7CommandV6ActionO7disableyA2EmF":{"name":"disable","abstract":"

The rule(s) associated with this command should be disabled by the SwiftLint engine.

","parent_name":"Action"},"Structs/Command/Action.html#/s:13SwiftLintCore7CommandV6ActionO7invalidyA2EmF":{"name":"invalid","abstract":"

The action string was invalid.

","parent_name":"Action"},"Structs/Command/Action.html":{"name":"Action","abstract":"

The action (verb) that SwiftLint should perform when interpreting this command.

","parent_name":"Command"},"Structs/Command/Modifier.html":{"name":"Modifier","abstract":"

The modifier for a command, used to modify its scope.

","parent_name":"Command"},"Structs/Command.html#/s:13SwiftLintCore7CommandV6actionAC6ActionOvp":{"name":"action","abstract":"

The action (verb) that SwiftLint should perform when interpreting this command.

","parent_name":"Command"},"Structs/Command.html#/s:13SwiftLintCore7CommandV15ruleIdentifiersShyAA14RuleIdentifierOGvp":{"name":"ruleIdentifiers","abstract":"

The identifiers for the rules associated with this command.

","parent_name":"Command"},"Structs/Command.html#/s:13SwiftLintCore7CommandV4lineSivp":{"name":"line","abstract":"

The line in the source file where this command is defined.

","parent_name":"Command"},"Structs/Command.html#/s:13SwiftLintCore7CommandV9characterSiSgvp":{"name":"character","abstract":"

The character offset within the line in the source file where this command is defined.

","parent_name":"Command"},"Structs/Command.html#/s:13SwiftLintCore7CommandV8modifierAC8ModifierOSgvp":{"name":"modifier","abstract":"

This command’s modifier, if any.

","parent_name":"Command"},"Structs/Command.html#/s:13SwiftLintCore7CommandV6action15ruleIdentifiers4line9character8modifier15trailingCommentA2C6ActionO_ShyAA14RuleIdentifierOGS2iSgAC8ModifierOSgSSSgtcfc":{"name":"init(action:ruleIdentifiers:line:character:modifier:trailingComment:)","abstract":"

Creates a command based on the specified parameters.

","parent_name":"Command"},"Structs/Command.html#/s:13SwiftLintCore7CommandV12actionString4line9characterACSS_S2itcfc":{"name":"init(actionString:line:character:)","abstract":"

Creates a command based on the specified parameters.

","parent_name":"Command"},"Structs/ChildOptionSeverityConfiguration.html#/s:13SwiftLintCore32ChildOptionSeverityConfigurationV5errorACyxGvpZ":{"name":"error","abstract":"

Configuration with a warning severity.

","parent_name":"ChildOptionSeverityConfiguration"},"Structs/ChildOptionSeverityConfiguration.html#/s:13SwiftLintCore32ChildOptionSeverityConfigurationV7warningACyxGvpZ":{"name":"warning","abstract":"

Configuration with an error severity.

","parent_name":"ChildOptionSeverityConfiguration"},"Structs/ChildOptionSeverityConfiguration.html#/s:13SwiftLintCore32ChildOptionSeverityConfigurationV3offACyxGvpZ":{"name":"off","abstract":"

Configuration disabling an option.

","parent_name":"ChildOptionSeverityConfiguration"},"Structs/ChildOptionSeverityConfiguration.html#/s:13SwiftLintCore32ChildOptionSeverityConfigurationV8severityAA09ViolationF0OSgvp":{"name":"severity","abstract":"

The ChildOptionSeverityConfiguration mapped to a usually used ViolationSeverity. It’s nil if the option","parent_name":"ChildOptionSeverityConfiguration"},"Structs/ChildOptionSeverityConfiguration.html#/s:13SwiftLintCore17RuleConfigurationP5apply13configurationyyp_tKF":{"name":"apply(configuration:)","parent_name":"ChildOptionSeverityConfiguration"},"Structs/ChildOptionSeverityConfiguration.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP8asOptionAA0I4TypeOyF":{"name":"asOption()","parent_name":"ChildOptionSeverityConfiguration"},"Structs/Baseline.html#/s:13SwiftLintCore8BaselineV10violationsSayAA14StyleViolationVGvp":{"name":"violations","abstract":"

The stored violations.

","parent_name":"Baseline"},"Structs/Baseline.html#/s:13SwiftLintCore8BaselineV8fromPathACSS_tKcfc":{"name":"init(fromPath:)","abstract":"

Creates a Baseline from a saved file.

","parent_name":"Baseline"},"Structs/Baseline.html#/s:13SwiftLintCore8BaselineV10violationsACSayAA14StyleViolationVG_tcfc":{"name":"init(violations:)","abstract":"

Creates a Baseline from a list of violations.

","parent_name":"Baseline"},"Structs/Baseline.html#/s:13SwiftLintCore8BaselineV5write6toPathySS_tKF":{"name":"write(toPath:)","abstract":"

Writes a Baseline to disk in JSON format.

","parent_name":"Baseline"},"Structs/Baseline.html#/s:13SwiftLintCore8BaselineV6filterySayAA14StyleViolationVGAGF":{"name":"filter(_:)","abstract":"

Filters out violations that are present in the Baseline.

","parent_name":"Baseline"},"Structs/Baseline.html#/s:13SwiftLintCore8BaselineV7compareySayAA14StyleViolationVGACF":{"name":"compare(_:)","abstract":"

Returns the violations that are present in another Baseline, but not in this one.

","parent_name":"Baseline"},"Structs/Stack.html#/s:13SwiftLintCore5StackVACyxGycfc":{"name":"init()","abstract":"

Creates an empty Stack.

","parent_name":"Stack"},"Structs/Stack.html#/s:13SwiftLintCore5StackV5countSivp":{"name":"count","abstract":"

The number of elements in this stack.

","parent_name":"Stack"},"Structs/Stack.html#/s:13SwiftLintCore5StackV4pushyyxF":{"name":"push(_:)","abstract":"

Pushes (appends) an element onto the stack.

","parent_name":"Stack"},"Structs/Stack.html#/s:13SwiftLintCore5StackV3popxSgyF":{"name":"pop()","abstract":"

Removes and returns the last element of the stack.

","parent_name":"Stack"},"Structs/Stack.html#/s:13SwiftLintCore5StackV4peekxSgyF":{"name":"peek()","abstract":"

Returns the last element of the stack if the stack is not empty; otherwise, nil.

","parent_name":"Stack"},"Structs/Stack.html#/s:13SwiftLintCore5StackV8contains5whereS2bxXE_tF":{"name":"contains(where:)","abstract":"

Check whether the sequence contains an element that satisfies the given predicate.

","parent_name":"Stack"},"Structs/Stack.html#/s:13SwiftLintCore5StackV10modifyLast2byyyxzXE_tF":{"name":"modifyLast(by:)","abstract":"

Modify the last element.

","parent_name":"Stack"},"Structs/Stack.html#/s:ST12makeIterator0B0QzyF":{"name":"makeIterator()","parent_name":"Stack"},"Structs/Stack.html#/s:s28CustomDebugStringConvertibleP16debugDescriptionSSvp":{"name":"debugDescription","parent_name":"Stack"},"Structs/Stack.html":{"name":"Stack","abstract":"

A basic stack type implementing the LIFO principle - only the last inserted element can be accessed and removed.

"},"Structs/Baseline.html":{"name":"Baseline","abstract":"

A set of violations that can be used to filter newly detected violations.

"},"Structs/ChildOptionSeverityConfiguration.html":{"name":"ChildOptionSeverityConfiguration","abstract":"

A rule configuration that allows to disable (off) an option of a rule or specify its severity level in which"},"Structs/Command.html":{"name":"Command","abstract":"

A SwiftLint-interpretable command to modify SwiftLint’s behavior embedded as comments in source code.

"},"Structs/Correction.html":{"name":"Correction","abstract":"

A value describing a SwiftLint violation that was corrected.

"},"Structs/Example.html":{"name":"Example","abstract":"

Captures code and context information for an example of a triggering or"},"Structs/Location.html":{"name":"Location","abstract":"

The placement of a segment of Swift in a collection of source files.

"},"Structs/Region.html":{"name":"Region","abstract":"

A contiguous region of Swift source code.

"},"Structs/RuleConfigurationDescription.html":{"name":"RuleConfigurationDescription","abstract":"

Description of a rule configuration.

"},"Structs/RuleConfigurationOption.html":{"name":"RuleConfigurationOption","abstract":"

A single option of a RuleConfigurationDescription.

"},"Structs.html#/s:13SwiftLintCore35RuleConfigurationDescriptionBuilderV":{"name":"RuleConfigurationDescriptionBuilder","abstract":"

A result builder creating configuration descriptions.

"},"Structs/ConfigurationElement.html":{"name":"ConfigurationElement","abstract":"

A single parameter of a rule configuration.

"},"Structs/SeverityConfiguration.html":{"name":"SeverityConfiguration","abstract":"

A rule configuration that allows specifying the desired severity level for violations.

"},"Structs/RuleDescription.html":{"name":"RuleDescription","abstract":"

A detailed description for a SwiftLint rule. Used for both documentation and testing purposes.

"},"Structs/RuleList.html":{"name":"RuleList","abstract":"

A list of available SwiftLint rules.

"},"Structs/RuleParameter.html":{"name":"RuleParameter","abstract":"

A configuration parameter for rules.

"},"Structs/StyleViolation.html":{"name":"StyleViolation","abstract":"

A value describing an instance of Swift source code that is considered invalid by a SwiftLint rule.

"},"Structs/SwiftLintSyntaxMap.html":{"name":"SwiftLintSyntaxMap","abstract":"

Represents a Swift file’s syntax information.

"},"Structs/SwiftLintSyntaxToken.html":{"name":"SwiftLintSyntaxToken","abstract":"

A SwiftLint-aware Swift syntax token.

"},"Structs/SwiftVersion.html":{"name":"SwiftVersion","abstract":"

A value describing the version of the Swift compiler.

"},"Structs/ReasonedRuleViolation.html":{"name":"ReasonedRuleViolation","abstract":"

A violation produced by ViolationsSyntaxVisitors.

"},"Structs/RegexConfiguration.html":{"name":"RegexConfiguration","abstract":"

A rule configuration used for defining custom rules in yaml.

"},"Structs/SeverityLevelsConfiguration.html":{"name":"SeverityLevelsConfiguration","abstract":"

A rule configuration that allows specifying thresholds for warning and error severities.

"},"Protocols/SwiftSyntaxRule.html#/s:13SwiftLintCore0A10SyntaxRuleP11makeVisitor4fileAA010ViolationsdG0Cy17ConfigurationTypeQzGAA0aB4FileC_tF":{"name":"makeVisitor(file:)","abstract":"

Produce a ViolationsSyntaxVisitor for the given file.

","parent_name":"SwiftSyntaxRule"},"Protocols/SwiftSyntaxRule.html#/s:13SwiftLintCore0A10SyntaxRuleP13makeViolation4file9violationAA05StyleG0VAA0aB4FileC_AA08ReasonedeG0VtF":{"name":"makeViolation(file:violation:)","abstract":"

Produce a violation for the given file and absolute position.

","parent_name":"SwiftSyntaxRule"},"Protocols/SwiftSyntaxRule.html#/s:13SwiftLintCore0A10SyntaxRuleP10preprocess4file0aD0010SourceFileD0VSgAA0abI0C_tF":{"name":"preprocess(file:)","abstract":"

Gives a chance for the rule to do some pre-processing on the syntax tree.","parent_name":"SwiftSyntaxRule"},"Protocols/SwiftSyntaxRule.html#/s:13SwiftLintCore4RuleP8validate4fileSayAA14StyleViolationVGAA0aB4FileC_tF":{"name":"validate(file:)","parent_name":"SwiftSyntaxRule"},"Protocols/SwiftSyntaxCorrectableRule.html#/s:13SwiftLintCore0A21SyntaxCorrectableRuleP12makeRewriter4fileAA010ViolationsdH0Cy17ConfigurationTypeQzGSgAA0aB4FileC_tF":{"name":"makeRewriter(file:)","abstract":"

Produce a ViolationsSyntaxRewriter for the given file.

","parent_name":"SwiftSyntaxCorrectableRule"},"Protocols/SwiftSyntaxCorrectableRule.html#/s:13SwiftLintCore15CorrectableRuleP7correct4fileSayAA10CorrectionVGAA0aB4FileC_tF":{"name":"correct(file:)","parent_name":"SwiftSyntaxCorrectableRule"},"Protocols/SeverityBasedRuleConfiguration.html#/s:13SwiftLintCore30SeverityBasedRuleConfigurationP08severityG0AA0dG0Vy6ParentQzGvp":{"name":"severityConfiguration","abstract":"

The configuration of a rule’s severity.

","parent_name":"SeverityBasedRuleConfiguration"},"Protocols/SeverityBasedRuleConfiguration.html#/s:13SwiftLintCore30SeverityBasedRuleConfigurationPAAE8severityAA09ViolationD0Ovp":{"name":"severity","abstract":"

The severity of a rule.

","parent_name":"SeverityBasedRuleConfiguration"},"Protocols/RuleConfiguration.html#/s:13SwiftLintCore17RuleConfigurationP6ParentQa":{"name":"Parent","abstract":"

The type of the rule that’s using this configuration.

","parent_name":"RuleConfiguration"},"Protocols/RuleConfiguration.html#/s:13SwiftLintCore17RuleConfigurationP20parameterDescriptionAA0deG0VSgvp":{"name":"parameterDescription","abstract":"

A description for this configuration’s parameters. It can be built using the annotated result builder.

","parent_name":"RuleConfiguration"},"Protocols/RuleConfiguration.html#/s:13SwiftLintCore17RuleConfigurationP5apply13configurationyyp_tKF":{"name":"apply(configuration:)","abstract":"

Apply an untyped configuration to the current value.

","parent_name":"RuleConfiguration"},"Protocols/RuleConfiguration.html#/s:13SwiftLintCore17RuleConfigurationP8validateyyKF":{"name":"validate()","abstract":"

Run a sanity check on the configuration, perform optional postprocessing steps and/or warn about potential","parent_name":"RuleConfiguration"},"Protocols/RuleConfiguration.html#/s:13SwiftLintCore17RuleConfigurationPAAE13supportedKeysShySSGvp":{"name":"supportedKeys","abstract":"

All keys supported by this configuration.

","parent_name":"RuleConfiguration"},"Protocols/AnalyzerRule.html#/s:13SwiftLintCore4RuleP8validate4fileSayAA14StyleViolationVGAA0aB4FileC_tF":{"name":"validate(file:)","parent_name":"AnalyzerRule"},"Protocols/SubstitutionCorrectableRule.html#/s:13SwiftLintCore27SubstitutionCorrectableRuleP15violationRanges2inSaySo8_NSRangeVGAA0aB4FileC_tF":{"name":"violationRanges(in:)","abstract":"

Returns the NSString-based NSRanges to be replaced in the specified file.

","parent_name":"SubstitutionCorrectableRule"},"Protocols/SubstitutionCorrectableRule.html#/s:13SwiftLintCore27SubstitutionCorrectableRuleP12substitution3for2inSo8_NSRangeV_SStSgAH_AA0aB4FileCtF":{"name":"substitution(for:in:)","abstract":"

Returns the substitution to apply for the given range.

","parent_name":"SubstitutionCorrectableRule"},"Protocols/SubstitutionCorrectableRule.html#/s:13SwiftLintCore15CorrectableRuleP7correct4fileSayAA10CorrectionVGAA0aB4FileC_tF":{"name":"correct(file:)","parent_name":"SubstitutionCorrectableRule"},"Protocols/CorrectableRule.html#/s:13SwiftLintCore15CorrectableRuleP7correct4file17compilerArgumentsSayAA10CorrectionVGAA0aB4FileC_SaySSGtF":{"name":"correct(file:compilerArguments:)","abstract":"

Attempts to correct the violations to this rule in the specified file.

","parent_name":"CorrectableRule"},"Protocols/CorrectableRule.html#/s:13SwiftLintCore15CorrectableRuleP7correct4fileSayAA10CorrectionVGAA0aB4FileC_tF":{"name":"correct(file:)","abstract":"

Attempts to correct the violations to this rule in the specified file.

","parent_name":"CorrectableRule"},"Protocols/CorrectableRule.html#/s:13SwiftLintCore15CorrectableRuleP7correct4file5using17compilerArgumentsSayAA10CorrectionVGAA0aB4FileC_AA0E7StorageCSaySSGtF":{"name":"correct(file:using:compilerArguments:)","abstract":"

Attempts to correct the violations to this rule in the specified file after collecting file info for all files","parent_name":"CorrectableRule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP17ConfigurationTypeQa":{"name":"ConfigurationType","abstract":"

The type of the configuration used to configure this rule.

","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP11descriptionAA0D11DescriptionVvpZ":{"name":"description","abstract":"

A verbose description of many of this rule’s properties.

","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP13configuration17ConfigurationTypeQzvp":{"name":"configuration","abstract":"

This rule’s configuration.

","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP06shouldB10EmptyFilesSbvp":{"name":"shouldLintEmptyFiles","abstract":"

Whether this rule should be used on empty files. Defaults to false.

","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RulePxycfc":{"name":"init()","abstract":"

A default initializer for rules. All rules need to be trivially initializable.

","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP13configurationxyp_tKcfc":{"name":"init(configuration:)","abstract":"

Creates a rule by applying its configuration.

","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP30createConfigurationDescription16exclusiveOptionsAA0dfG0VShySSG_tF":{"name":"createConfigurationDescription(exclusiveOptions:)","abstract":"

Create a description of how this rule has been configured to run.

","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP8validate4file17compilerArgumentsSayAA14StyleViolationVGAA0aB4FileC_SaySSGtF":{"name":"validate(file:compilerArguments:)","abstract":"

Executes the rule on a file and returns any violations to the rule’s expectations.

","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP8validate4fileSayAA14StyleViolationVGAA0aB4FileC_tF":{"name":"validate(file:)","abstract":"

Executes the rule on a file and returns any violations to the rule’s expectations.

","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP9isEqualToySbAaB_pF":{"name":"isEqualTo(_:)","abstract":"

Whether or not the specified rule is equivalent to the current rule.

","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP11collectInfo3for4into17compilerArgumentsyAA0aB4FileC_AA0D7StorageCSaySSGtF":{"name":"collectInfo(for:into:compilerArguments:)","abstract":"

Collects information for the specified file in a storage object, to be analyzed by a CollectedLinter.

","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP8validate4file5using17compilerArgumentsSayAA14StyleViolationVGAA0aB4FileC_AA0D7StorageCSaySSGtF":{"name":"validate(file:using:compilerArguments:)","abstract":"

Executes the rule on a file after collecting file info for all files and returns any violations to the rule’s","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP13canBeDisabled9violation2bySbAA14StyleViolationV_AA0D10IdentifierOtF":{"name":"canBeDisabled(violation:by:)","abstract":"

Checks if a style violation can be disabled by a command specifying a rule ID. Only the rule can claim that for","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RuleP9isEnabled2in3forSbAA6RegionV_SStF":{"name":"isEnabled(in:for:)","abstract":"

Checks if a the rule is enabled in a given region. A specific rule ID can be provided in case a rule supports","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RulePAAE16cacheDescriptionSSvp":{"name":"cacheDescription","abstract":"

The cache description which will be used to determine if a previous","parent_name":"Rule"},"Protocols/Rule.html#/s:13SwiftLintCore4RulePAAE10identifierSSvpZ":{"name":"identifier","abstract":"

The rule’s unique identifier which is the same as Rule.description.identifier.

","parent_name":"Rule"},"Protocols/CollectingRule.html#/s:13SwiftLintCore14CollectingRuleP8FileInfoQa":{"name":"FileInfo","abstract":"

The kind of information to collect for each file being linted for this rule.

","parent_name":"CollectingRule"},"Protocols/CollectingRule.html#/s:13SwiftLintCore14CollectingRuleP11collectInfo3for17compilerArguments04FileG0QzAA0abK0C_SaySSGtF":{"name":"collectInfo(for:compilerArguments:)","abstract":"

Collects information for the specified file, to be analyzed by a CollectedLinter.

","parent_name":"CollectingRule"},"Protocols/CollectingRule.html#/s:13SwiftLintCore14CollectingRuleP11collectInfo3for04FileG0QzAA0abI0C_tF":{"name":"collectInfo(for:)","abstract":"

Collects information for the specified file, to be analyzed by a CollectedLinter.

","parent_name":"CollectingRule"},"Protocols/CollectingRule.html#/s:13SwiftLintCore14CollectingRuleP8validate4file13collectedInfo17compilerArgumentsSayAA14StyleViolationVGAA0aB4FileC_SDyAL0nI0QzGSaySSGtF":{"name":"validate(file:collectedInfo:compilerArguments:)","abstract":"

Executes the rule on a file after collecting file info for all files and returns any violations to the rule’s","parent_name":"CollectingRule"},"Protocols/CollectingRule.html#/s:13SwiftLintCore14CollectingRuleP8validate4file13collectedInfoSayAA14StyleViolationVGAA0aB4FileC_SDyAK0lI0QzGtF":{"name":"validate(file:collectedInfo:)","abstract":"

Executes the rule on a file after collecting file info for all files and returns any violations to the rule’s","parent_name":"CollectingRule"},"Protocols/CollectingRule.html#/s:13SwiftLintCore4RuleP11collectInfo3for4into17compilerArgumentsyAA0aB4FileC_AA0D7StorageCSaySSGtF":{"name":"collectInfo(for:into:compilerArguments:)","parent_name":"CollectingRule"},"Protocols/CollectingRule.html#/s:13SwiftLintCore4RuleP8validate4file5using17compilerArgumentsSayAA14StyleViolationVGAA0aB4FileC_AA0D7StorageCSaySSGtF":{"name":"validate(file:using:compilerArguments:)","parent_name":"CollectingRule"},"Protocols/CollectingRule.html#/s:13SwiftLintCore4RuleP8validate4fileSayAA14StyleViolationVGAA0aB4FileC_tF":{"name":"validate(file:)","parent_name":"CollectingRule"},"Protocols/CollectingRule.html#/s:13SwiftLintCore4RuleP8validate4file17compilerArgumentsSayAA14StyleViolationVGAA0aB4FileC_SaySSGtF":{"name":"validate(file:compilerArguments:)","parent_name":"CollectingRule"},"Protocols/CacheDescriptionProvider.html#/s:13SwiftLintCore24CacheDescriptionProviderP05cacheE0SSvp":{"name":"cacheDescription","abstract":"

The cache description which will be used to determine if a previous","parent_name":"CacheDescriptionProvider"},"Protocols/ASTRule.html#/s:13SwiftLintCore7ASTRuleP8KindTypeQa":{"name":"KindType","abstract":"

The kind of token being recursed over.

","parent_name":"ASTRule"},"Protocols/ASTRule.html#/s:13SwiftLintCore7ASTRuleP8validate4file4kind10dictionarySayAA14StyleViolationVGAA0aB4FileC_8KindTypeQzAA22SourceKittenDictionaryVtF":{"name":"validate(file:kind:dictionary:)","abstract":"

Executes the rule on a file and a subset of its AST structure, returning any violations to the rule’s","parent_name":"ASTRule"},"Protocols/ASTRule.html#/s:13SwiftLintCore7ASTRuleP4kind4from8KindTypeQzSgAA22SourceKittenDictionaryV_tF":{"name":"kind(from:)","abstract":"

Get the kind from the specified dictionary.

","parent_name":"ASTRule"},"Protocols/ASTRule.html#/s:13SwiftLintCore4RuleP8validate4fileSayAA14StyleViolationVGAA0aB4FileC_tF":{"name":"validate(file:)","parent_name":"ASTRule"},"Protocols/ASTRule.html#/s:13SwiftLintCore7ASTRulePAAE8validate4file10dictionarySayAA14StyleViolationVGAA0aB4FileC_AA22SourceKittenDictionaryVtF":{"name":"validate(file:dictionary:)","abstract":"

Executes the rule on a file and a subset of its AST structure, returning any violations to the rule’s","parent_name":"ASTRule"},"Protocols/VersionComparable.html#/s:13SwiftLintCore17VersionComparableP8rawValueSSvp":{"name":"rawValue","abstract":"

The version string.

","parent_name":"VersionComparable"},"Protocols/VersionComparable.html#/s:SQ2eeoiySbx_xtFZ":{"name":"==(_:_:)","parent_name":"VersionComparable"},"Protocols/VersionComparable.html#/s:SL1loiySbx_xtFZ":{"name":"<(_:_:)","parent_name":"VersionComparable"},"Protocols/AcceptableByConfigurationElement.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP7fromAny7contextxyp_SStKcfc":{"name":"init(fromAny:context:)","abstract":"

Initializer taking a value from a configuration to create an element of Self.

","parent_name":"AcceptableByConfigurationElement"},"Protocols/AcceptableByConfigurationElement.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP8asOptionAA0I4TypeOyF":{"name":"asOption()","abstract":"

Make the object an option.

","parent_name":"AcceptableByConfigurationElement"},"Protocols/AcceptableByConfigurationElement.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP13asDescription4withAA04RulefI0VSS_tF":{"name":"asDescription(with:)","abstract":"

Make the object a description.

","parent_name":"AcceptableByConfigurationElement"},"Protocols/AcceptableByConfigurationElement.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP5apply_6ruleIDyyp_SStKF":{"name":"apply(_:ruleID:)","abstract":"

Update the object.

","parent_name":"AcceptableByConfigurationElement"},"Protocols/Documentable.html#/s:13SwiftLintCore12DocumentableP8markdownSSyF":{"name":"markdown()","abstract":"

Convert an object to Markdown.

","parent_name":"Documentable"},"Protocols/Documentable.html#/s:13SwiftLintCore12DocumentableP8oneLinerSSyF":{"name":"oneLiner()","abstract":"

Convert an object to a single line string.

","parent_name":"Documentable"},"Protocols/Documentable.html#/s:13SwiftLintCore12DocumentableP10hasContentSbvp":{"name":"hasContent","abstract":"

Indicate if the item has some content that is useful to document.

","parent_name":"Documentable"},"Protocols/Documentable.html#/s:13SwiftLintCore12DocumentableP4yamlSSyF":{"name":"yaml()","abstract":"

Convert an object to YAML as used in .swiftlint.yml.

","parent_name":"Documentable"},"Protocols/Documentable.html":{"name":"Documentable","abstract":"

A type that can be converted into a human-readable representation.

"},"Protocols/AcceptableByConfigurationElement.html":{"name":"AcceptableByConfigurationElement","abstract":"

Type of an object that can be used as a configuration element.

"},"Protocols.html#/s:13SwiftLintCore19InlinableOptionTypeP":{"name":"InlinableOptionType","abstract":"

An option type that can appear inlined into its using configuration.

"},"Protocols/VersionComparable.html":{"name":"VersionComparable","abstract":"

A comparable major.minor.patch version number.

"},"Protocols/ASTRule.html":{"name":"ASTRule","abstract":"

A rule that leverages the Swift source’s pre-typechecked Abstract Syntax Tree to recurse into the source’s"},"Protocols/CacheDescriptionProvider.html":{"name":"CacheDescriptionProvider","abstract":"

Interface providing access to a cache description.

"},"Protocols.html#/s:13SwiftLintCore17AnyCollectingRuleP":{"name":"AnyCollectingRule","abstract":"

Type-erased protocol used to check whether a rule is collectable.

"},"Protocols/CollectingRule.html":{"name":"CollectingRule","abstract":"

A rule that requires knowledge of all other files being linted.

"},"Protocols/Rule.html":{"name":"Rule","abstract":"

An executable value that can identify issues (violations) in Swift source code.

"},"Protocols.html#/s:13SwiftLintCore9OptInRuleP":{"name":"OptInRule","abstract":"

A rule that is not enabled by default. Rules conforming to this need to be explicitly enabled by users.

"},"Protocols/CorrectableRule.html":{"name":"CorrectableRule","abstract":"

A rule that can correct violations.

"},"Protocols/SubstitutionCorrectableRule.html":{"name":"SubstitutionCorrectableRule","abstract":"

A correctable rule that can apply its corrections by replacing the content of ranges in the offending file with"},"Protocols.html#/s:13SwiftLintCore17SourceKitFreeRuleP":{"name":"SourceKitFreeRule","abstract":"

A rule that does not need SourceKit to operate and can still operate even after SourceKit has crashed.

"},"Protocols/AnalyzerRule.html":{"name":"AnalyzerRule","abstract":"

A rule that can operate on the post-typechecked AST using compiler arguments. Performs rules that are more like"},"Protocols/RuleConfiguration.html":{"name":"RuleConfiguration","abstract":"

A configuration value for a rule to allow users to modify its behavior.

"},"Protocols/SeverityBasedRuleConfiguration.html":{"name":"SeverityBasedRuleConfiguration","abstract":"

A configuration for a rule that allows to configure at least the severity.

"},"Protocols/SwiftSyntaxCorrectableRule.html":{"name":"SwiftSyntaxCorrectableRule","abstract":"

A SwiftLint CorrectableRule that performs its corrections using a SwiftSyntax SyntaxRewriter.

"},"Protocols/SwiftSyntaxRule.html":{"name":"SwiftSyntaxRule","abstract":"

A SwiftLint Rule backed by SwiftSyntax that does not use SourceKit requests.

"},"Extensions/Double.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP8asOptionAA0I4TypeOyF":{"name":"asOption()","parent_name":"Double"},"Extensions/Double.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP7fromAny7contextxyp_SStKcfc":{"name":"init(fromAny:context:)","parent_name":"Double"},"Extensions/Int.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP8asOptionAA0I4TypeOyF":{"name":"asOption()","parent_name":"Int"},"Extensions/Int.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP7fromAny7contextxyp_SStKcfc":{"name":"init(fromAny:context:)","parent_name":"Int"},"Extensions/Set.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP8asOptionAA0I4TypeOyF":{"name":"asOption()","parent_name":"Set"},"Extensions/Set.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP7fromAny7contextxyp_SStKcfc":{"name":"init(fromAny:context:)","parent_name":"Set"},"Extensions/String.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP8asOptionAA0I4TypeOyF":{"name":"asOption()","parent_name":"String"},"Extensions/String.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP7fromAny7contextxyp_SStKcfc":{"name":"init(fromAny:context:)","parent_name":"String"},"Extensions/Bool.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP8asOptionAA0I4TypeOyF":{"name":"asOption()","parent_name":"Bool"},"Extensions/Bool.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP7fromAny7contextxyp_SStKcfc":{"name":"init(fromAny:context:)","parent_name":"Bool"},"Extensions/Optional.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP8asOptionAA0I4TypeOyF":{"name":"asOption()","parent_name":"Optional"},"Extensions/Optional.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP7fromAny7contextxyp_SStKcfc":{"name":"init(fromAny:context:)","parent_name":"Optional"},"Extensions/Array.html#/s:Sa13SwiftLintCoreAA7ExampleVRszlE26skipWrappingInCommentTestsSayACGyF":{"name":"skipWrappingInCommentTests()","abstract":"

Make these examples skip wrapping in comment tests.

","parent_name":"Array"},"Extensions/Array.html#/s:Sa13SwiftLintCoreAA7ExampleVRszlE25skipWrappingInStringTestsSayACGyF":{"name":"skipWrappingInStringTests()","abstract":"

Make these examples skip wrapping in string tests.

","parent_name":"Array"},"Extensions/Array.html#/s:Sa13SwiftLintCoreAA7ExampleVRszlE24skipMultiByteOffsetTestsSayACGyF":{"name":"skipMultiByteOffsetTests()","abstract":"

Make these examples skip multi-byte offset tests.

","parent_name":"Array"},"Extensions/Array.html#/s:Sa13SwiftLintCoreAA7ExampleVRszlE23skipDisableCommandTestsSayACGyF":{"name":"skipDisableCommandTests()","abstract":"

Make these examples skip disable command tests.

","parent_name":"Array"},"Extensions/Array.html#/s:Sa13SwiftLintCoreAA7ExampleVRszlE23removingViolationMarkerSayACGyF":{"name":"removingViolationMarker()","abstract":"

Remove all violation markers from the examples.

","parent_name":"Array"},"Extensions/Array.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP8asOptionAA0I4TypeOyF":{"name":"asOption()","parent_name":"Array"},"Extensions/Array.html#/s:13SwiftLintCore32AcceptableByConfigurationElementP7fromAny7contextxyp_SStKcfc":{"name":"init(fromAny:context:)","parent_name":"Array"},"Extensions/Array.html#/s:Sa13SwiftLintCoreAA0aB11SyntaxTokenVRszlE5kindsSay21SourceKittenFramework0D4KindOGvp":{"name":"kinds","abstract":"

The kinds for these tokens.

","parent_name":"Array"},"Extensions/Array.html#/s:Sa13SwiftLintCoreAA21ReasonedRuleViolationVRszlE6appendyy0A6Syntax16AbsolutePositionVF":{"name":"append(_:)","abstract":"

Add a violation at the specified position using the default description and severity.

","parent_name":"Array"},"Extensions/Array.html#/s:Sa13SwiftLintCoreAA21ReasonedRuleViolationVRszlE6append2at10correctiony0A6Syntax16AbsolutePositionV_AC0F10CorrectionVSgtF":{"name":"append(at:correction:)","abstract":"

Add a violation and the correction at the specified position using the default description and severity.

","parent_name":"Array"},"Extensions/Array.html#/s:Sa13SwiftLintCoreAA21ReasonedRuleViolationVRszlE6append10contentsOfySay0A6Syntax16AbsolutePositionVG_tF":{"name":"append(contentsOf:)","abstract":"

Add violations for the specified positions using the default description and severity.

","parent_name":"Array"},"Extensions/Array.html#/s:Sa13SwiftLintCore0A6Syntax04DeclD8Protocol_pXpRszlE3allSayAbC_pXpGvpZ":{"name":"all","abstract":"

All visitable declaration syntax types.

","parent_name":"Array"},"Extensions/Array.html#/s:Sa13SwiftLintCore0A6Syntax04DeclD8Protocol_pXpRszlE9allExceptySayAbC_pXpGAbC_pXpd_tFZ":{"name":"allExcept(_:)","abstract":"

All declarations except for the specified ones.

","parent_name":"Array"},"Extensions/Array.html":{"name":"Array"},"Extensions/Optional.html":{"name":"Optional"},"Extensions/Bool.html":{"name":"Bool"},"Extensions/String.html":{"name":"String"},"Extensions/Set.html":{"name":"Set"},"Extensions/Int.html":{"name":"Int"},"Extensions/Double.html":{"name":"Double"},"Enums/IdentifierDeclaration.html#/s:13SwiftLintCore21IdentifierDeclarationO9parameteryAC0A6Syntax05TokenG0V_tcACmF":{"name":"parameter(name:)","abstract":"

Parameter declaration with a name token.

","parent_name":"IdentifierDeclaration"},"Enums/IdentifierDeclaration.html#/s:13SwiftLintCore21IdentifierDeclarationO13localVariableyAC0A6Syntax05TokenH0V_tcACmF":{"name":"localVariable(name:)","abstract":"

Local variable declaration with a name token.

","parent_name":"IdentifierDeclaration"},"Enums/IdentifierDeclaration.html#/s:13SwiftLintCore21IdentifierDeclarationO16implicitVariableyACSS_tcACmF":{"name":"implicitVariable(name:)","abstract":"

A variable that is implicitly added by the compiler (e.g. error in catch clauses).

","parent_name":"IdentifierDeclaration"},"Enums/IdentifierDeclaration.html#/s:13SwiftLintCore21IdentifierDeclarationO8wildcardyA2CmF":{"name":"wildcard","abstract":"

A variable hidden from scope because its name is a wildcard _.

","parent_name":"IdentifierDeclaration"},"Enums/IdentifierDeclaration.html#/s:13SwiftLintCore21IdentifierDeclarationO14lookupBoundaryyA2CmF":{"name":"lookupBoundary","abstract":"

Special case that marks a type boundary at which name lookup stops.

","parent_name":"IdentifierDeclaration"},"Enums/IdentifierDeclaration.html#/s:13SwiftLintCore21IdentifierDeclarationO8declares2id18disregardBackticksSbSS_SbtF":{"name":"declares(id:disregardBackticks:)","abstract":"

Check whether self declares a variable given by name.

","parent_name":"IdentifierDeclaration"},"Enums/ViolationSeverity.html#/s:13SwiftLintCore17ViolationSeverityO7warningyA2CmF":{"name":"warning","abstract":"

Non-fatal. If using SwiftLint as an Xcode build phase, Xcode will mark the build as having succeeded.

","parent_name":"ViolationSeverity"},"Enums/ViolationSeverity.html#/s:13SwiftLintCore17ViolationSeverityO5erroryA2CmF":{"name":"error","abstract":"

Fatal. If using SwiftLint as an Xcode build phase, Xcode will mark the build as having failed.

","parent_name":"ViolationSeverity"},"Enums/ViolationSeverity.html#/s:SL1loiySbx_xtFZ":{"name":"<(_:_:)","parent_name":"ViolationSeverity"},"Enums/SwiftExpressionKind.html#/s:13SwiftLintCore0A14ExpressionKindO4callyA2CmF":{"name":"call","abstract":"

A call to a named function or closure.

","parent_name":"SwiftExpressionKind"},"Enums/SwiftExpressionKind.html#/s:13SwiftLintCore0A14ExpressionKindO8argumentyA2CmF":{"name":"argument","abstract":"

An argument value for a function or closure.

","parent_name":"SwiftExpressionKind"},"Enums/SwiftExpressionKind.html#/s:13SwiftLintCore0A14ExpressionKindO5arrayyA2CmF":{"name":"array","abstract":"

An Array expression.

","parent_name":"SwiftExpressionKind"},"Enums/SwiftExpressionKind.html#/s:13SwiftLintCore0A14ExpressionKindO10dictionaryyA2CmF":{"name":"dictionary","abstract":"

A Dictionary expression.

","parent_name":"SwiftExpressionKind"},"Enums/SwiftExpressionKind.html#/s:13SwiftLintCore0A14ExpressionKindO13objectLiteralyA2CmF":{"name":"objectLiteral","abstract":"

An object literal expression. https://developer.apple.com/swift/blog/?id=33

","parent_name":"SwiftExpressionKind"},"Enums/SwiftExpressionKind.html#/s:13SwiftLintCore0A14ExpressionKindO7closureyA2CmF":{"name":"closure","abstract":"

A closure expression. https://docs.swift.org/swift-book/LanguageGuide/Closures.html

","parent_name":"SwiftExpressionKind"},"Enums/SwiftExpressionKind.html#/s:13SwiftLintCore0A14ExpressionKindO5tupleyA2CmF":{"name":"tuple","abstract":"

A tuple expression. https://docs.swift.org/swift-book/ReferenceManual/Types.html#ID448

","parent_name":"SwiftExpressionKind"},"Enums/RuleListError.html#/s:13SwiftLintCore13RuleListErrorO24duplicatedConfigurationsyAcA0D0_pXp_tcACmF":{"name":"duplicatedConfigurations(rule:)","abstract":"

The rule list contains more than one configuration for the specified rule.

","parent_name":"RuleListError"},"Enums/RuleKind.html#/s:13SwiftLintCore8RuleKindO4lintyA2CmF":{"name":"lint","abstract":"

Describes rules that validate Swift source conventions.

","parent_name":"RuleKind"},"Enums/RuleKind.html#/s:13SwiftLintCore8RuleKindO9idiomaticyA2CmF":{"name":"idiomatic","abstract":"

Describes rules that validate common practices in the Swift community.

","parent_name":"RuleKind"},"Enums/RuleKind.html#/s:13SwiftLintCore8RuleKindO5styleyA2CmF":{"name":"style","abstract":"

Describes rules that validate stylistic choices.

","parent_name":"RuleKind"},"Enums/RuleKind.html#/s:13SwiftLintCore8RuleKindO7metricsyA2CmF":{"name":"metrics","abstract":"

Describes rules that validate magnitudes or measurements of Swift source.

","parent_name":"RuleKind"},"Enums/RuleKind.html#/s:13SwiftLintCore8RuleKindO11performanceyA2CmF":{"name":"performance","abstract":"

Describes rules that validate that code patterns with poor performance are avoided.

","parent_name":"RuleKind"},"Enums/RuleIdentifier.html#/s:13SwiftLintCore14RuleIdentifierO3allyA2CmF":{"name":"all","abstract":"

Special identifier that should be treated as referring to ‘all’ SwiftLint rules. One helpful usecase is in","parent_name":"RuleIdentifier"},"Enums/RuleIdentifier.html#/s:13SwiftLintCore14RuleIdentifierO6singleyACSS_tcACmF":{"name":"single(identifier:)","abstract":"

Represents a single SwiftLint rule with the specified identifier.

","parent_name":"RuleIdentifier"},"Enums/RuleIdentifier.html#/s:13SwiftLintCore14RuleIdentifierO20stringRepresentationSSvp":{"name":"stringRepresentation","abstract":"

The spelling of the string for this identifier.

","parent_name":"RuleIdentifier"},"Enums/RuleIdentifier.html#/s:13SwiftLintCore14RuleIdentifierOyACSScfc":{"name":"init(_:)","abstract":"

Creates a RuleIdentifier by its string representation.

","parent_name":"RuleIdentifier"},"Enums/RuleIdentifier.html#/s:s26ExpressibleByStringLiteralP06stringD0x0cD4TypeQz_tcfc":{"name":"init(stringLiteral:)","parent_name":"RuleIdentifier"},"Enums/RuleIdentifier.html#/s:SL1loiySbx_xtFZ":{"name":"<(_:_:)","parent_name":"RuleIdentifier"},"Enums/OptionType.html#/s:13SwiftLintCore10OptionTypeO5emptyyA2CmF":{"name":"empty","abstract":"

An irrelevant option. It will be ignored in documentation serialization.

","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore10OptionTypeO4flagyACSbcACmF":{"name":"flag(_:)","abstract":"

A boolean flag.

","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore10OptionTypeO6stringyACSScACmF":{"name":"string(_:)","abstract":"

A string option.

","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore10OptionTypeO6symbolyACSScACmF":{"name":"symbol(_:)","abstract":"

Like a string option but without quotes in the serialized output.

","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore10OptionTypeO7integeryACSicACmF":{"name":"integer(_:)","abstract":"

An integer option.

","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore10OptionTypeO5floatyACSdcACmF":{"name":"float(_:)","abstract":"

A floating point number option.

","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore10OptionTypeO8severityyAcA17ViolationSeverityOcACmF":{"name":"severity(_:)","abstract":"

Special option for a ViolationSeverity.

","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore10OptionTypeO4listyACSayACGcACmF":{"name":"list(_:)","abstract":"

A list of options.

","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore10OptionTypeO6nestedyAcA28RuleConfigurationDescriptionVcACmF":{"name":"nested(_:)","abstract":"

An option which is another set of configuration options to be nested in the serialized output.

","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore12DocumentableP10hasContentSbvp":{"name":"hasContent","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore12DocumentableP8markdownSSyF":{"name":"markdown()","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore12DocumentableP8oneLinerSSyF":{"name":"oneLiner()","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore12DocumentableP4yamlSSyF":{"name":"yaml()","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore10OptionTypeO2egoiyAA017RuleConfigurationD0VSS_ACtFZ":{"name":"=>(_:_:)","abstract":"

Operator enabling an easy way to create a configuration option.

","parent_name":"OptionType"},"Enums/OptionType.html#/s:13SwiftLintCore10OptionTypeO4nestyAcA28RuleConfigurationDescriptionVyXEFZ":{"name":"nest(_:)","abstract":"

Create an option defined by nested configuration description.

","parent_name":"OptionType"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO20invalidConfigurationyACSS_SSSgtcACmF":{"name":"invalidConfiguration(ruleID:message:)","abstract":"

The configuration didn’t match internal expectations.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO19invalidRegexPatternyACSS_SStcACmF":{"name":"invalidRegexPattern(ruleID:pattern:)","abstract":"

Issued when a regular expression pattern is invalid.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO29deprecatedConfigurationOptionyACSS_S2SSgtcACmF":{"name":"deprecatedConfigurationOption(ruleID:key:alternative:)","abstract":"

Issued when an option is deprecated. Suggests an alternative optionally.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO14nothingAppliedyACSS_tcACmF":{"name":"nothingApplied(ruleID:)","abstract":"

Used in configuration parsing when no changes have been applied. Use only internally!

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO18listedMultipleTimeyACSS_SitcACmF":{"name":"listedMultipleTime(ruleID:times:)","abstract":"

Rule is listed multiple times in the configuration.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO17renamedIdentifieryACSS_SStcACmF":{"name":"renamedIdentifier(old:new:)","abstract":"

An identifier old has been renamed to new.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO24invalidConfigurationKeysyACSS_ShySSGtcACmF":{"name":"invalidConfigurationKeys(ruleID:keys:)","abstract":"

Some configuration keys are invalid.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO25inconsistentConfigurationyACSS_SStcACmF":{"name":"inconsistentConfiguration(ruleID:message:)","abstract":"

The configuration is inconsistent, that is options are mutually exclusive or one drives other values","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO14invalidRuleIDsyACShySSGcACmF":{"name":"invalidRuleIDs(_:)","abstract":"

Used rule IDs are invalid.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO25ruleNotPresentInOnlyRulesyACSS_tcACmF":{"name":"ruleNotPresentInOnlyRules(ruleID:)","abstract":"

Found a rule configuration for a rule that is not present in only_rules.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO014ruleDisabledInF5RulesyACSS_tcACmF":{"name":"ruleDisabledInDisabledRules(ruleID:)","abstract":"

Found a rule configuration for a rule that is disabled.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO33ruleDisabledInParentConfigurationyACSS_tcACmF":{"name":"ruleDisabledInParentConfiguration(ruleID:)","abstract":"

Found a rule configuration for a rule that is disabled in the parent configuration.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO019ruleNotEnabledInOptH5RulesyACSS_tcACmF":{"name":"ruleNotEnabledInOptInRules(ruleID:)","abstract":"

Found a rule configuration for a rule that is not enabled in opt_in_rules.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO31ruleNotEnabledInParentOnlyRulesyACSS_tcACmF":{"name":"ruleNotEnabledInParentOnlyRules(ruleID:)","abstract":"

Found a rule configuration for a rule that is not enabled in parent only_rules.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO14genericWarningyACSScACmF":{"name":"genericWarning(_:)","abstract":"

A generic warning specified by a string.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO12genericErroryACSScACmF":{"name":"genericError(_:)","abstract":"

A generic error specified by a string.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO14ruleDeprecatedyACSS_tcACmF":{"name":"ruleDeprecated(ruleID:)","abstract":"

A deprecation warning for a rule.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO19initialFileNotFoundyACSS_tcACmF":{"name":"initialFileNotFound(path:)","abstract":"

The initial configuration file was not found.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO12fileNotFoundyACSS_tcACmF":{"name":"fileNotFound(path:)","abstract":"

A file at specified path was not found.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO15fileNotReadableyACSSSg_SStcACmF":{"name":"fileNotReadable(path:ruleID:)","abstract":"

The file at path is not readable or cannot be opened.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO15fileNotWritableyACSS_tcACmF":{"name":"fileNotWritable(path:)","abstract":"

The file at path is not writable.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO13indexingErroryACSSSg_SStcACmF":{"name":"indexingError(path:ruleID:)","abstract":"

The file at path cannot be indexed by a specific rule.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO24missingCompilerArgumentsyACSSSg_SStcACmF":{"name":"missingCompilerArguments(path:ruleID:)","abstract":"

No arguments were provided to compile a file at path within a specific rule.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO17missingCursorInfoyACSSSg_SStcACmF":{"name":"missingCursorInfo(path:ruleID:)","abstract":"

Cursor information cannot be extracted from a specific location.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO11yamlParsingyACSScACmF":{"name":"yamlParsing(_:)","abstract":"

An error that occurred when parsing YAML.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO19baselineNotReadableyACSS_tcACmF":{"name":"baselineNotReadable(path:)","abstract":"

The baseline file at path is not readable or cannot be opened.

","parent_name":"Issue"},"Enums/Issue.html#/s:13SwiftLintCore5IssueO5printyyF":{"name":"print()","abstract":"

Print the issue to the console.

","parent_name":"Issue"},"Enums/AccessControlLevel.html#/s:13SwiftLintCore18AccessControlLevelO7privateyA2CmF":{"name":"private","abstract":"

Accessible by the declaration’s immediate lexical scope.

","parent_name":"AccessControlLevel"},"Enums/AccessControlLevel.html#/s:13SwiftLintCore18AccessControlLevelO11fileprivateyA2CmF":{"name":"fileprivate","abstract":"

Accessible by the declaration’s same file.

","parent_name":"AccessControlLevel"},"Enums/AccessControlLevel.html#/s:13SwiftLintCore18AccessControlLevelO8internalyA2CmF":{"name":"internal","abstract":"

Accessible by the declaration’s same module, or modules importing it with the @testable attribute.

","parent_name":"AccessControlLevel"},"Enums/AccessControlLevel.html#/s:13SwiftLintCore18AccessControlLevelO7packageyA2CmF":{"name":"package","abstract":"

Accessible by all the modules defined in the same Swift package.

","parent_name":"AccessControlLevel"},"Enums/AccessControlLevel.html#/s:13SwiftLintCore18AccessControlLevelO6publicyA2CmF":{"name":"public","abstract":"

Accessible by the declaration’s same program.

","parent_name":"AccessControlLevel"},"Enums/AccessControlLevel.html#/s:13SwiftLintCore18AccessControlLevelO4openyA2CmF":{"name":"open","abstract":"

Accessible and customizable (via subclassing or overrides) by the declaration’s same program.

","parent_name":"AccessControlLevel"},"Enums/AccessControlLevel.html#/s:13SwiftLintCore18AccessControlLevelO11descriptionACSgSS_tcfc":{"name":"init(description:)","abstract":"

Initializes an access control level by its Swift source keyword value.

","parent_name":"AccessControlLevel"},"Enums/AccessControlLevel.html#/s:s23CustomStringConvertibleP11descriptionSSvp":{"name":"description","parent_name":"AccessControlLevel"},"Enums/AccessControlLevel.html#/s:13SwiftLintCore18AccessControlLevelO9isPrivateSbvp":{"name":"isPrivate","abstract":"

Returns true if is private or fileprivate

","parent_name":"AccessControlLevel"},"Enums/AccessControlLevel.html#/s:SL1loiySbx_xtFZ":{"name":"<(_:_:)","parent_name":"AccessControlLevel"},"Enums/AccessControlLevel.html":{"name":"AccessControlLevel","abstract":"

The accessibility of a Swift source declaration.

"},"Enums/Issue.html":{"name":"Issue","abstract":"

All possible SwiftLint issues which are printed as warnings by default.

"},"Enums/OptionType.html":{"name":"OptionType","abstract":"

Type of an option.

"},"Enums/RuleIdentifier.html":{"name":"RuleIdentifier","abstract":"

An identifier representing a SwiftLint rule, or all rules.

"},"Enums/RuleKind.html":{"name":"RuleKind","abstract":"

All the possible rule kinds (categories).

"},"Enums/RuleListError.html":{"name":"RuleListError","abstract":"

All possible rule list configuration errors.

"},"Enums/SwiftExpressionKind.html":{"name":"SwiftExpressionKind","abstract":"

The kind of expression for a contiguous set of Swift source tokens.

"},"Enums/ViolationSeverity.html":{"name":"ViolationSeverity","abstract":"

The magnitude of a StyleViolation.

"},"Enums/IdentifierDeclaration.html":{"name":"IdentifierDeclaration","abstract":"

An identifier declaration.

"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC13configurationxvp":{"name":"configuration","abstract":"

A rule’s configuration.

","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC4fileAA0aB4FileCvp":{"name":"file","abstract":"

The file from which the traversed syntax tree stems from.

","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC17locationConverter0aE0014SourceLocationH0Cvp":{"name":"locationConverter","abstract":"

A source location converter associated with the syntax tree being traversed.

","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC13configuration4fileACyxGx_AA0aB4FileCtcfc":{"name":"init(configuration:file:)","abstract":"

Initializer for a ViolationsSyntaxVisitor.

","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC10violationsSayAA21ReasonedRuleViolationVGvp":{"name":"violations","abstract":"

Positions in a source file where violations should be reported.

","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC21skippableDeclarationsSay0aE004DeclE8Protocol_pXpGvp":{"name":"skippableDeclarations","abstract":"

List of declaration types that shall be skipped while traversing the AST.

","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC5visity0aE00eF12ContinueKindOAE09ActorDeclE0VF":{"name":"visit(_:)","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC5visity0aE00eF12ContinueKindOAE09ClassDeclE0VF":{"name":"visit(_:)","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC5visity0aE00eF12ContinueKindOAE08EnumDeclE0VF":{"name":"visit(_:)","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC5visity0aE00eF12ContinueKindOAE013ExtensionDeclE0VF":{"name":"visit(_:)","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC5visity0aE00eF12ContinueKindOAE012FunctionDeclE0VF":{"name":"visit(_:)","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC5visity0aE00eF12ContinueKindOAE015InitializerDeclE0VF":{"name":"visit(_:)","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC5visity0aE00eF12ContinueKindOAE012ProtocolDeclE0VF":{"name":"visit(_:)","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC5visity0aE00eF12ContinueKindOAE010StructDeclE0VF":{"name":"visit(_:)","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC5visity0aE00eF12ContinueKindOAE013SubscriptDeclE0VF":{"name":"visit(_:)","parent_name":"ViolationsSyntaxVisitor"},"Classes/ViolationsSyntaxVisitor.html#/s:13SwiftLintCore23ViolationsSyntaxVisitorC5visity0aE00eF12ContinueKindOAE012VariableDeclE0VF":{"name":"visit(_:)","parent_name":"ViolationsSyntaxVisitor"},"Classes/DeclaredIdentifiersTrackingVisitor.html#/s:13SwiftLintCore34DeclaredIdentifiersTrackingVisitorC5Scopea":{"name":"Scope","abstract":"

A type that remembers the declared identifiers (in order) up to the current position in the code.

","parent_name":"DeclaredIdentifiersTrackingVisitor"},"Classes/DeclaredIdentifiersTrackingVisitor.html#/s:13SwiftLintCore34DeclaredIdentifiersTrackingVisitorC5scopeAA5StackVySayAA21IdentifierDeclarationOGGvp":{"name":"scope","abstract":"

The hierarchical stack of identifiers declared up to the current position in the code.

","parent_name":"DeclaredIdentifiersTrackingVisitor"},"Classes/DeclaredIdentifiersTrackingVisitor.html#/s:13SwiftLintCore34DeclaredIdentifiersTrackingVisitorC13configuration4file5scopeACyxGx_AA0aB4FileCAA5StackVySayAA21IdentifierDeclarationOGGtcfc":{"name":"init(configuration:file:scope:)","abstract":"

Initializer.

","parent_name":"DeclaredIdentifiersTrackingVisitor"},"Classes/DeclaredIdentifiersTrackingVisitor.html#/s:13SwiftLintCore34DeclaredIdentifiersTrackingVisitorC18hasSeenDeclaration3forSbSS_tF":{"name":"hasSeenDeclaration(for:)","abstract":"

Indicate whether a given identifier is in scope.

","parent_name":"DeclaredIdentifiersTrackingVisitor"},"Classes/DeclaredIdentifiersTrackingVisitor.html#/s:13SwiftLintCore34DeclaredIdentifiersTrackingVisitorC5visity0A6Syntax0iG12ContinueKindOAE017CodeBlockItemListI0VF":{"name":"visit(_:)","parent_name":"DeclaredIdentifiersTrackingVisitor"},"Classes/DeclaredIdentifiersTrackingVisitor.html#/s:13SwiftLintCore34DeclaredIdentifiersTrackingVisitorC9visitPostyy0A6Syntax017CodeBlockItemListJ0VF":{"name":"visitPost(_:)","parent_name":"DeclaredIdentifiersTrackingVisitor"},"Classes/DeclaredIdentifiersTrackingVisitor.html#/s:13SwiftLintCore34DeclaredIdentifiersTrackingVisitorC9visitPostyy0A6Syntax012VariableDeclJ0VF":{"name":"visitPost(_:)","parent_name":"DeclaredIdentifiersTrackingVisitor"},"Classes/DeclaredIdentifiersTrackingVisitor.html#/s:13SwiftLintCore34DeclaredIdentifiersTrackingVisitorC9visitPostyy0A6Syntax09GuardStmtJ0VF":{"name":"visitPost(_:)","parent_name":"DeclaredIdentifiersTrackingVisitor"},"Classes/DeclaredIdentifiersTrackingVisitor.html#/s:13SwiftLintCore34DeclaredIdentifiersTrackingVisitorC5visity0A6Syntax0iG12ContinueKindOAE011MemberBlockI0VF":{"name":"visit(_:)","parent_name":"DeclaredIdentifiersTrackingVisitor"},"Classes/DeclaredIdentifiersTrackingVisitor.html#/s:13SwiftLintCore34DeclaredIdentifiersTrackingVisitorC9visitPostyy0A6Syntax011MemberBlockJ0VF":{"name":"visitPost(_:)","parent_name":"DeclaredIdentifiersTrackingVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC13configuration4fileACyxGx_AA0aB4FileCtcfc":{"name":"init(configuration:file:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax012AccessorDeclI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax09ActorDeclI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax011CatchClauseI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax09ClassDeclI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax011ClosureExprI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax09DeferStmtI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax06DoStmtI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax08EnumDeclI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax013ExtensionDeclI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax012FunctionDeclI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax07ForStmtI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax09GuardStmtI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax06IfExprI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax015InitializerDeclI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax014PatternBindingI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax019PrecedenceGroupDeclI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax012ProtocolDeclI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax010RepeatStmtI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax010StructDeclI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax010SwitchExprI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC9visitPostyy0A6Syntax09WhileStmtI0VF":{"name":"visitPost(_:)","parent_name":"CodeBlockVisitor"},"Classes/CodeBlockVisitor.html#/s:13SwiftLintCore16CodeBlockVisitorC17collectViolations3foryqd__Sg_t0A6Syntax06BracedJ0Rd__lF":{"name":"collectViolations(for:)","abstract":"

Collects violations for the given braced item. Intended to be specialized by subclasses.

","parent_name":"CodeBlockVisitor"},"Classes/BodyLengthRuleVisitor/Kind.html#/s:13SwiftLintCore21BodyLengthRuleVisitorC4KindO7closureyAEyx_GAGmAA0F0RzlF":{"name":"closure","abstract":"

Closure code blocks.

","parent_name":"Kind"},"Classes/BodyLengthRuleVisitor/Kind.html#/s:13SwiftLintCore21BodyLengthRuleVisitorC4KindO8functionyAEyx_GAGmAA0F0RzlF":{"name":"function","abstract":"

Function body blocks.

","parent_name":"Kind"},"Classes/BodyLengthRuleVisitor/Kind.html#/s:13SwiftLintCore21BodyLengthRuleVisitorC4KindO4typeyAEyx_GAGmAA0F0RzlF":{"name":"type","abstract":"

Type (class, enum, …) member blocks.

","parent_name":"Kind"},"Classes/BodyLengthRuleVisitor/Kind.html":{"name":"Kind","abstract":"

The code block types to check.

","parent_name":"BodyLengthRuleVisitor"},"Classes/BodyLengthRuleVisitor.html#/s:13SwiftLintCore21BodyLengthRuleVisitorC4kind4file13configurationACyxGAC4KindOyx_G_AA0aB4FileCAA27SeverityLevelsConfigurationVyxGtcfc":{"name":"init(kind:file:configuration:)","abstract":"

Initializer.

","parent_name":"BodyLengthRuleVisitor"},"Classes/BodyLengthRuleVisitor.html#/s:13SwiftLintCore21BodyLengthRuleVisitorC9visitPostyy0A6Syntax08EnumDeclJ0VF":{"name":"visitPost(_:)","parent_name":"BodyLengthRuleVisitor"},"Classes/BodyLengthRuleVisitor.html#/s:13SwiftLintCore21BodyLengthRuleVisitorC9visitPostyy0A6Syntax09ClassDeclJ0VF":{"name":"visitPost(_:)","parent_name":"BodyLengthRuleVisitor"},"Classes/BodyLengthRuleVisitor.html#/s:13SwiftLintCore21BodyLengthRuleVisitorC9visitPostyy0A6Syntax010StructDeclJ0VF":{"name":"visitPost(_:)","parent_name":"BodyLengthRuleVisitor"},"Classes/BodyLengthRuleVisitor.html#/s:13SwiftLintCore21BodyLengthRuleVisitorC9visitPostyy0A6Syntax09ActorDeclJ0VF":{"name":"visitPost(_:)","parent_name":"BodyLengthRuleVisitor"},"Classes/BodyLengthRuleVisitor.html#/s:13SwiftLintCore21BodyLengthRuleVisitorC9visitPostyy0A6Syntax011ClosureExprJ0VF":{"name":"visitPost(_:)","parent_name":"BodyLengthRuleVisitor"},"Classes/BodyLengthRuleVisitor.html#/s:13SwiftLintCore21BodyLengthRuleVisitorC9visitPostyy0A6Syntax012FunctionDeclJ0VF":{"name":"visitPost(_:)","parent_name":"BodyLengthRuleVisitor"},"Classes/BodyLengthRuleVisitor.html#/s:13SwiftLintCore21BodyLengthRuleVisitorC9visitPostyy0A6Syntax015InitializerDeclJ0VF":{"name":"visitPost(_:)","parent_name":"BodyLengthRuleVisitor"},"Classes/CodeIndentingRewriter/IndentationStyle.html#/s:13SwiftLintCore21CodeIndentingRewriterC16IndentationStyleO12indentSpacesyAESicAEmF":{"name":"indentSpaces(_:)","abstract":"

Indentation with a number of spaces.

","parent_name":"IndentationStyle"},"Classes/CodeIndentingRewriter/IndentationStyle.html#/s:13SwiftLintCore21CodeIndentingRewriterC16IndentationStyleO14unindentSpacesyAESicAEmF":{"name":"unindentSpaces(_:)","abstract":"

Reverse indentation of a number of spaces.

","parent_name":"IndentationStyle"},"Classes/CodeIndentingRewriter/IndentationStyle.html#/s:13SwiftLintCore21CodeIndentingRewriterC16IndentationStyleO10indentTabsyAESicAEmF":{"name":"indentTabs(_:)","abstract":"

Indentation with a number of tabs

","parent_name":"IndentationStyle"},"Classes/CodeIndentingRewriter/IndentationStyle.html#/s:13SwiftLintCore21CodeIndentingRewriterC16IndentationStyleO12unindentTabsyAESicAEmF":{"name":"unindentTabs(_:)","abstract":"

Reverse indentation of a number of tabs.

","parent_name":"IndentationStyle"},"Classes/CodeIndentingRewriter/IndentationStyle.html":{"name":"IndentationStyle","abstract":"

Style defining whether the rewriter shall indent or unindent and whether it shall use tabs or spaces and","parent_name":"CodeIndentingRewriter"},"Classes/CodeIndentingRewriter.html#/s:13SwiftLintCore21CodeIndentingRewriterC5styleA2C16IndentationStyleO_tcfc":{"name":"init(style:)","abstract":"

Initializer accepting an indentation style.

","parent_name":"CodeIndentingRewriter"},"Classes/CodeIndentingRewriter.html#/s:13SwiftLintCore21CodeIndentingRewriterC5visity0A6Syntax05TokenH0VAGF":{"name":"visit(_:)","parent_name":"CodeIndentingRewriter"},"Classes/ViolationsSyntaxRewriter.html#/s:13SwiftLintCore24ViolationsSyntaxRewriterC13configurationxvp":{"name":"configuration","abstract":"

A rule’s configuration.

","parent_name":"ViolationsSyntaxRewriter"},"Classes/ViolationsSyntaxRewriter.html#/s:13SwiftLintCore24ViolationsSyntaxRewriterC4fileAA0aB4FileCvp":{"name":"file","abstract":"

The file from which the traversed syntax tree stems from.

","parent_name":"ViolationsSyntaxRewriter"},"Classes/ViolationsSyntaxRewriter.html#/s:13SwiftLintCore24ViolationsSyntaxRewriterC17locationConverter0aE0014SourceLocationH0Cvp":{"name":"locationConverter","abstract":"

A converter of positions in the traversed source file.

","parent_name":"ViolationsSyntaxRewriter"},"Classes/ViolationsSyntaxRewriter.html#/s:13SwiftLintCore24ViolationsSyntaxRewriterC15disabledRegionsSay0aE011SourceRangeVGvp":{"name":"disabledRegions","abstract":"

The regions in the traversed file that are disabled by a command.

","parent_name":"ViolationsSyntaxRewriter"},"Classes/ViolationsSyntaxRewriter.html#/s:13SwiftLintCore24ViolationsSyntaxRewriterC19correctionPositionsSay0aE016AbsolutePositionVGvp":{"name":"correctionPositions","abstract":"

Positions in a source file where corrections were applied.

","parent_name":"ViolationsSyntaxRewriter"},"Classes/ViolationsSyntaxRewriter.html#/s:13SwiftLintCore24ViolationsSyntaxRewriterC13configuration4fileACyxGx_AA0aB4FileCtcfc":{"name":"init(configuration:file:)","abstract":"

Initializer for a ViolationsSyntaxRewriter.

","parent_name":"ViolationsSyntaxRewriter"},"Classes/ViolationsSyntaxRewriter.html#/s:13SwiftLintCore24ViolationsSyntaxRewriterC8visitAnyy0aE00E0VSgAGF":{"name":"visitAny(_:)","parent_name":"ViolationsSyntaxRewriter"},"Classes/SwiftLintFile.html#/s:13SwiftLintCore0aB4FileC4file21SourceKittenFramework0D0Cvp":{"name":"file","abstract":"

The underlying SourceKitten file.

","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:13SwiftLintCore0aB4FileC2id10Foundation4UUIDVvp":{"name":"id","abstract":"

The associated unique identifier for this file.

","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:13SwiftLintCore0aB4FileC06isTestD0Sbvp":{"name":"isTestFile","abstract":"

Whether or not this is a file generated for testing purposes.

","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:13SwiftLintCore0aB4FileC9isVirtualSbvp":{"name":"isVirtual","abstract":"

A file is virtual if it is not backed by a filesystem path.

","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:13SwiftLintCore0aB4FileC4file06isTestD00F7VirtualAC21SourceKittenFramework0D0C_S2btcfc":{"name":"init(file:isTestFile:isVirtual:)","abstract":"

Creates a SwiftLintFile with a SourceKitten File.

","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:13SwiftLintCore0aB4FileC4path06isTestD0ACSgSS_Sbtcfc":{"name":"init(path:isTestFile:)","abstract":"

Creates a SwiftLintFile by specifying its path on disk.","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:13SwiftLintCore0aB4FileC20pathDeferringReadingACSS_tcfc":{"name":"init(pathDeferringReading:)","abstract":"

Creates a SwiftLintFile by specifying its path on disk. Unlike the SwiftLintFile(path:) initializer, this","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:13SwiftLintCore0aB4FileC8contents06isTestD0ACSS_Sbtcfc":{"name":"init(contents:isTestFile:)","abstract":"

Creates a SwiftLintFile that is not backed by a file on disk by specifying its contents.

","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:13SwiftLintCore0aB4FileC4pathSSSgvp":{"name":"path","abstract":"

The path on disk for this file.

","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:13SwiftLintCore0aB4FileC8contentsSSvp":{"name":"contents","abstract":"

The file’s contents.

","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:13SwiftLintCore0aB4FileC10stringView21SourceKittenFramework06StringF0Vvp":{"name":"stringView","abstract":"

A string view into the contents of this file optimized for string manipulation operations.

","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:13SwiftLintCore0aB4FileC5linesSay21SourceKittenFramework4LineVGvp":{"name":"lines","abstract":"

The parsed lines for this file’s contents.

","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:SQ2eeoiySbx_xtFZ":{"name":"==(_:_:)","parent_name":"SwiftLintFile"},"Classes/SwiftLintFile.html#/s:SH4hash4intoys6HasherVz_tF":{"name":"hash(into:)","parent_name":"SwiftLintFile"},"Classes/RuleStorage.html#/s:s23CustomStringConvertibleP11descriptionSSvp":{"name":"description","parent_name":"RuleStorage"},"Classes/RuleStorage.html#/s:13SwiftLintCore11RuleStorageCACycfc":{"name":"init()","abstract":"

Creates a RuleStorage with no initial stored data.

","parent_name":"RuleStorage"},"Classes/RuleRegistry.html#/s:13SwiftLintCore12RuleRegistryC6sharedACvpZ":{"name":"shared","abstract":"

Shared rule registry instance.

","parent_name":"RuleRegistry"},"Classes/RuleRegistry.html#/s:13SwiftLintCore12RuleRegistryC4listAA0D4ListVvp":{"name":"list","abstract":"

Rule list associated with this registry. Lazily created, and","parent_name":"RuleRegistry"},"Classes/RuleRegistry.html#/s:13SwiftLintCore12RuleRegistryC8register5rulesySayAA0D0_pXpG_tF":{"name":"register(rules:)","abstract":"

Register rules.

","parent_name":"RuleRegistry"},"Classes/RuleRegistry.html#/s:13SwiftLintCore12RuleRegistryC4rule5forIDAA0D0_pXpSgSS_tF":{"name":"rule(forID:)","abstract":"

Look up a rule for a given ID.

","parent_name":"RuleRegistry"},"Classes/RuleRegistry.html":{"name":"RuleRegistry","abstract":"

Container to register and look up SwiftLint rules.

"},"Classes/RuleStorage.html":{"name":"RuleStorage","abstract":"

A storage mechanism for aggregating the results of CollectingRules.

"},"Classes/SwiftLintFile.html":{"name":"SwiftLintFile","abstract":"

A unit of Swift source code, either on disk or in memory.

"},"Classes/ViolationsSyntaxRewriter.html":{"name":"ViolationsSyntaxRewriter","abstract":"

A SwiftSyntax SyntaxRewriter that produces absolute positions where corrections were applied.

"},"Classes/CodeIndentingRewriter.html":{"name":"CodeIndentingRewriter","abstract":"

Rewriter that indents or unindents a syntax piece including comments and nested"},"Classes/BodyLengthRuleVisitor.html":{"name":"BodyLengthRuleVisitor","abstract":"

Visitor that collection violations of code block lengths.

"},"Classes/CodeBlockVisitor.html":{"name":"CodeBlockVisitor","abstract":"

A visitor that collects style violations for all available code blocks.

"},"Classes/DeclaredIdentifiersTrackingVisitor.html":{"name":"DeclaredIdentifiersTrackingVisitor","abstract":"

A specialized ViolationsSyntaxVisitor that tracks declared identifiers per scope while traversing the AST.

"},"Classes/ViolationsSyntaxVisitor.html":{"name":"ViolationsSyntaxVisitor","abstract":"

A SwiftSyntax SyntaxVisitor that produces absolute positions where violations should be reported.

"},"swift-syntax-dashboard.html":{"name":"Swift Syntax Dashboard"},"accessibility_label_for_image.html":{"name":"accessibility_label_for_image"},"accessibility_trait_for_button.html":{"name":"accessibility_trait_for_button"},"anonymous_argument_in_multiline_closure.html":{"name":"anonymous_argument_in_multiline_closure"},"array_init.html":{"name":"array_init"},"async_without_await.html":{"name":"async_without_await"},"attribute_name_spacing.html":{"name":"attribute_name_spacing"},"attributes.html":{"name":"attributes"},"balanced_xctest_lifecycle.html":{"name":"balanced_xctest_lifecycle"},"blanket_disable_command.html":{"name":"blanket_disable_command"},"block_based_kvo.html":{"name":"block_based_kvo"},"capture_variable.html":{"name":"capture_variable"},"class_delegate_protocol.html":{"name":"class_delegate_protocol"},"closing_brace.html":{"name":"closing_brace"},"closure_body_length.html":{"name":"closure_body_length"},"closure_end_indentation.html":{"name":"closure_end_indentation"},"closure_parameter_position.html":{"name":"closure_parameter_position"},"closure_spacing.html":{"name":"closure_spacing"},"collection_alignment.html":{"name":"collection_alignment"},"colon.html":{"name":"colon"},"comma.html":{"name":"comma"},"comma_inheritance.html":{"name":"comma_inheritance"},"comment_spacing.html":{"name":"comment_spacing"},"compiler_protocol_init.html":{"name":"compiler_protocol_init"},"computed_accessors_order.html":{"name":"computed_accessors_order"},"conditional_returns_on_newline.html":{"name":"conditional_returns_on_newline"},"contains_over_filter_count.html":{"name":"contains_over_filter_count"},"contains_over_filter_is_empty.html":{"name":"contains_over_filter_is_empty"},"contains_over_first_not_nil.html":{"name":"contains_over_first_not_nil"},"contains_over_range_nil_comparison.html":{"name":"contains_over_range_nil_comparison"},"contrasted_opening_brace.html":{"name":"contrasted_opening_brace"},"control_statement.html":{"name":"control_statement"},"convenience_type.html":{"name":"convenience_type"},"custom_rules.html":{"name":"custom_rules"},"cyclomatic_complexity.html":{"name":"cyclomatic_complexity"},"deployment_target.html":{"name":"deployment_target"},"direct_return.html":{"name":"direct_return"},"discarded_notification_center_observer.html":{"name":"discarded_notification_center_observer"},"discouraged_assert.html":{"name":"discouraged_assert"},"discouraged_direct_init.html":{"name":"discouraged_direct_init"},"discouraged_none_name.html":{"name":"discouraged_none_name"},"discouraged_object_literal.html":{"name":"discouraged_object_literal"},"discouraged_optional_boolean.html":{"name":"discouraged_optional_boolean"},"discouraged_optional_collection.html":{"name":"discouraged_optional_collection"},"duplicate_conditions.html":{"name":"duplicate_conditions"},"duplicate_enum_cases.html":{"name":"duplicate_enum_cases"},"duplicate_imports.html":{"name":"duplicate_imports"},"duplicated_key_in_dictionary_literal.html":{"name":"duplicated_key_in_dictionary_literal"},"dynamic_inline.html":{"name":"dynamic_inline"},"empty_collection_literal.html":{"name":"empty_collection_literal"},"empty_count.html":{"name":"empty_count"},"empty_enum_arguments.html":{"name":"empty_enum_arguments"},"empty_parameters.html":{"name":"empty_parameters"},"empty_parentheses_with_trailing_closure.html":{"name":"empty_parentheses_with_trailing_closure"},"empty_string.html":{"name":"empty_string"},"empty_xctest_method.html":{"name":"empty_xctest_method"},"enum_case_associated_values_count.html":{"name":"enum_case_associated_values_count"},"expiring_todo.html":{"name":"expiring_todo"},"explicit_acl.html":{"name":"explicit_acl"},"explicit_enum_raw_value.html":{"name":"explicit_enum_raw_value"},"explicit_init.html":{"name":"explicit_init"},"explicit_self.html":{"name":"explicit_self"},"explicit_top_level_acl.html":{"name":"explicit_top_level_acl"},"explicit_type_interface.html":{"name":"explicit_type_interface"},"extension_access_modifier.html":{"name":"extension_access_modifier"},"fallthrough.html":{"name":"fallthrough"},"fatal_error_message.html":{"name":"fatal_error_message"},"file_header.html":{"name":"file_header"},"file_length.html":{"name":"file_length"},"file_name.html":{"name":"file_name"},"file_name_no_space.html":{"name":"file_name_no_space"},"file_types_order.html":{"name":"file_types_order"},"final_test_case.html":{"name":"final_test_case"},"first_where.html":{"name":"first_where"},"flatmap_over_map_reduce.html":{"name":"flatmap_over_map_reduce"},"for_where.html":{"name":"for_where"},"force_cast.html":{"name":"force_cast"},"force_try.html":{"name":"force_try"},"force_unwrapping.html":{"name":"force_unwrapping"},"function_body_length.html":{"name":"function_body_length"},"function_default_parameter_at_end.html":{"name":"function_default_parameter_at_end"},"function_parameter_count.html":{"name":"function_parameter_count"},"generic_type_name.html":{"name":"generic_type_name"},"ibinspectable_in_extension.html":{"name":"ibinspectable_in_extension"},"identical_operands.html":{"name":"identical_operands"},"identifier_name.html":{"name":"identifier_name"},"implicit_getter.html":{"name":"implicit_getter"},"implicit_return.html":{"name":"implicit_return"},"implicitly_unwrapped_optional.html":{"name":"implicitly_unwrapped_optional"},"inclusive_language.html":{"name":"inclusive_language"},"indentation_width.html":{"name":"indentation_width"},"invalid_swiftlint_command.html":{"name":"invalid_swiftlint_command"},"is_disjoint.html":{"name":"is_disjoint"},"joined_default_parameter.html":{"name":"joined_default_parameter"},"large_tuple.html":{"name":"large_tuple"},"last_where.html":{"name":"last_where"},"leading_whitespace.html":{"name":"leading_whitespace"},"legacy_cggeometry_functions.html":{"name":"legacy_cggeometry_functions"},"legacy_constant.html":{"name":"legacy_constant"},"legacy_constructor.html":{"name":"legacy_constructor"},"legacy_hashing.html":{"name":"legacy_hashing"},"legacy_multiple.html":{"name":"legacy_multiple"},"legacy_nsgeometry_functions.html":{"name":"legacy_nsgeometry_functions"},"legacy_objc_type.html":{"name":"legacy_objc_type"},"legacy_random.html":{"name":"legacy_random"},"let_var_whitespace.html":{"name":"let_var_whitespace"},"line_length.html":{"name":"line_length"},"literal_expression_end_indentation.html":{"name":"literal_expression_end_indentation"},"local_doc_comment.html":{"name":"local_doc_comment"},"lower_acl_than_parent.html":{"name":"lower_acl_than_parent"},"mark.html":{"name":"mark"},"missing_docs.html":{"name":"missing_docs"},"modifier_order.html":{"name":"modifier_order"},"multiline_arguments.html":{"name":"multiline_arguments"},"multiline_arguments_brackets.html":{"name":"multiline_arguments_brackets"},"multiline_function_chains.html":{"name":"multiline_function_chains"},"multiline_literal_brackets.html":{"name":"multiline_literal_brackets"},"multiline_parameters.html":{"name":"multiline_parameters"},"multiline_parameters_brackets.html":{"name":"multiline_parameters_brackets"},"multiple_closures_with_trailing_closure.html":{"name":"multiple_closures_with_trailing_closure"},"nesting.html":{"name":"nesting"},"nimble_operator.html":{"name":"nimble_operator"},"no_empty_block.html":{"name":"no_empty_block"},"no_extension_access_modifier.html":{"name":"no_extension_access_modifier"},"no_fallthrough_only.html":{"name":"no_fallthrough_only"},"no_grouping_extension.html":{"name":"no_grouping_extension"},"no_magic_numbers.html":{"name":"no_magic_numbers"},"no_space_in_method_call.html":{"name":"no_space_in_method_call"},"non_optional_string_data_conversion.html":{"name":"non_optional_string_data_conversion"},"non_overridable_class_declaration.html":{"name":"non_overridable_class_declaration"},"notification_center_detachment.html":{"name":"notification_center_detachment"},"ns_number_init_as_function_reference.html":{"name":"ns_number_init_as_function_reference"},"nslocalizedstring_key.html":{"name":"nslocalizedstring_key"},"nslocalizedstring_require_bundle.html":{"name":"nslocalizedstring_require_bundle"},"nsobject_prefer_isequal.html":{"name":"nsobject_prefer_isequal"},"number_separator.html":{"name":"number_separator"},"object_literal.html":{"name":"object_literal"},"one_declaration_per_file.html":{"name":"one_declaration_per_file"},"opening_brace.html":{"name":"opening_brace"},"operator_usage_whitespace.html":{"name":"operator_usage_whitespace"},"operator_whitespace.html":{"name":"operator_whitespace"},"optional_data_string_conversion.html":{"name":"optional_data_string_conversion"},"optional_enum_case_matching.html":{"name":"optional_enum_case_matching"},"orphaned_doc_comment.html":{"name":"orphaned_doc_comment"},"overridden_super_call.html":{"name":"overridden_super_call"},"override_in_extension.html":{"name":"override_in_extension"},"pattern_matching_keywords.html":{"name":"pattern_matching_keywords"},"period_spacing.html":{"name":"period_spacing"},"prefer_key_path.html":{"name":"prefer_key_path"},"prefer_nimble.html":{"name":"prefer_nimble"},"prefer_self_in_static_references.html":{"name":"prefer_self_in_static_references"},"prefer_self_type_over_type_of_self.html":{"name":"prefer_self_type_over_type_of_self"},"prefer_type_checking.html":{"name":"prefer_type_checking"},"prefer_zero_over_explicit_init.html":{"name":"prefer_zero_over_explicit_init"},"prefixed_toplevel_constant.html":{"name":"prefixed_toplevel_constant"},"private_action.html":{"name":"private_action"},"private_outlet.html":{"name":"private_outlet"},"private_over_fileprivate.html":{"name":"private_over_fileprivate"},"private_subject.html":{"name":"private_subject"},"private_swiftui_state.html":{"name":"private_swiftui_state"},"private_unit_test.html":{"name":"private_unit_test"},"prohibited_interface_builder.html":{"name":"prohibited_interface_builder"},"prohibited_super_call.html":{"name":"prohibited_super_call"},"protocol_property_accessors_order.html":{"name":"protocol_property_accessors_order"},"quick_discouraged_call.html":{"name":"quick_discouraged_call"},"quick_discouraged_focused_test.html":{"name":"quick_discouraged_focused_test"},"quick_discouraged_pending_test.html":{"name":"quick_discouraged_pending_test"},"raw_value_for_camel_cased_codable_enum.html":{"name":"raw_value_for_camel_cased_codable_enum"},"reduce_boolean.html":{"name":"reduce_boolean"},"reduce_into.html":{"name":"reduce_into"},"redundant_discardable_let.html":{"name":"redundant_discardable_let"},"redundant_nil_coalescing.html":{"name":"redundant_nil_coalescing"},"redundant_objc_attribute.html":{"name":"redundant_objc_attribute"},"redundant_optional_initialization.html":{"name":"redundant_optional_initialization"},"redundant_self_in_closure.html":{"name":"redundant_self_in_closure"},"redundant_sendable.html":{"name":"redundant_sendable"},"redundant_set_access_control.html":{"name":"redundant_set_access_control"},"redundant_string_enum_value.html":{"name":"redundant_string_enum_value"},"redundant_type_annotation.html":{"name":"redundant_type_annotation"},"redundant_void_return.html":{"name":"redundant_void_return"},"required_deinit.html":{"name":"required_deinit"},"required_enum_case.html":{"name":"required_enum_case"},"return_arrow_whitespace.html":{"name":"return_arrow_whitespace"},"return_value_from_void_function.html":{"name":"return_value_from_void_function"},"self_binding.html":{"name":"self_binding"},"self_in_property_initialization.html":{"name":"self_in_property_initialization"},"shorthand_argument.html":{"name":"shorthand_argument"},"shorthand_operator.html":{"name":"shorthand_operator"},"shorthand_optional_binding.html":{"name":"shorthand_optional_binding"},"single_test_class.html":{"name":"single_test_class"},"sorted_enum_cases.html":{"name":"sorted_enum_cases"},"sorted_first_last.html":{"name":"sorted_first_last"},"sorted_imports.html":{"name":"sorted_imports"},"statement_position.html":{"name":"statement_position"},"static_operator.html":{"name":"static_operator"},"static_over_final_class.html":{"name":"static_over_final_class"},"strict_fileprivate.html":{"name":"strict_fileprivate"},"strong_iboutlet.html":{"name":"strong_iboutlet"},"superfluous_disable_command.html":{"name":"superfluous_disable_command"},"superfluous_else.html":{"name":"superfluous_else"},"switch_case_alignment.html":{"name":"switch_case_alignment"},"switch_case_on_newline.html":{"name":"switch_case_on_newline"},"syntactic_sugar.html":{"name":"syntactic_sugar"},"test_case_accessibility.html":{"name":"test_case_accessibility"},"todo.html":{"name":"todo"},"toggle_bool.html":{"name":"toggle_bool"},"trailing_closure.html":{"name":"trailing_closure"},"trailing_comma.html":{"name":"trailing_comma"},"trailing_newline.html":{"name":"trailing_newline"},"trailing_semicolon.html":{"name":"trailing_semicolon"},"trailing_whitespace.html":{"name":"trailing_whitespace"},"type_body_length.html":{"name":"type_body_length"},"type_contents_order.html":{"name":"type_contents_order"},"type_name.html":{"name":"type_name"},"typesafe_array_init.html":{"name":"typesafe_array_init"},"unavailable_condition.html":{"name":"unavailable_condition"},"unavailable_function.html":{"name":"unavailable_function"},"unhandled_throwing_task.html":{"name":"unhandled_throwing_task"},"unneeded_break_in_switch.html":{"name":"unneeded_break_in_switch"},"unneeded_override.html":{"name":"unneeded_override"},"unneeded_parentheses_in_closure_argument.html":{"name":"unneeded_parentheses_in_closure_argument"},"unneeded_synthesized_initializer.html":{"name":"unneeded_synthesized_initializer"},"unowned_variable_capture.html":{"name":"unowned_variable_capture"},"untyped_error_in_catch.html":{"name":"untyped_error_in_catch"},"unused_closure_parameter.html":{"name":"unused_closure_parameter"},"unused_control_flow_label.html":{"name":"unused_control_flow_label"},"unused_declaration.html":{"name":"unused_declaration"},"unused_enumerated.html":{"name":"unused_enumerated"},"unused_import.html":{"name":"unused_import"},"unused_optional_binding.html":{"name":"unused_optional_binding"},"unused_parameter.html":{"name":"unused_parameter"},"unused_setter_value.html":{"name":"unused_setter_value"},"valid_ibinspectable.html":{"name":"valid_ibinspectable"},"vertical_parameter_alignment.html":{"name":"vertical_parameter_alignment"},"vertical_parameter_alignment_on_call.html":{"name":"vertical_parameter_alignment_on_call"},"vertical_whitespace.html":{"name":"vertical_whitespace"},"vertical_whitespace_between_cases.html":{"name":"vertical_whitespace_between_cases"},"vertical_whitespace_closing_braces.html":{"name":"vertical_whitespace_closing_braces"},"vertical_whitespace_opening_braces.html":{"name":"vertical_whitespace_opening_braces"},"void_function_in_ternary.html":{"name":"void_function_in_ternary"},"void_return.html":{"name":"void_return"},"weak_delegate.html":{"name":"weak_delegate"},"xct_specific_matcher.html":{"name":"xct_specific_matcher"},"xctfail_message.html":{"name":"xctfail_message"},"yoda_condition.html":{"name":"yoda_condition"},"rule-directory.html":{"name":"Rule Directory"},"Rules.html":{"name":"Rules"},"Guides.html":{"name":"Guides","abstract":"

The following guides are available globally.

"},"Classes.html":{"name":"Classes","abstract":"

The following classes are available globally.

"},"Enums.html":{"name":"Enumerations","abstract":"

The following enumerations are available globally.

"},"Extensions.html":{"name":"Extensions","abstract":"

The following extensions are available globally.

"},"Protocols.html":{"name":"Protocols","abstract":"

The following protocols are available globally.

"},"Structs.html":{"name":"Structures","abstract":"

The following structures are available globally.

"},"Macros.html":{"name":"Macros","abstract":"

The following macros are available globally.

"}} \ No newline at end of file diff --git a/self_binding.html b/self_binding.html new file mode 100644 index 000000000..367349a4b --- /dev/null +++ b/self_binding.html @@ -0,0 +1,438 @@ + + + + self_binding Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Self Binding

+ +

Re-bind self to a consistent identifier name.

+ +
    +
  • Identifier: self_binding
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +bind_identifier + +“self” +
  • +
+

Non Triggering Examples

+
if let self = self { return }
+
+
guard let self = self else { return }
+
+
if let this = this { return }
+
+
guard let this = this else { return }
+
+
//
+// bind_identifier: "this"
+//
+
+if let this = self { return }
+
+
+
//
+// bind_identifier: "this"
+//
+
+guard let this = self else { return }
+
+
+

Triggering Examples

+
if let ↓`self` = self { return }
+
+
guard let ↓`self` = self else { return }
+
+
if let ↓this = self { return }
+
+
guard let ↓this = self else { return }
+
+
//
+// bind_identifier: "this"
+//
+
+if let ↓self = self { return }
+
+
+
//
+// bind_identifier: "this"
+//
+
+guard let ↓self = self else { return }
+
+
+
//
+// bind_identifier: "this"
+//
+
+if let ↓self { return }
+
+
+
//
+// bind_identifier: "this"
+//
+
+guard let ↓self else { return }
+
+
+ +
+
+ + +
+
+ + + diff --git a/self_in_property_initialization.html b/self_in_property_initialization.html new file mode 100644 index 000000000..149f9cb7c --- /dev/null +++ b/self_in_property_initialization.html @@ -0,0 +1,420 @@ + + + + self_in_property_initialization Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Self in Property Initialization

+ +

self refers to the unapplied NSObject.self() method, which is likely not expected; make the variable lazy to be able to refer to the current instance or use ClassName.self

+ +
    +
  • Identifier: self_in_property_initialization
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class View: UIView {
+    let button: UIButton = {
+        return UIButton()
+    }()
+}
+
+
class View: UIView {
+    lazy var button: UIButton = {
+        let button = UIButton()
+        button.addTarget(self, action: #selector(didTapButton), for: .touchUpInside)
+        return button
+    }()
+}
+
+
class View: UIView {
+    var button: UIButton = {
+        let button = UIButton()
+        button.addTarget(otherObject, action: #selector(didTapButton), for: .touchUpInside)
+        return button
+    }()
+}
+
+
class View: UIView {
+    private let collectionView: UICollectionView = {
+        let layout = UICollectionViewFlowLayout()
+        let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
+        collectionView.registerReusable(Cell.self)
+
+        return collectionView
+    }()
+}
+
+

Triggering Examples

+
class View: UIView {
+    ↓var button: UIButton = {
+        let button = UIButton()
+        button.addTarget(self, action: #selector(didTapButton), for: .touchUpInside)
+        return button
+    }()
+}
+
+
class View: UIView {
+    ↓let button: UIButton = {
+        let button = UIButton()
+        button.addTarget(self, action: #selector(didTapButton), for: .touchUpInside)
+        return button
+    }()
+}
+
+ +
+
+ + +
+
+ + + diff --git a/shorthand_argument.html b/shorthand_argument.html new file mode 100644 index 000000000..270adabcb --- /dev/null +++ b/shorthand_argument.html @@ -0,0 +1,457 @@ + + + + shorthand_argument Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Shorthand Argument

+ +

Shorthand arguments like $0, $1, etc. in closures can be confusing. Avoid using them too far away from the beginning of the closure. Optionally, while usage of a single shorthand argument is okay, more than one or complex ones with field accesses might increase the risk of obfuscation.

+ +
    +
  • Identifier: shorthand_argument
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +allow_until_line_after_opening_brace + +4 +
    +always_disallow_more_than_one + +false +
    +always_disallow_member_access + +false +
  • +
+

Non Triggering Examples

+
f { $0 }
+
+
f {
+    $0
+  + $1
+  + $2
+}
+
+
f { $0.a + $0.b }
+
+
//
+// allow_until_line_after_opening_brace: 1
+//
+
+f {
+    $0
+  +  g { $0 }
+
+
+

Triggering Examples

+
f {
+    $0
+  + $1
+  + $2
+
+  + ↓$0
+}
+
+
//
+// allow_until_line_after_opening_brace: 5
+//
+
+f {
+    $0
+  + $1
+  + $2
+  +  5
+  + $0
+  + ↓$1
+}
+
+
+
//
+// always_disallow_more_than_one: true
+//
+
+f { ↓$0 + ↓$1 }
+
+
+
//
+// allow_until_line_after_opening_brace: 3
+// always_disallow_member_access: true
+//
+
+f {
+    ↓$0.a
+  + ↓$0.b
+  + $1
+  + ↓$2.c
+}
+
+
+ +
+
+ + +
+
+ + + diff --git a/shorthand_operator.html b/shorthand_operator.html new file mode 100644 index 000000000..bb1305fc5 --- /dev/null +++ b/shorthand_operator.html @@ -0,0 +1,413 @@ + + + + shorthand_operator Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Shorthand Operator

+ +

Prefer shorthand operators (+=, -=, *=, /=) over doing the operation and assigning

+ +
    +
  • Identifier: shorthand_operator
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +error +
  • +
+

Non Triggering Examples

+
foo -= 1
+
+
foo += variable
+
+
foo *= bar.method()
+
+
self.foo = foo / 1
+
+
foo = self.foo + 1
+
+
page = ceilf(currentOffset * pageWidth)
+
+
foo = aMethod(foo / bar)
+
+
foo = aMethod(bar + foo)
+
+
public func -= (lhs: inout Foo, rhs: Int) {
+    lhs = lhs - rhs
+}
+
+
var helloWorld = "world!"
+ helloWorld = "Hello, " + helloWorld
+
+
angle = someCheck ? angle : -angle
+
+
seconds = seconds * 60 + value
+
+

Triggering Examples

+
↓foo = foo * 1
+
+
↓foo = foo / aVariable
+
+
↓foo = foo - bar.method()
+
+
↓foo.aProperty = foo.aProperty - 1
+
+
↓self.aProperty = self.aProperty * 1
+
+
↓n = n + i / outputLength
+
+
↓n = n - i / outputLength
+
+ +
+
+ + +
+
+ + + diff --git a/shorthand_optional_binding.html b/shorthand_optional_binding.html new file mode 100644 index 000000000..0b9d722d7 --- /dev/null +++ b/shorthand_optional_binding.html @@ -0,0 +1,394 @@ + + + + shorthand_optional_binding Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Shorthand Optional Binding

+ +

Use shorthand syntax for optional binding

+ +
    +
  • Identifier: shorthand_optional_binding
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.7.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
if let i {}
+if let i = a {}
+guard let i = f() else {}
+if var i = i() {}
+if let i = i as? Foo {}
+guard let `self` = self else {}
+while var i { i = nil }
+
+

Triggering Examples

+
if ↓let i = i {}
+if ↓let self = self {}
+if ↓var `self` = `self` {}
+if i > 0, ↓let j = j {}
+if ↓let i = i, ↓var j = j {}
+
+
guard ↓let i = i else {}
+guard ↓let self = self else {}
+guard ↓var `self` = `self` else {}
+guard i > 0, ↓let j = j else {}
+guard ↓let i = i, ↓var j = j else {}
+
+
while ↓var i = i { i = nil }
+
+ +
+
+ + +
+
+ + + diff --git a/single_test_class.html b/single_test_class.html new file mode 100644 index 000000000..053b81bbc --- /dev/null +++ b/single_test_class.html @@ -0,0 +1,411 @@ + + + + single_test_class Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Single Test Class

+ +

Test files should contain a single QuickSpec or XCTestCase class.

+ +
    +
  • Identifier: single_test_class
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +test_parent_classes + +[“QuickSpec”, “XCTestCase”] +
  • +
+

Non Triggering Examples

+
class FooTests {  }
+
+
class FooTests: QuickSpec {  }
+
+
class FooTests: XCTestCase {  }
+
+

Triggering Examples

+
↓class FooTests: QuickSpec {  }
+↓class BarTests: QuickSpec {  }
+
+
↓class FooTests: QuickSpec {  }
+↓class BarTests: QuickSpec {  }
+↓class TotoTests: QuickSpec {  }
+
+
↓class FooTests: XCTestCase {  }
+↓class BarTests: XCTestCase {  }
+
+
↓class FooTests: XCTestCase {  }
+↓class BarTests: XCTestCase {  }
+↓class TotoTests: XCTestCase {  }
+
+
↓class FooTests: QuickSpec {  }
+↓class BarTests: XCTestCase {  }
+
+
↓class FooTests: QuickSpec {  }
+↓class BarTests: XCTestCase {  }
+class TotoTests {  }
+
+
final ↓class FooTests: QuickSpec {  }
+↓class BarTests: XCTestCase {  }
+class TotoTests {  }
+
+ +
+
+ + +
+
+ + + diff --git a/sorted_enum_cases.html b/sorted_enum_cases.html new file mode 100644 index 000000000..524166c0b --- /dev/null +++ b/sorted_enum_cases.html @@ -0,0 +1,450 @@ + + + + sorted_enum_cases Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Sorted Enum Cases

+ +

Enum cases should be sorted

+ +
    +
  • Identifier: sorted_enum_cases
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
enum foo {
+    case a
+    case b
+    case c
+}
+
+
enum foo {
+    case example
+    case exBoyfriend
+}
+
+
enum foo {
+    case a
+    case B
+    case c
+}
+
+
enum foo {
+    case a, b, c
+}
+
+
enum foo {
+    case a
+    case b, c
+}
+
+
enum foo {
+    case a(foo: Foo)
+    case b(String), c
+}
+
+
enum foo {
+    case a
+    case b, C, d
+}
+
+
@frozen
+enum foo {
+    case b
+    case a
+    case c, f, d
+}
+
+

Triggering Examples

+
enum foo {
+    ↓case b
+    ↓case a
+    case c
+}
+
+
enum foo {
+    ↓case B
+    ↓case a
+    case c
+}
+
+
enum foo {
+    case ↓b, ↓a, c
+}
+
+
enum foo {
+    case ↓B, ↓a, c
+}
+
+
enum foo {
+    ↓case b, c
+    ↓case a
+}
+
+
enum foo {
+    case a
+    case b, ↓d, ↓c
+}
+
+
enum foo {
+    case a(foo: Foo)
+    case ↓c, ↓b(String)
+}
+
+ +
+
+ + +
+
+ + + diff --git a/sorted_first_last.html b/sorted_first_last.html new file mode 100644 index 000000000..52f957853 --- /dev/null +++ b/sorted_first_last.html @@ -0,0 +1,432 @@ + + + + sorted_first_last Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Min or Max over Sorted First or Last

+ +

Prefer using min() or max() over sorted().first or sorted().last

+ +
    +
  • Identifier: sorted_first_last
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: performance
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let min = myList.min()
+
+
let min = myList.min(by: { $0 < $1 })
+
+
let min = myList.min(by: >)
+
+
let max = myList.max()
+
+
let max = myList.max(by: { $0 < $1 })
+
+
let message = messages.sorted(byKeyPath: #keyPath(Message.timestamp)).last
+
+
let message = messages.sorted(byKeyPath: "timestamp", ascending: false).first
+
+
myList.sorted().firstIndex(of: key)
+
+
myList.sorted().lastIndex(of: key)
+
+
myList.sorted().firstIndex(where: someFunction)
+
+
myList.sorted().lastIndex(where: someFunction)
+
+
myList.sorted().firstIndex { $0 == key }
+
+
myList.sorted().lastIndex { $0 == key }
+
+
myList.sorted().first(where: someFunction)
+
+
myList.sorted().last(where: someFunction)
+
+
myList.sorted().first { $0 == key }
+
+
myList.sorted().last { $0 == key }
+
+

Triggering Examples

+
↓myList.sorted().first
+
+
↓myList.sorted(by: { $0.description < $1.description }).first
+
+
↓myList.sorted(by: >).first
+
+
↓myList.map { $0 + 1 }.sorted().first
+
+
↓myList.sorted(by: someFunction).first
+
+
↓myList.map { $0 + 1 }.sorted { $0.description < $1.description }.first
+
+
↓myList.sorted().last
+
+
↓myList.sorted().last?.something()
+
+
↓myList.sorted(by: { $0.description < $1.description }).last
+
+
↓myList.map { $0 + 1 }.sorted().last
+
+
↓myList.sorted(by: someFunction).last
+
+
↓myList.map { $0 + 1 }.sorted { $0.description < $1.description }.last
+
+
↓myList.map { $0 + 1 }.sorted { $0.first < $1.first }.last
+
+ +
+
+ + +
+
+ + + diff --git a/sorted_imports.html b/sorted_imports.html new file mode 100644 index 000000000..34f4cefcb --- /dev/null +++ b/sorted_imports.html @@ -0,0 +1,442 @@ + + + + sorted_imports Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Sorted Imports

+ +

Imports should be sorted

+ +
    +
  • Identifier: sorted_imports
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +grouping + +names +
  • +
+

Non Triggering Examples

+
import AAA
+import BBB
+import CCC
+import DDD
+
+
import Alamofire
+import API
+
+
import labc
+import Ldef
+
+
import BBB
+// comment
+import AAA
+import CCC
+
+
@testable import AAA
+import   CCC
+
+
import AAA
+@testable import   CCC
+
+
import EEE.A
+import FFF.B
+#if os(Linux)
+import DDD.A
+import EEE.B
+#else
+import CCC
+import DDD.B
+#endif
+import AAA
+import BBB
+
+

Triggering Examples

+
import AAA
+import ZZZ
+import ↓BBB
+import CCC
+
+
import DDD
+// comment
+import CCC
+import ↓AAA
+
+
@testable import CCC
+import   ↓AAA
+
+
import CCC
+@testable import   ↓AAA
+
+
import FFF.B
+import ↓EEE.A
+#if os(Linux)
+import DDD.A
+import EEE.B
+#else
+import DDD.B
+import ↓CCC
+#endif
+import AAA
+import BBB
+
+ +
+
+ + +
+
+ + + diff --git a/statement_position.html b/statement_position.html new file mode 100644 index 000000000..0117b0ac5 --- /dev/null +++ b/statement_position.html @@ -0,0 +1,408 @@ + + + + statement_position Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Statement Position

+ +

Else and catch should be on the same line, one space after the previous declaration

+ +
    +
  • Identifier: statement_position
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +statement_mode + +default +
  • +
+

Non Triggering Examples

+
} else if {
+
+
} else {
+
+
} catch {
+
+
"}else{"
+
+
struct A { let catchphrase: Int }
+let a = A(
+ catchphrase: 0
+)
+
+
struct A { let `catch`: Int }
+let a = A(
+ `catch`: 0
+)
+
+

Triggering Examples

+
↓}else if {
+
+
↓}  else {
+
+
↓}
+catch {
+
+
↓}
+      catch {
+
+ +
+
+ + +
+
+ + + diff --git a/static_operator.html b/static_operator.html new file mode 100644 index 000000000..ceb68f2db --- /dev/null +++ b/static_operator.html @@ -0,0 +1,426 @@ + + + + static_operator Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Static Operator

+ +

Operators should be declared as static functions, not free functions

+ +
    +
  • Identifier: static_operator
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class A: Equatable {
+  static func == (lhs: A, rhs: A) -> Bool {
+    return false
+  }
+
+
class A<T>: Equatable {
+    static func == <T>(lhs: A<T>, rhs: A<T>) -> Bool {
+        return false
+    }
+
+
public extension Array where Element == Rule {
+  static func == (lhs: Array, rhs: Array) -> Bool {
+    if lhs.count != rhs.count { return false }
+    return !zip(lhs, rhs).contains { !$0.0.isEqualTo($0.1) }
+  }
+}
+
+
private extension Optional where Wrapped: Comparable {
+  static func < (lhs: Optional, rhs: Optional) -> Bool {
+    switch (lhs, rhs) {
+    case let (lhs?, rhs?):
+      return lhs < rhs
+    case (nil, _?):
+      return true
+    default:
+      return false
+    }
+  }
+}
+
+

Triggering Examples

+
↓func == (lhs: A, rhs: A) -> Bool {
+  return false
+}
+
+
↓func == <T>(lhs: A<T>, rhs: A<T>) -> Bool {
+  return false
+}
+
+
↓func == (lhs: [Rule], rhs: [Rule]) -> Bool {
+  if lhs.count != rhs.count { return false }
+  return !zip(lhs, rhs).contains { !$0.0.isEqualTo($0.1) }
+}
+
+
private ↓func < <T: Comparable>(lhs: T?, rhs: T?) -> Bool {
+  switch (lhs, rhs) {
+  case let (lhs?, rhs?):
+    return lhs < rhs
+  case (nil, _?):
+    return true
+  default:
+    return false
+  }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/static_over_final_class.html b/static_over_final_class.html new file mode 100644 index 000000000..520f80b0f --- /dev/null +++ b/static_over_final_class.html @@ -0,0 +1,418 @@ + + + + static_over_final_class Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Static Over Final Class

+ +

Prefer static over class when the declaration is not allowed to be overridden in child classes due to its context being final. Likewise, the compiler complains about open being used in final classes.

+ +
    +
  • Identifier: static_over_final_class
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class C {
+    static func f() {}
+}
+
+
class C {
+    static var i: Int { 0 }
+}
+
+
class C {
+    static subscript(_: Int) -> Int { 0 }
+}
+
+
class C {
+    class func f() {}
+}
+
+
final class C {}
+
+
final class C {
+    class D {
+      class func f() {}
+    }
+}
+
+

Triggering Examples

+
class C {
+    ↓final class func f() {}
+}
+
+
class C {
+    ↓final class var i: Int { 0 }
+}
+
+
class C {
+    ↓final class subscript(_: Int) -> Int { 0 }
+}
+
+
final class C {
+    ↓class func f() {}
+}
+
+
class C {
+    final class D {
+        ↓class func f() {}
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/strict_fileprivate.html b/strict_fileprivate.html new file mode 100644 index 000000000..a224681d0 --- /dev/null +++ b/strict_fileprivate.html @@ -0,0 +1,417 @@ + + + + strict_fileprivate Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Strict Fileprivate

+ +

fileprivate should be avoided

+ +
    +
  • Identifier: strict_fileprivate
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
extension String {}
+
+
private extension String {}
+
+
public
+    extension String {
+        var i: Int { 1 }
+    }
+
+
    private enum E {
+        func f() {}
+    }
+
+
    public struct S {
+        internal let i: Int
+    }
+
+
    open class C {
+        private func f() {}
+    }
+
+
    internal actor A {}
+
+

Triggering Examples

+
    ↓fileprivate class C {
+        ↓fileprivate func f() {}
+    }
+
+
    ↓fileprivate extension String {
+        ↓fileprivate var isSomething: Bool { self == "something" }
+    }
+
+
    ↓fileprivate actor A {
+        ↓fileprivate let i = 1
+    }
+
+
    ↓fileprivate struct C {
+        ↓fileprivate(set) var myInt = 4
+    }
+
+
    struct Outter {
+        struct Inter {
+            ↓fileprivate struct Inner {}
+        }
+    }
+
+ +
+
+ + +
+
+ + + diff --git a/strong_iboutlet.html b/strong_iboutlet.html new file mode 100644 index 000000000..fb485b32a --- /dev/null +++ b/strong_iboutlet.html @@ -0,0 +1,392 @@ + + + + strong_iboutlet Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Strong IBOutlet

+ +

@IBOutlets shouldn’t be declared as weak

+ +
    +
  • Identifier: strong_iboutlet
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class ViewController: UIViewController {
+    @IBOutlet var label: UILabel?
+}
+
+
class ViewController: UIViewController {
+    weak var label: UILabel?
+}
+
+

Triggering Examples

+
class ViewController: UIViewController {
+    @IBOutlet ↓weak var label: UILabel?
+}
+
+
class ViewController: UIViewController {
+    @IBOutlet ↓unowned var label: UILabel!
+}
+
+
class ViewController: UIViewController {
+    @IBOutlet ↓weak var textField: UITextField?
+}
+
+ +
+
+ + +
+
+ + + diff --git a/superfluous_disable_command.html b/superfluous_disable_command.html new file mode 100644 index 000000000..8828cbfc4 --- /dev/null +++ b/superfluous_disable_command.html @@ -0,0 +1,384 @@ + + + + superfluous_disable_command Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Superfluous Disable Command

+ +

SwiftLint ‘disable’ commands are superfluous when the disabled rule would not have triggered a violation in the disabled region. Use “ - ” if you wish to document a command.

+ +
    +
  • Identifier: superfluous_disable_command
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let abc:Void // swiftlint:disable:this colon
+
+
// swiftlint:disable colon
+let abc:Void
+// swiftlint:enable colon
+
+

Triggering Examples

+
let abc: Void // swiftlint:disable:this colon
+
+
// swiftlint:disable colon
+let abc: Void
+// swiftlint:enable colon
+
+ +
+
+ + +
+
+ + + diff --git a/superfluous_else.html b/superfluous_else.html new file mode 100644 index 000000000..aede262bf --- /dev/null +++ b/superfluous_else.html @@ -0,0 +1,464 @@ + + + + superfluous_else Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Superfluous Else

+ +

Else branches should be avoided when the previous if-block exits the current scope

+ +
    +
  • Identifier: superfluous_else
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
if i > 0 {
+    // comment
+} else if i < 12 {
+    return 2
+} else {
+    return 3
+}
+
+
if i > 0 {
+    let a = 1
+    if a > 1 {
+        // comment
+    } else {
+        return 1
+    }
+    // comment
+} else {
+    return 3
+}
+
+
if i > 0 {
+    if a > 1 {
+        return 1
+    }
+} else {
+    return 3
+}
+
+
for i in list {
+    if i > 12 {
+        // Do nothing
+    } else {
+        continue
+    }
+    if i > 14 {
+        // Do nothing
+    } else if i > 13 {
+        break
+    }
+}
+
+
if #available(iOS 13, *) {
+    return
+} else {
+    deprecatedFunction()
+}
+
+

Triggering Examples

+
if i > 0 {
+    return 1
+    // comment
+} ↓else {
+    return 2
+}
+
+
if i > 0 {
+    return 1
+} ↓else if i < 12 {
+    return 2
+} ↓else if i > 18 {
+    return 3
+}
+
+
if i > 0 {
+    if i < 12 {
+        return 5
+    } ↓else {
+        if i > 11 {
+            return 6
+        } ↓else {
+            return 7
+        }
+    }
+} ↓else if i < 12 {
+    return 2
+} ↓else if i < 24 {
+    return 8
+} ↓else {
+    return 3
+}
+
+
for i in list {
+    if i > 13 {
+        return
+    } ↓else if i > 12 {
+        continue
+    } ↓else if i > 11 {
+        break
+    } ↓else {
+        throw error
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/swift-syntax-dashboard.html b/swift-syntax-dashboard.html new file mode 100644 index 000000000..f70856813 --- /dev/null +++ b/swift-syntax-dashboard.html @@ -0,0 +1,608 @@ + + + + Swift Syntax Dashboard Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Swift Syntax Dashboard

+ +

Efforts are actively under way to migrate most rules off SourceKit to use SwiftSyntax instead.

+ +

Rules written using SwiftSyntax tend to be significantly faster and have fewer false positives +than rules that use SourceKit to get source structure information.

+ +

23 out of 239 (9%) +of SwiftLint’s linter rules use SourceKit.

+

Rules Using SourceKit

+

Default Rules (6)

+ + +

Opt-in Rules (17)

+ + +

Rules not Using SourceKit

+

Default Rules (94)

+ + +

Opt-in Rules (122)

+ + + +
+
+ + +
+
+ + + diff --git a/switch_case_alignment.html b/switch_case_alignment.html new file mode 100644 index 000000000..a5b7a3e70 --- /dev/null +++ b/switch_case_alignment.html @@ -0,0 +1,538 @@ + + + + switch_case_alignment Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Switch and Case Statement Alignment

+ +

Case statements should vertically align with their closing brace, or indented if configured otherwise.

+ +
    +
  • Identifier: switch_case_alignment
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +indented_cases + +false +
    +ignore_one_liners + +false +
  • +
+

Non Triggering Examples

+
switch someBool {
+case true: // case 1
+    print('red')
+case false:
+    /*
+    case 2
+    */
+    if case let .someEnum(val) = someFunc() {
+        print('blue')
+    }
+}
+enum SomeEnum {
+    case innocent
+}
+
+
if aBool {
+    switch someBool {
+    case true:
+        print('red')
+    case false:
+        print('blue')
+    }
+}
+
+
switch someInt {
+// comments ignored
+case 0:
+    // zero case
+    print('Zero')
+case 1:
+    print('One')
+default:
+    print('Some other number')
+}
+
+
func f() -> Int {
+    return switch i {
+    case 1: 1
+    default: 2
+    }
+}
+
+
//
+// ignore_one_liners: true
+//
+
+switch i { case .x: 1 default: 0 }
+
+
+
//
+// ignore_one_liners: true
+//
+
+let a = switch i { case .x: 1 default: 0 }
+
+
+

Triggering Examples

+
switch someBool {
+    ↓case true:
+        print("red")
+    ↓case false:
+        print("blue")
+}
+
+
if aBool {
+    switch someBool {
+        ↓case true:
+            print('red')
+        ↓case false:
+            print('blue')
+    }
+}
+
+
switch someInt {
+    ↓case 0:
+        print('Zero')
+    ↓case 1:
+        print('One')
+    ↓default:
+        print('Some other number')
+}
+
+
let a = switch i {
+    ↓case 1: 1
+    ↓default: 2
+}
+
+
switch someBool {
+case true:
+    print('red')
+    ↓case false:
+        print('blue')
+}
+
+
if aBool {
+    switch someBool {
+        ↓case true:
+        print('red')
+    case false:
+    print('blue')
+    }
+}
+
+
let a = switch i {
+case 1: 1
+    ↓default: 2
+}
+
+
switch i { ↓case .x: 1 ↓default: 0 }
+
+
//
+// ignore_one_liners: true
+//
+
+switch i {
+↓case .x: 1 ↓default: 0 }
+
+
+
//
+// ignore_one_liners: true
+//
+
+switch i { ↓case .x: 1 ↓default: 0
+}
+
+
+
//
+// ignore_one_liners: true
+//
+
+switch i
+{ ↓case .x: 1 ↓default: 0 }
+
+
+
//
+// ignore_one_liners: true
+//
+
+let a = switch i {
+case .x: 1 ↓default: 0
+}
+
+
+
//
+// ignore_one_liners: true
+//
+
+let a = switch i {
+↓case .x: 1 ↓default: 0 }
+
+
+ +
+
+ + +
+
+ + + diff --git a/switch_case_on_newline.html b/switch_case_on_newline.html new file mode 100644 index 000000000..db7c23aeb --- /dev/null +++ b/switch_case_on_newline.html @@ -0,0 +1,484 @@ + + + + switch_case_on_newline Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Cases on Newline

+ +

Cases inside a switch should always be on a newline

+ +
    +
  • Identifier: switch_case_on_newline
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
/*case 1: */return true
+
+
//case 1:
+ return true
+
+
let x = [caseKey: value]
+
+
let x = [key: .default]
+
+
if case let .someEnum(value) = aFunction([key: 2]) { }
+
+
guard case let .someEnum(value) = aFunction([key: 2]) { }
+
+
for case let .someEnum(value) = aFunction([key: 2]) { }
+
+
enum Environment {
+ case development
+}
+
+
enum Environment {
+ case development(url: URL)
+}
+
+
enum Environment {
+ case development(url: URL) // staging
+}
+
+
switch foo {
+    case 1:
+ return true
+}
+
+
switch foo {
+    default:
+ return true
+}
+
+
switch foo {
+    case let value:
+ return true
+}
+
+
switch foo {
+    case .myCase: // error from network
+ return true
+}
+
+
switch foo {
+    case let .myCase(value) where value > 10:
+ return false
+}
+
+
switch foo {
+    case let .myCase(value)
+ where value > 10:
+ return false
+}
+
+
switch foo {
+    case let .myCase(code: lhsErrorCode, description: _)
+ where lhsErrorCode > 10:
+return false
+}
+
+
switch foo {
+    case #selector(aFunction(_:)):
+ return false
+}
+
+
do {
+  let loadedToken = try tokenManager.decodeToken(from: response)
+  return loadedToken
+} catch { throw error }
+
+

Triggering Examples

+
switch foo {
+    ↓case 1: return true
+}
+
+
switch foo {
+    ↓case let value: return true
+}
+
+
switch foo {
+    ↓default: return true
+}
+
+
switch foo {
+    ↓case "a string": return false
+}
+
+
switch foo {
+    ↓case .myCase: return false // error from network
+}
+
+
switch foo {
+    ↓case let .myCase(value) where value > 10: return false
+}
+
+
switch foo {
+    ↓case #selector(aFunction(_:)): return false
+}
+
+
switch foo {
+    ↓case let .myCase(value)
+ where value > 10: return false
+}
+
+
switch foo {
+    ↓case .first,
+ .second: return false
+}
+
+ +
+
+ + +
+
+ + + diff --git a/syntactic_sugar.html b/syntactic_sugar.html new file mode 100644 index 000000000..a27945760 --- /dev/null +++ b/syntactic_sugar.html @@ -0,0 +1,452 @@ + + + + syntactic_sugar Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Syntactic Sugar

+ +

Shorthand syntactic sugar should be used, i.e. [Int] instead of Array.

+ +
    +
  • Identifier: syntactic_sugar
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let x: [Int]
+
+
let x: [Int: String]
+
+
let x: Int?
+
+
func x(a: [Int], b: Int) -> [Int: Any]
+
+
let x: Int!
+
+
extension Array {
+  func x() { }
+}
+
+
extension Dictionary {
+  func x() { }
+}
+
+
let x: CustomArray<String>
+
+
var currentIndex: Array<OnboardingPage>.Index?
+
+
func x(a: [Int], b: Int) -> Array<Int>.Index
+
+
unsafeBitCast(nonOptionalT, to: Optional<T>.self)
+
+
unsafeBitCast(someType, to: Swift.Array<T>.self)
+
+
IndexingIterator<Array<Dictionary<String, AnyObject>>>.self
+
+
let y = Optional<String>.Type
+
+
type is Optional<String>.Type
+
+
let x: Foo.Optional<String>
+
+
let x = case Optional<Any>.none = obj
+
+
let a = Swift.Optional<String?>.none
+
+

Triggering Examples

+
let x: ↓Array<String>
+
+
let x: ↓Dictionary<Int, String>
+
+
let x: ↓Optional<Int>
+
+
let x: ↓Swift.Array<String>
+
+
func x(a: ↓Array<Int>, b: Int) -> [Int: Any]
+
+
func x(a: ↓Swift.Array<Int>, b: Int) -> [Int: Any]
+
+
func x(a: [Int], b: Int) -> ↓Dictionary<Int, String>
+
+
let x = y as? ↓Array<[String: Any]>
+
+
let x = Box<Array<T>>()
+
+
func x() -> Box<↓Array<T>>
+
+
func x() -> ↓Dictionary<String, Any>?
+
+
typealias Document = ↓Dictionary<String, T?>
+
+
func x(_ y: inout ↓Array<T>)
+
+
let x:↓Dictionary<String, ↓Dictionary<Int, Int>>
+
+
func x() -> Any { return ↓Dictionary<Int, String>()}
+
+
let x = ↓Array<String>.array(of: object)
+
+
let x = ↓Swift.Array<String>.array(of: object)
+
+
@_specialize(where S == ↓Array<Character>)
+public init<S: Sequence>(_ elements: S)
+
+
let dict: [String: Any] = [:]
+_ = dict["key"] as? ↓Optional<String?> ?? Optional<String?>.none
+
+ +
+
+ + +
+
+ + + diff --git a/test_case_accessibility.html b/test_case_accessibility.html new file mode 100644 index 000000000..24da8a33e --- /dev/null +++ b/test_case_accessibility.html @@ -0,0 +1,483 @@ + + + + test_case_accessibility Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Test Case Accessibility

+ +

Test cases should only contain private non-test members

+ +
    +
  • Identifier: test_case_accessibility
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +allowed_prefixes + +[] +
    +test_parent_classes + +[“QuickSpec”, “XCTestCase”] +
  • +
+

Non Triggering Examples

+
let foo: String?
+
+
let foo: String?
+
+class FooTests: XCTestCase {
+    static let allTests: [String] = []
+
+    private let foo: String {
+        let nestedMember = "hi"
+        return nestedMember
+    }
+
+    override static func setUp() {}
+
+    override func setUp() {}
+
+    override func setUpWithError() throws {}
+
+    override static func tearDown() {}
+
+    override func tearDown() {}
+
+    override func tearDownWithError() {}
+
+    override func someFutureXCTestFunction() {
+        super.someFutureXCTestFunction()
+    }
+
+    func testFoo() {
+        XCTAssertTrue(true)
+    }
+
+    func testBar() {
+        func nestedFunc() {}
+    }
+
+    private someFunc(hasParam: Bool) {}
+}
+
+
class FooTests: XCTestCase {
+    private struct MockSomething: Something {}
+}
+
+
class FooTests: XCTestCase {
+    override init() {
+        super.init()
+        let foo = 1
+        var bar = 2
+    }
+}
+
+
//
+// allowed_prefixes: ["allowedPrefix"]
+//
+
+class FooTests: XCTestCase {
+    func allowedPrefixTestFoo() {}
+}
+
+
+
class Foobar {
+    func setUp() {}
+
+    func tearDown() {}
+
+    func testFoo() {}
+}
+
+

Triggering Examples

+
class FooTests: XCTestCase {
+    ↓typealias Bar = Foo.Bar
+
+    ↓var foo: String?
+    ↓let bar: String?
+
+    ↓static func foo() {}
+
+    ↓func setUp(withParam: String) {}
+
+    ↓func foobar() {}
+
+    ↓func not_testBar() {}
+
+    ↓enum Nested {}
+
+    ↓static func testFoo() {}
+
+    ↓static func allTests() {}
+
+    ↓func testFoo(hasParam: Bool) {}
+}
+
+final class BarTests: XCTestCase {
+    ↓class Nested {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/todo.html b/todo.html new file mode 100644 index 000000000..8db9e7de7 --- /dev/null +++ b/todo.html @@ -0,0 +1,400 @@ + + + + todo Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Todo

+ +

TODOs and FIXMEs should be resolved.

+ +
    +
  • Identifier: todo
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +only + +[TODO, FIXME] +
  • +
+

Non Triggering Examples

+
// notaTODO:
+
+
// notaFIXME:
+
+

Triggering Examples

+
// ↓TODO:
+
+
// ↓FIXME:
+
+
// ↓TODO(note)
+
+
// ↓FIXME(note)
+
+
/* ↓FIXME: */
+
+
/* ↓TODO: */
+
+
/** ↓FIXME: */
+
+
/** ↓TODO: */
+
+ +
+
+ + +
+
+ + + diff --git a/toggle_bool.html b/toggle_bool.html new file mode 100644 index 000000000..e363ea46a --- /dev/null +++ b/toggle_bool.html @@ -0,0 +1,390 @@ + + + + toggle_bool Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Toggle Bool

+ +

Prefer someBool.toggle() over someBool = !someBool

+ +
    +
  • Identifier: toggle_bool
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
isHidden.toggle()
+
+
view.clipsToBounds.toggle()
+
+
func foo() { abc.toggle() }
+
+
view.clipsToBounds = !clipsToBounds
+
+
disconnected = !connected
+
+
result = !result.toggle()
+
+

Triggering Examples

+
↓isHidden = !isHidden
+
+
↓view.clipsToBounds = !view.clipsToBounds
+
+
func foo() { ↓abc = !abc }
+
+ +
+
+ + +
+
+ + + diff --git a/trailing_closure.html b/trailing_closure.html new file mode 100644 index 000000000..ed7fbf42a --- /dev/null +++ b/trailing_closure.html @@ -0,0 +1,428 @@ + + + + trailing_closure Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Trailing Closure

+ +

Trailing closure syntax should be used whenever possible

+ +
    +
  • Identifier: trailing_closure
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +only_single_muted_parameter + +false +
  • +
+

Non Triggering Examples

+
foo.map { $0 + 1 }
+
+
foo.bar()
+
+
foo.reduce(0) { $0 + 1 }
+
+
if let foo = bar.map({ $0 + 1 }) { }
+
+
foo.something(param1: { $0 }, param2: { $0 + 1 })
+
+
offsets.sorted { $0.offset < $1.offset }
+
+
foo.something({ return 1 }())
+
+
foo.something({ return $0 }(1))
+
+
foo.something(0, { return 1 }())
+
+
for x in list.filter({ $0.isValid }) {}
+
+
if list.allSatisfy({ $0.isValid }) {}
+
+
foo(param1: 1, param2: { _ in true }, param3: 0)
+
+
foo(param1: 1, param2: { _ in true }) { $0 + 1 }
+
+
foo(param1: { _ in false }, param2: { _ in true })
+
+
foo(param1: { _ in false }, param2: { _ in true }, param3: { _ in false })
+
+
if f({ true }), g({ true }) {
+    print("Hello")
+}
+
+
for i in h({ [1,2,3] }) {
+    print(i)
+}
+
+

Triggering Examples

+
foo.map(↓{ $0 + 1 })
+
+
foo.reduce(0, combine: ↓{ $0 + 1 })
+
+
offsets.sorted(by: ↓{ $0.offset < $1.offset })
+
+
foo.something(0, ↓{ $0 + 1 })
+
+
foo.something(param1: { _ in true }, param2: 0, param3: ↓{ _ in false })
+
+ +
+
+ + +
+
+ + + diff --git a/trailing_comma.html b/trailing_comma.html new file mode 100644 index 000000000..f2f514e66 --- /dev/null +++ b/trailing_comma.html @@ -0,0 +1,430 @@ + + + + trailing_comma Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Trailing Comma

+ +

Trailing commas in arrays and dictionaries should be avoided/enforced.

+ +
    +
  • Identifier: trailing_comma
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +mandatory_comma + +false +
  • +
+

Non Triggering Examples

+
let foo = [1, 2, 3]
+
+
let foo = []
+
+
let foo = [:]
+
+
let foo = [1: 2, 2: 3]
+
+
let foo = [Void]()
+
+
let example = [ 1,
+ 2
+ // 3,
+]
+
+
foo([1: "\(error)"])
+
+
let foo = [Int]()
+
+

Triggering Examples

+
let foo = [1, 2, 3↓,]
+
+
let foo = [1, 2, 3↓, ]
+
+
let foo = [1, 2, 3   ↓,]
+
+
let foo = [1: 2, 2: 3↓, ]
+
+
struct Bar {
+ let foo = [1: 2, 2: 3↓, ]
+}
+
+
let foo = [1, 2, 3↓,] + [4, 5, 6↓,]
+
+
let example = [ 1,
+2↓,
+ // 3,
+]
+
+
let foo = ["אבג", "αβγ", "🇺🇸"↓,]
+
+
class C {
+ #if true
+ func f() {
+ let foo = [1, 2, 3↓,]
+ }
+ #endif
+}
+
+
foo([1: "\(error)"↓,])
+
+ +
+
+ + +
+
+ + + diff --git a/trailing_newline.html b/trailing_newline.html new file mode 100644 index 000000000..a0b4f508e --- /dev/null +++ b/trailing_newline.html @@ -0,0 +1,381 @@ + + + + trailing_newline Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Trailing Newline

+ +

Files should have a single trailing newline

+ +
    +
  • Identifier: trailing_newline
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let a = 0
+
+
+

Triggering Examples

+
let a = 0
+
+
let a = 0
+
+
+
+ +
+
+ + +
+
+ + + diff --git a/trailing_semicolon.html b/trailing_semicolon.html new file mode 100644 index 000000000..fd6f3ca34 --- /dev/null +++ b/trailing_semicolon.html @@ -0,0 +1,385 @@ + + + + trailing_semicolon Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Trailing Semicolon

+ +

Lines should not have trailing semicolons

+ +
    +
  • Identifier: trailing_semicolon
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let a = 0
+
+
let a = 0; let b = 0
+
+

Triggering Examples

+
let a = 0↓;
+
+
+
let a = 0↓;
+let b = 1
+
+
let a = 0↓; // a comment
+
+
+ +
+
+ + +
+
+ + + diff --git a/trailing_whitespace.html b/trailing_whitespace.html new file mode 100644 index 000000000..fc3c1c967 --- /dev/null +++ b/trailing_whitespace.html @@ -0,0 +1,409 @@ + + + + trailing_whitespace Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Trailing Whitespace

+ +

Lines should not have trailing whitespace

+ +
    +
  • Identifier: trailing_whitespace
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +ignores_empty_lines + +false +
    +ignores_comments + +true +
  • +
+

Non Triggering Examples

+
let name: String
+
+
+
//
+
+
+
// 
+
+
+
let name: String //
+
+
+
let name: String // 
+
+
+

Triggering Examples

+
let name: String 
+
+
+
/* */ let name: String 
+
+
+ +
+
+ + +
+
+ + + diff --git a/type_body_length.html b/type_body_length.html new file mode 100644 index 000000000..585d47807 --- /dev/null +++ b/type_body_length.html @@ -0,0 +1,5476 @@ + + + + type_body_length Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Type Body Length

+ +

Type bodies should not span too many lines

+ +
    +
  • Identifier: type_body_length
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: metrics
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +warning + +250 +
    +error + +350 +
  • +
+

Non Triggering Examples

+
class Abc {
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+}
+
+
+
class Abc {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+
+
class Abc {
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+}
+
+
+
class Abc {
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+
+/* this is
+a multiline comment
+*/}
+
+
+
struct Abc {
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+}
+
+
+
struct Abc {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+
+
struct Abc {
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+}
+
+
+
struct Abc {
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+
+/* this is
+a multiline comment
+*/}
+
+
+
enum Abc {
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+}
+
+
+
enum Abc {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+
+
enum Abc {
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+}
+
+
+
enum Abc {
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+
+/* this is
+a multiline comment
+*/}
+
+
+
actor Abc {
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+}
+
+
+
actor Abc {
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+}
+
+
+
actor Abc {
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+// this is a comment
+}
+
+
+
actor Abc {
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+
+/* this is
+a multiline comment
+*/}
+
+
+

Triggering Examples

+
↓class Abc {
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+}
+
+
+
↓struct Abc {
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+}
+
+
+
↓enum Abc {
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+}
+
+
+
↓actor Abc {
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+let abc = 0
+}
+
+
+ +
+
+ + +
+
+ + + diff --git a/type_contents_order.html b/type_contents_order.html new file mode 100644 index 000000000..7eebdf230 --- /dev/null +++ b/type_contents_order.html @@ -0,0 +1,605 @@ + + + + type_contents_order Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Type Contents Order

+ +

Specifies the order of subtypes, properties, methods & more within a type.

+ +
    +
  • Identifier: type_contents_order
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +order + +[[case], [type_alias, associated_type], [subtype], [type_property], [instance_property], [ib_inspectable], [ib_outlet], [initializer], [type_method], [view_life_cycle_method], [ib_action], [other_method], [subscript], [deinitializer]] +
  • +
+

Non Triggering Examples

+
class TestViewController: UIViewController {
+// Type Aliases
+typealias CompletionHandler = ((TestEnum) -> Void)
+
+// Subtypes
+class TestClass {
+    // 10 lines
+}
+
+struct TestStruct {
+    // 3 lines
+}
+
+enum TestEnum {
+    // 5 lines
+}
+
+// Type Properties
+static let cellIdentifier: String = "AmazingCell"
+
+// Instance Properties
+var shouldLayoutView1: Bool!
+weak var delegate: TestViewControllerDelegate?
+private var hasLayoutedView1: Bool = false
+private var hasLayoutedView2: Bool = false
+
+private var hasAnyLayoutedView: Bool {
+     return hasLayoutedView1 || hasLayoutedView2
+}
+
+// IBOutlets
+@IBOutlet private var view1: UIView!
+@IBOutlet private var view2: UIView!
+
+// Initializers
+override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
+    super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
+}
+
+required init?(coder aDecoder: NSCoder) {
+    fatalError("init(coder:) has not been implemented")
+}
+
+// Type Methods
+static func makeViewController() -> TestViewController {
+    // some code
+}
+
+// View Life-Cycle Methods
+override func viewDidLoad() {
+    super.viewDidLoad()
+
+    view1.setNeedsLayout()
+    view1.layoutIfNeeded()
+    hasLayoutedView1 = true
+}
+
+override func willMove(toParent parent: UIViewController?) {
+    super.willMove(toParent: parent)
+    if parent == nil {
+        viewModel.willMoveToParent()
+    }
+}
+
+override func viewDidLayoutSubviews() {
+    super.viewDidLayoutSubviews()
+
+    view2.setNeedsLayout()
+    view2.layoutIfNeeded()
+    hasLayoutedView2 = true
+}
+
+override func viewIsAppearing(_ animated: Bool) {
+    super.viewIsAppearing(animated)
+}
+
+// IBActions
+@IBAction func goNextButtonPressed() {
+    goToNextVc()
+    delegate?.didPressTrackedButton()
+}
+
+// Other Methods
+func goToNextVc() { /* TODO */ }
+
+func goToInfoVc() { /* TODO */ }
+
+func goToRandomVc() {
+    let viewCtrl = getRandomVc()
+    present(viewCtrl, animated: true)
+}
+
+private func getRandomVc() -> UIViewController { return UIViewController() }
+
+// Subscripts
+subscript(_ someIndexThatIsNotEvenUsed: Int) -> String {
+    get {
+        return "This is just a test"
+    }
+
+    set {
+        log.warning("Just a test", newValue)
+    }
+}
+
+deinit {
+    log.debug("deinit")
+},
+}
+
+

Triggering Examples

+
class TestViewController: UIViewController {
+    // Subtypes
+    ↓class TestClass {
+        // 10 lines
+    }
+
+    // Type Aliases
+    typealias CompletionHandler = ((TestEnum) -> Void)
+}
+
+
class TestViewController: UIViewController {
+    // Stored Type Properties
+    ↓static let cellIdentifier: String = "AmazingCell"
+
+    // Subtypes
+    class TestClass {
+        // 10 lines
+    }
+}
+
+
class TestViewController: UIViewController {
+    // Stored Instance Properties
+    ↓var shouldLayoutView1: Bool!
+
+    // Stored Type Properties
+    static let cellIdentifier: String = "AmazingCell"
+}
+
+
class TestViewController: UIViewController {
+    // IBOutlets
+    @IBOutlet private ↓var view1: UIView!
+
+    // Computed Instance Properties
+    private var hasAnyLayoutedView: Bool {
+         return hasLayoutedView1 || hasLayoutedView2
+    }
+}
+
+
class TestViewController: UIViewController {
+
+    // deinitializer
+    ↓deinit {
+        log.debug("deinit")
+    }
+
+    // Initializers
+    override ↓init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
+        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
+    }
+
+    // IBOutlets
+    @IBOutlet private var view1: UIView!
+    @IBOutlet private var view2: UIView!
+}
+
+
class TestViewController: UIViewController {
+    // View Life-Cycle Methods
+    override ↓func viewDidLoad() {
+        super.viewDidLoad()
+
+        view1.setNeedsLayout()
+        view1.layoutIfNeeded()
+        hasLayoutedView1 = true
+    }
+
+    // Type Methods
+    static func makeViewController() -> TestViewController {
+        // some code
+    }
+}
+
+
class TestViewController: UIViewController {
+    // IBActions
+    @IBAction ↓func goNextButtonPressed() {
+        goToNextVc()
+        delegate?.didPressTrackedButton()
+    }
+
+    // View Life-Cycle Methods
+    override func viewDidLoad() {
+        super.viewDidLoad()
+
+        view1.setNeedsLayout()
+        view1.layoutIfNeeded()
+        hasLayoutedView1 = true
+    }
+}
+
+
class TestViewController: UIViewController {
+    // Other Methods
+    ↓func goToNextVc() { /* TODO */ }
+
+    // IBActions
+    @IBAction func goNextButtonPressed() {
+        goToNextVc()
+        delegate?.didPressTrackedButton()
+    }
+}
+
+
class TestViewController: UIViewController {
+    // Subscripts
+    ↓subscript(_ someIndexThatIsNotEvenUsed: Int) -> String {
+        get {
+            return "This is just a test"
+        }
+
+        set {
+            log.warning("Just a test", newValue)
+        }
+    }
+
+    // MARK: Other Methods
+    func goToNextVc() { /* TODO */ }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/type_name.html b/type_name.html new file mode 100644 index 000000000..eff3586a4 --- /dev/null +++ b/type_name.html @@ -0,0 +1,536 @@ + + + + type_name Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Type Name

+ +

Type name should only contain alphanumeric characters, start with an uppercase character and span between 3 and 40 characters in length. +Private types may start with an underscore.

+ +
    +
  • Identifier: type_name
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +min_length + + + + + + + + + + + + + + + +
    KeyValue
    +warning + +3 +
    +error + +0 +
    +
    +max_length + + + + + + + + + + + + + + + +
    KeyValue
    +warning + +40 +
    +error + +1000 +
    +
    +excluded + +[] +
    +allowed_symbols + +[] +
    +unallowed_symbols_severity + +error +
    +validates_start_with_lowercase + +error +
    +validate_protocols + +true +
  • +
+

Non Triggering Examples

+
class MyType {}
+
+
private struct _MyType {}
+
+
enum AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA {}
+
+
typealias Foo = Void
+
+
private typealias Foo = Void
+
+
protocol Foo {
+  associatedtype Bar
+}
+
+
protocol Foo {
+  associatedtype Bar: Equatable
+}
+
+
enum MyType {
+case value
+}
+
+
//
+// validate_protocols: false
+//
+
+protocol P {}
+
+
+
struct SomeStruct {
+  enum `Type` {
+    case x, y, z
+  }
+}
+
+

Triggering Examples

+
class ↓myType {}
+
+
enum ↓_MyType {}
+
+
private struct ↓MyType_ {}
+
+
struct ↓My {}
+
+
struct ↓AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA {}
+
+
class ↓MyView_Previews
+
+
private struct ↓_MyView_Previews
+
+
typealias ↓X = Void
+
+
private typealias ↓Foo_Bar = Void
+
+
private typealias ↓foo = Void
+
+
typealias ↓AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA = Void
+
+
protocol Foo {
+  associatedtype ↓X
+}
+
+
protocol Foo {
+  associatedtype ↓Foo_Bar: Equatable
+}
+
+
protocol Foo {
+  associatedtype ↓AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+}
+
+
protocol ↓X {}
+
+ +
+
+ + +
+
+ + + diff --git a/typesafe_array_init.html b/typesafe_array_init.html new file mode 100644 index 000000000..f988ee84a --- /dev/null +++ b/typesafe_array_init.html @@ -0,0 +1,400 @@ + + + + typesafe_array_init Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Type-safe Array Init

+ +

Prefer using Array(seq) over seq.map { $0 } to convert a sequence into an Array

+ +
    +
  • Identifier: typesafe_array_init
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: Yes
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
enum MyError: Error {}
+let myResult: Result<String, MyError> = .success("")
+let result: Result<Any, MyError> = myResult.map { $0 }
+
+
struct IntArray {
+    let elements = [1, 2, 3]
+    func map<T>(_ transformer: (Int) throws -> T) rethrows -> [T] {
+        try elements.map(transformer)
+    }
+}
+let ints = IntArray()
+let intsCopy = ints.map { $0 }
+
+

Triggering Examples

+
func f<Seq: Sequence>(s: Seq) -> [Seq.Element] {
+    s.↓map({ $0 })
+}
+
+
func f(array: [Int]) -> [Int] {
+    array.↓map { $0 }
+}
+
+
let myInts = [1, 2, 3].↓map { return $0 }
+
+
struct Generator: Sequence, IteratorProtocol {
+    func next() -> Int? { nil }
+}
+let array = Generator().↓map { i in i }
+
+ +
+
+ + +
+
+ + + diff --git a/unavailable_condition.html b/unavailable_condition.html new file mode 100644 index 000000000..9750c48a7 --- /dev/null +++ b/unavailable_condition.html @@ -0,0 +1,410 @@ + + + + unavailable_condition Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unavailable Condition

+ +

Use #unavailable/#available instead of #available/#unavailable with an empty body.

+ +
    +
  • Identifier: unavailable_condition
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.6.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
if #unavailable(iOS 13) {
+  loadMainWindow()
+}
+
+
if #available(iOS 9.0, *) {
+  doSomething()
+} else {
+  legacyDoSomething()
+}
+
+
if #available(macOS 11.0, *) {
+   // Do nothing
+} else if #available(macOS 10.15, *) {
+   print("do some stuff")
+}
+
+

Triggering Examples

+
if ↓#available(iOS 14.0) {
+
+} else {
+  oldIos13TrackingLogic(isEnabled: ASIdentifierManager.shared().isAdvertisingTrackingEnabled)
+}
+
+
if ↓#available(iOS 14.0) {
+  // we don't need to do anything here
+} else {
+  oldIos13TrackingLogic(isEnabled: ASIdentifierManager.shared().isAdvertisingTrackingEnabled)
+}
+
+
if ↓#available(iOS 13, *) {} else {
+  loadMainWindow()
+}
+
+
if ↓#unavailable(iOS 13) {
+  // Do nothing
+} else if i < 2 {
+  loadMainWindow()
+}
+
+ +
+
+ + +
+
+ + + diff --git a/unavailable_function.html b/unavailable_function.html new file mode 100644 index 000000000..cb0d49e08 --- /dev/null +++ b/unavailable_function.html @@ -0,0 +1,421 @@ + + + + unavailable_function Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unavailable Function

+ +

Unimplemented functions should be marked as unavailable

+ +
    +
  • Identifier: unavailable_function
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class ViewController: UIViewController {
+  @available(*, unavailable)
+  public required init?(coder aDecoder: NSCoder) {
+    preconditionFailure("init(coder:) has not been implemented")
+  }
+}
+
+
func jsonValue(_ jsonString: String) -> NSObject {
+   let data = jsonString.data(using: .utf8)!
+   let result = try! JSONSerialization.jsonObject(with: data, options: [])
+   if let dict = (result as? [String: Any])?.bridge() {
+    return dict
+   } else if let array = (result as? [Any])?.bridge() {
+    return array
+   }
+   fatalError()
+}
+
+
func resetOnboardingStateAndCrash() -> Never {
+    resetUserDefaults()
+    // Crash the app to re-start the onboarding flow.
+    fatalError("Onboarding re-start crash.")
+}
+
+

Triggering Examples

+
class ViewController: UIViewController {
+  public required ↓init?(coder aDecoder: NSCoder) {
+    fatalError("init(coder:) has not been implemented")
+  }
+}
+
+
class ViewController: UIViewController {
+  public required ↓init?(coder aDecoder: NSCoder) {
+    let reason = "init(coder:) has not been implemented"
+    fatalError(reason)
+  }
+}
+
+
class ViewController: UIViewController {
+  public required ↓init?(coder aDecoder: NSCoder) {
+    preconditionFailure("init(coder:) has not been implemented")
+  }
+}
+
+
↓func resetOnboardingStateAndCrash() {
+    resetUserDefaults()
+    // Crash the app to re-start the onboarding flow.
+    fatalError("Onboarding re-start crash.")
+}
+
+ +
+
+ + +
+
+ + + diff --git a/undocumented.json b/undocumented.json new file mode 100644 index 000000000..ec7e65616 --- /dev/null +++ b/undocumented.json @@ -0,0 +1,6 @@ +{ + "warnings": [ + + ], + "source_directory": "/Users/runner/work/1/s" +} \ No newline at end of file diff --git a/unhandled_throwing_task.html b/unhandled_throwing_task.html new file mode 100644 index 000000000..077549c45 --- /dev/null +++ b/unhandled_throwing_task.html @@ -0,0 +1,512 @@ + + + + unhandled_throwing_task Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unhandled Throwing Task

+ +

Errors thrown inside this task are not handled, which may be unexpected. Handle errors inside the task, or use try await to access the Tasks value and handle errors. See this forum thread for more details: https://forums.swift.org/t/task-initializer-with-throwing-closure-swallows-error/56066

+ +
    +
  • Identifier: unhandled_throwing_task
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +error +
  • +
+

Non Triggering Examples

+
Task<Void, Never> {
+  try await myThrowingFunction()
+}
+
+
Task {
+  try? await myThrowingFunction()
+}
+
+
Task {
+  try! await myThrowingFunction()
+}
+
+
Task<Void, String> {
+  let text = try myThrowingFunction()
+  return text
+}
+
+
Task {
+  do {
+    try myThrowingFunction()
+  } catch let e {
+    print(e)
+  }
+}
+
+
func someFunction() throws {
+  Task {
+    anotherFunction()
+    do {
+      try myThrowingFunction()
+    } catch {
+      print(error)
+    }
+  }
+
+  try something()
+}
+
+
let task = Task {
+  try await myThrowingFunction()
+}
+
+
var task = Task {
+  try await myThrowingFunction()
+}
+
+
try await Task {
+  try await myThrowingFunction()
+}.value
+
+
executor.task = Task {
+  try await isolatedOpen(.init(executor.asUnownedSerialExecutor()))
+}
+
+
let result = await Task {
+  throw CancellationError()
+}.result
+
+
func makeTask() -> Task<String, Error> {
+  return Task {
+    try await someThrowingFunction()
+  }
+}
+
+
func makeTask() -> Task<String, Error> {
+  // Implicit return
+  Task {
+    try await someThrowingFunction()
+  }
+}
+
+
Task {
+  return Result {
+      try someThrowingFunc()
+  }
+}
+
+

Triggering Examples

+
↓Task {
+  try await myThrowingFunction()
+}
+
+
↓Task {
+  let text = try myThrowingFunction()
+  return text
+}
+
+
↓Task {
+  do {
+    try myThrowingFunction()
+  }
+}
+
+
↓Task {
+  do {
+    try myThrowingFunction()
+  } catch let e as FooError {
+    print(e)
+  }
+}
+
+
↓Task {
+  do {
+    throw FooError.bar
+  }
+}
+
+
↓Task {
+  throw FooError.bar
+}
+
+
↓Task<_, _> {
+  throw FooError.bar
+}
+
+
↓Task<Void,_> {
+  throw FooError.bar
+}
+
+
↓Task {
+  do {
+    try foo()
+  } catch {
+    try bar()
+  }
+}
+
+
↓Task {
+  do {
+    try foo()
+  } catch {
+    throw BarError()
+  }
+}
+
+
func doTask() {
+  ↓Task {
+    try await someThrowingFunction()
+  }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/unneeded_break_in_switch.html b/unneeded_break_in_switch.html new file mode 100644 index 000000000..83ee26693 --- /dev/null +++ b/unneeded_break_in_switch.html @@ -0,0 +1,433 @@ + + + + unneeded_break_in_switch Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unneeded Break in Switch

+ +

Avoid using unneeded break statements

+ +
    +
  • Identifier: unneeded_break_in_switch
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
switch foo {
+case .bar:
+    break
+}
+
+
switch foo {
+default:
+    break
+}
+
+
switch foo {
+case .bar:
+    for i in [0, 1, 2] { break }
+}
+
+
switch foo {
+case .bar:
+    if true { break }
+}
+
+
switch foo {
+case .bar:
+    something()
+}
+
+
let items = [Int]()
+for item in items {
+    if bar() {
+        do {
+            try foo()
+        } catch {
+            bar()
+            break
+        }
+    }
+}
+
+

Triggering Examples

+
switch foo {
+case .bar:
+    something()
+    ↓break
+}
+
+
switch foo {
+case .bar:
+    something()
+    ↓break // comment
+}
+
+
switch foo {
+default:
+    something()
+    ↓break
+}
+
+
switch foo {
+case .foo, .foo2 where condition:
+    something()
+    ↓break
+}
+
+ +
+
+ + +
+
+ + + diff --git a/unneeded_override.html b/unneeded_override.html new file mode 100644 index 000000000..2acc7155a --- /dev/null +++ b/unneeded_override.html @@ -0,0 +1,545 @@ + + + + unneeded_override Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unneeded Overridden Functions

+ +

Remove overridden functions that don’t do anything except call their super

+ +
    +
  • Identifier: unneeded_override
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +affect_initializers + +false +
  • +
+

Non Triggering Examples

+
class Foo {
+    override func bar() {
+        super.bar()
+        print("hi")
+    }
+}
+
+
class Foo {
+    @available(*, unavailable)
+    override func bar() {
+        super.bar()
+    }
+}
+
+
class Foo {
+    @objc override func bar() {
+        super.bar()
+    }
+}
+
+
class Foo {
+    override func bar() {
+        super.bar()
+        super.bar()
+    }
+}
+
+
class Foo {
+    override func bar() throws {
+        // Doing a different variation of 'try' changes behavior
+        try! super.bar()
+    }
+}
+
+
class Foo {
+    override func bar() throws {
+        // Doing a different variation of 'try' changes behavior
+        try? super.bar()
+    }
+}
+
+
class Foo {
+    override func bar() async throws {
+        // Doing a different variation of 'try' changes behavior
+        await try! super.bar()
+    }
+}
+
+
class Foo {
+    override func bar(arg: Bool) {
+        // Flipping the argument changes behavior
+        super.bar(arg: !arg)
+    }
+}
+
+
class Foo {
+    override func bar(_ arg: Int) {
+        // Changing the argument changes behavior
+        super.bar(arg + 1)
+    }
+}
+
+
class Foo {
+    override func bar(arg: Int) {
+        // Changing the argument changes behavior
+        super.bar(arg: arg.var)
+    }
+}
+
+
class Foo {
+    override func bar(_ arg: Int) {
+        // Not passing arguments because they have default values changes behavior
+        super.bar()
+    }
+}
+
+
class Foo {
+    override func bar(arg: Int, _ arg3: Bool) {
+        // Calling a super function with different argument labels changes behavior
+        super.bar(arg2: arg, arg3: arg3)
+    }
+}
+
+
class Foo {
+    override func bar(animated: Bool, completion: () -> Void) {
+        super.bar(animated: animated) {
+            // This likely changes behavior
+        }
+    }
+}
+
+
class Foo {
+    override func bar(animated: Bool, completion: () -> Void) {
+        super.bar(animated: animated, completion: {
+            // This likely changes behavior
+        })
+    }
+}
+
+
class Baz: Foo {
+    // A default argument might be a change
+    override func bar(value: String = "Hello") {
+        super.bar(value: value)
+    }
+}
+
+
class C {
+    override func foo() {
+        super.foo {}
+    }
+    override func bar(_ c: () -> Void) {
+        super.bar {}
+    }
+    override func baz(_ c: () -> Void) {
+        super.baz({})
+    }
+    override func qux(c: () -> Void) {
+        super.qux(c: {})
+    }
+}
+
+

Triggering Examples

+
class Foo {
+    ↓override func bar() {
+        super.bar()
+    }
+}
+
+
class Foo {
+    ↓override func bar() {
+        return super.bar()
+    }
+}
+
+
class Foo {
+    ↓override func bar() {
+        super.bar()
+        // comments don't affect this
+    }
+}
+
+
class Foo {
+    ↓override func bar() async {
+        await super.bar()
+    }
+}
+
+
class Foo {
+    ↓override func bar() throws {
+        try super.bar()
+        // comments don't affect this
+    }
+}
+
+
class Foo {
+    ↓override func bar(arg: Bool) throws {
+        try super.bar(arg: arg)
+    }
+}
+
+
class Foo {
+    ↓override func bar(animated: Bool, completion: () -> Void) {
+        super.bar(animated: animated, completion: completion)
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/unneeded_parentheses_in_closure_argument.html b/unneeded_parentheses_in_closure_argument.html new file mode 100644 index 000000000..49d7f7814 --- /dev/null +++ b/unneeded_parentheses_in_closure_argument.html @@ -0,0 +1,416 @@ + + + + unneeded_parentheses_in_closure_argument Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unneeded Parentheses in Closure Argument

+ +

Parentheses are not needed when declaring closure arguments

+ +
    +
  • Identifier: unneeded_parentheses_in_closure_argument
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let foo = { (bar: Int) in }
+
+
let foo = { bar, _  in }
+
+
let foo = { bar in }
+
+
let foo = { bar -> Bool in return true }
+
+
DispatchQueue.main.async { () -> Void in
+    doSomething()
+}
+
+

Triggering Examples

+
call(arg: { ↓(bar) in })
+
+
call(arg: { ↓(bar, _) in })
+
+
let foo = { ↓(bar) -> Bool in return true }
+
+
foo.map { ($0, $0) }.forEach { ↓(x, y) in }
+
+
foo.bar { [weak self] ↓(x, y) in }
+
+
[].first { ↓(temp) in
+    [].first { ↓(temp) in
+        [].first { ↓(temp) in
+            _ = temp
+            return false
+        }
+        return false
+    }
+    return false
+}
+
+
[].first { temp in
+    [].first { ↓(temp) in
+        [].first { ↓(temp) in
+            _ = temp
+            return false
+        }
+        return false
+    }
+    return false
+}
+
+ +
+
+ + +
+
+ + + diff --git a/unneeded_synthesized_initializer.html b/unneeded_synthesized_initializer.html new file mode 100644 index 000000000..27362cc81 --- /dev/null +++ b/unneeded_synthesized_initializer.html @@ -0,0 +1,702 @@ + + + + unneeded_synthesized_initializer Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unneeded Synthesized Initializer

+ +

Default or memberwise initializers that will be automatically synthesized do not need to be manually defined.

+ +
    +
  • Identifier: unneeded_synthesized_initializer
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
struct Foo {
+    let bar: String
+
+    // Synthesized initializer would not be private.
+    private init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
struct Foo {
+    var bar: String
+
+    // Synthesized initializer would not be private.
+    private init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
struct Foo {
+    let bar: String
+
+    // Synthesized initializer would not be fileprivate.
+    fileprivate init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
struct Foo {
+    let bar: String
+
+    // Synthesized initializer would not prepend "foo".
+    init(bar: String) {
+        self.bar = "foo" + bar
+    }
+}
+
+
internal struct Foo {
+    let bar: String
+
+    // Failable initializer
+    init?(bar: String) {
+        self.bar = bar
+    }
+}
+
+
internal struct Foo {
+    let bar: String
+
+    // Initializer throws
+    init(bar: String) throws {
+        self.bar = bar
+    }
+}
+
+
internal struct Foo {
+    let bar: String
+
+    // Different argument labels
+    init(_ bar: String) {
+        self.bar = bar
+    }
+}
+
+
internal struct Foo {
+    var bar: String = "foo"
+
+    // Different default values
+    init(bar: String = "bar") {
+        self.bar = bar
+    }
+}
+
+
internal struct Foo {
+    private static var bar: String
+
+    // var is static
+    init(bar: String) {
+        Self.bar = bar
+    }
+}
+
+
internal struct Foo {
+    private var bar: String
+
+    // var is private
+    init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
internal struct Foo {
+    fileprivate var bar: String
+
+    // var is fileprivate
+    init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
struct Foo {
+    var foo: String
+    var bar: String
+
+    // init has no body
+    init(foo: String, bar: String) {
+    }
+}
+
+
struct Foo {
+    var foo: String
+    var bar: String
+
+    // foo is not initialized
+    init(foo: String, bar: String) {
+        self.bar = bar
+    }
+}
+
+
struct Foo {
+    var foo: String
+    var bar: String
+
+    // Ordering of args is different from properties.
+    init(bar: String, foo: String) {
+        self.foo = foo
+        self.bar = bar
+    }
+}
+
+
@frozen
+public struct Field {
+    @usableFromInline
+    let index: Int
+
+    @usableFromInline
+    let parent: Metadata
+
+    @inlinable // inlinable
+    init(index: Int, parent: Metadata) {
+       self.index = index
+       self.parent = parent
+    }
+}
+
+
internal struct Foo {
+    var bar: String = ""
+    var baz: Int = 0
+
+    // These initializers must be declared.
+    init() { }
+
+    init(bar: String = "", baz: Int = 0) {
+        self.bar = bar
+        self.baz = baz
+    }
+
+    // Because manually declared initializers block
+    // synthesization.
+    init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
struct Foo {
+    init() {
+        print("perform side effect")
+    }
+}
+
+
struct Foo {
+    var bar: Int = 0
+
+    init(bar: Int = 0) {
+        self.bar = bar
+        print("perform side effect")
+    }
+}
+
+
struct Foo {
+    var bar: Int
+
+    init(@Clamped bar: Int) {
+        self.bar = bar
+    }
+}
+
+
struct Foo {
+    let bar: Int
+
+    init(bar: Int) {
+        self.bar = bar
+    }
+    init?() {
+        return nil
+    }
+}
+
+
struct Foo {
+    @available(*, unavailable)
+    init() {}
+}
+
+

Triggering Examples

+
struct Foo {
+    let bar: String
+
+   ↓init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
struct Foo {
+    var bar: String
+
+   ↓init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
private struct Foo {
+    let bar: String
+
+   ↓init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
fileprivate struct Foo {
+    let bar: String
+
+   ↓init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
internal struct Foo {
+    fileprivate var bar: String
+
+   ↓fileprivate init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
internal struct Foo {
+    private var bar: String
+
+   ↓private init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
struct Foo {
+    var foo: String
+    var bar: String
+
+   ↓init(foo: String, bar: String) {
+        self.foo = foo
+        self.bar = bar
+    }
+}
+
+
internal struct Foo {
+    var bar: String
+
+   ↓internal init(bar: String) {
+        self.bar = bar
+    }
+}
+
+
struct Foo {
+    var bar: String = ""
+
+   ↓init() {
+        // Empty initializer will be generated automatically
+        // when all vars have default values.
+    }
+}
+
+
struct Foo {
+    var bar: String = ""
+
+   ↓init() {
+        // Empty initializer
+    }
+
+   ↓init(bar: String = "") {
+        self.bar = bar
+    }
+}
+
+
struct Foo {
+    var bar = ""
+
+   ↓init(bar: String = "") {
+        self.bar = bar
+    }
+}
+
+
struct Outer {
+    struct Inner {
+        let prop: Int
+
+       ↓init(prop: Int) {
+            self.prop = prop
+        }
+    }
+}
+
+
class Foo {
+    struct Bar {
+        let baz: Int
+
+       ↓init(baz: Int) {
+            self.baz = baz
+        }
+    }
+}
+
+
struct Foo {
+    let i: Int
+    struct Bar {
+        let j: Int
+        ↓init(j: Int) {
+            self.j = j
+        }
+    }
+    ↓init(i: Int) {
+        self.i = i
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/unowned_variable_capture.html b/unowned_variable_capture.html new file mode 100644 index 000000000..998814048 --- /dev/null +++ b/unowned_variable_capture.html @@ -0,0 +1,398 @@ + + + + unowned_variable_capture Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unowned Variable Capture

+ +

Prefer capturing references as weak to avoid potential crashes

+ +
    +
  • Identifier: unowned_variable_capture
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
foo { [weak self] in _ }
+
+
foo { [weak self] param in _ }
+
+
foo { [weak bar] in _ }
+
+
foo { [weak bar] param in _ }
+
+
foo { bar in _ }
+
+
foo { $0 }
+
+
final class First {}
+final class Second {
+    unowned var value: First
+    init(value: First) {
+        self.value = value
+    }
+}
+
+

Triggering Examples

+
foo { [↓unowned self] in _ }
+
+
foo { [↓unowned bar] in _ }
+
+
foo { [bar, ↓unowned self] in _ }
+
+ +
+
+ + +
+
+ + + diff --git a/untyped_error_in_catch.html b/untyped_error_in_catch.html new file mode 100644 index 000000000..fd4d28fc5 --- /dev/null +++ b/untyped_error_in_catch.html @@ -0,0 +1,427 @@ + + + + untyped_error_in_catch Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Untyped Error in Catch

+ +

Catch statements should not declare error variables without type casting

+ +
    +
  • Identifier: untyped_error_in_catch
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
do {
+  try foo()
+} catch {}
+
+
do {
+  try foo()
+} catch Error.invalidOperation {
+} catch {}
+
+
do {
+  try foo()
+} catch let error as MyError {
+} catch {}
+
+
do {
+  try foo()
+} catch var error as MyError {
+} catch {}
+
+
do {
+    try something()
+} catch let e where e.code == .fileError {
+    // can be ignored
+} catch {
+    print(error)
+}
+
+

Triggering Examples

+
do {
+  try foo()
+} ↓catch var error {}
+
+
do {
+  try foo()
+} ↓catch let error {}
+
+
do {
+  try foo()
+} ↓catch let someError {}
+
+
do {
+  try foo()
+} ↓catch var someError {}
+
+
do {
+  try foo()
+} ↓catch let e {}
+
+
do {
+  try foo()
+} ↓catch(let error) {}
+
+
do {
+  try foo()
+} ↓catch (let error) {}
+
+ +
+
+ + +
+
+ + + diff --git a/unused_closure_parameter.html b/unused_closure_parameter.html new file mode 100644 index 000000000..ed7e3ed93 --- /dev/null +++ b/unused_closure_parameter.html @@ -0,0 +1,485 @@ + + + + unused_closure_parameter Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unused Closure Parameter

+ +

Unused parameter in a closure should be replaced with _

+ +
    +
  • Identifier: unused_closure_parameter
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
[1, 2].map { $0 + 1 }
+
+
[1, 2].map({ $0 + 1 })
+
+
[1, 2].map { number in
+ number + 1 
+}
+
+
[1, 2].map { _ in
+ 3 
+}
+
+
[1, 2].something { number, idx in
+ return number * idx
+}
+
+
let isEmpty = [1, 2].isEmpty()
+
+
violations.sorted(by: { lhs, rhs in 
+ return lhs.location > rhs.location
+})
+
+
rlmConfiguration.migrationBlock.map { rlmMigration in
+    return { migration, schemaVersion in
+        rlmMigration(migration.rlmMigration, schemaVersion)
+    }
+}
+
+
genericsFunc { (a: Type, b) in
+    a + b
+}
+
+
var label: UILabel = { (lbl: UILabel) -> UILabel in
+    lbl.backgroundColor = .red
+    return lbl
+}(UILabel())
+
+
hoge(arg: num) { num in
+    return num
+}
+
+
({ (manager: FileManager) in
+  print(manager)
+})(FileManager.default)
+
+
withPostSideEffect { input in
+    if true { print("\(input)") }
+}
+
+
viewModel?.profileImage.didSet(weak: self) { (self, profileImage) in
+    self.profileImageView.image = profileImage
+}
+
+
let failure: Failure = { task, error in
+    observer.sendFailed(error, task)
+}
+
+
List($names) { $name in
+    Text(name)
+}
+
+
List($names) { $name in
+    TextField($name)
+}
+
+
_ = ["a"].filter { `class` in `class`.hasPrefix("a") }
+
+
let closure: (Int) -> Void = { `foo` in _ = foo }
+
+
let closure: (Int) -> Void = { foo in _ = `foo` }
+
+

Triggering Examples

+
[1, 2].map { ↓number in
+ return 3 }
+
+
[1, 2].map { ↓number in
+ return numberWithSuffix }
+
+
[1, 2].map { ↓number in
+ return 3 // number }
+
+
[1, 2].map { ↓number in
+ return 3 "number" }
+
+
[1, 2].something { number, ↓idx in
+ return number }
+
+
genericsFunc { (↓number: TypeA, idx: TypeB) in return idx }
+
+
let c: (Int) -> Void = { foo in _ = .foo }
+
+
hoge(arg: num) { ↓num in
+}
+
+
fooFunc { ↓아 in }
+
+
func foo () {
+ bar { ↓number in return 3 }
+
+
viewModel?.profileImage.didSet(weak: self) { (↓self, profileImage) in
+    profileImageView.image = profileImage
+}
+
+
let failure: Failure = { ↓task, error in
+    observer.sendFailed(error)
+}
+
+
List($names) { ↓$name in
+    Text("Foo")
+}
+
+
let class1 = "a"
+_ = ["a"].filter { ↓`class` in `class1`.hasPrefix("a") }
+
+ +
+
+ + +
+
+ + + diff --git a/unused_control_flow_label.html b/unused_control_flow_label.html new file mode 100644 index 000000000..b1b7c585f --- /dev/null +++ b/unused_control_flow_label.html @@ -0,0 +1,415 @@ + + + + unused_control_flow_label Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unused Control Flow Label

+ +

Unused control flow label should be removed

+ +
    +
  • Identifier: unused_control_flow_label
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
loop: while true { break loop }
+
+
loop: while true { continue loop }
+
+
loop:
+    while true { break loop }
+
+
while true { break }
+
+
loop: for x in array { break loop }
+
+
label: switch number {
+case 1: print("1")
+case 2: print("2")
+default: break label
+}
+
+
loop: repeat {
+    if x == 10 {
+        break loop
+    }
+} while true
+
+

Triggering Examples

+
↓loop: while true { break }
+
+
↓loop: while true { break loop1 }
+
+
↓loop: while true { break outerLoop }
+
+
↓loop: for x in array { break }
+
+
↓label: switch number {
+case 1: print("1")
+case 2: print("2")
+default: break
+}
+
+
↓loop: repeat {
+    if x == 10 {
+        break
+    }
+} while true
+
+ +
+
+ + +
+
+ + + diff --git a/unused_declaration.html b/unused_declaration.html new file mode 100644 index 000000000..a4fa99521 --- /dev/null +++ b/unused_declaration.html @@ -0,0 +1,667 @@ + + + + unused_declaration Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unused Declaration

+ +

Declarations should be referenced at least once within all files linted

+ +
    +
  • Identifier: unused_declaration
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: Yes
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +error +
    +include_public_and_open + +false +
    +related_usrs_to_skip + +[“s:7SwiftUI15PreviewProviderP”] +
  • +
+

Non Triggering Examples

+
let kConstant = 0
+_ = kConstant
+
+
enum Change<T> {
+  case insert(T)
+  case delete(T)
+}
+
+extension Sequence {
+  func deletes<T>() -> [T] where Element == Change<T> {
+    return compactMap { operation in
+      if case .delete(let value) = operation {
+        return value
+      } else {
+        return nil
+      }
+    }
+  }
+}
+
+let changes = [Change.insert(0), .delete(0)]
+_ = changes.deletes()
+
+
struct Item: Codable {}
+struct ResponseModel: Codable {
+    let items: [Item]
+
+    enum CodingKeys: String, CodingKey {
+        case items = "ResponseItems"
+    }
+}
+
+_ = ResponseModel(items: [Item()]).items
+
+
class ResponseModel {
+    @objc func foo() {
+    }
+}
+_ = ResponseModel()
+
+
public func foo() {}
+
+
protocol Foo {}
+
+extension Foo {
+    func bar() {}
+}
+
+struct MyStruct: Foo {}
+MyStruct().bar()
+
+
import XCTest
+class MyTests: XCTestCase {
+    func testExample() {}
+}
+
+
import XCTest
+open class BestTestCase: XCTestCase {}
+class MyTests: BestTestCase {
+    func testExample() {}
+}
+
+
    struct S {
+        var i: Int? = nil
+        func f() {
+            if let i { print(i) }
+        }
+    }
+    S().f()
+
+
enum Component {
+  case string(StaticString)
+  indirect case array([Component])
+  indirect case optional(Component?)
+}
+
+@resultBuilder
+struct ComponentBuilder {
+  static func buildBlock(_ components: Component...) -> Component {
+    return .array(components)
+  }
+
+  static func buildExpression(_ string: StaticString) -> Component {
+    return .string(string)
+  }
+
+  static func buildOptional(_ component: Component?) -> Component {
+    return .optional(component)
+  }
+
+  static func buildEither(first component: Component) -> Component {
+    return component
+  }
+
+  static func buildEither(second component: Component) -> Component {
+    return component
+  }
+
+  static func buildArray(_ components: [Component]) -> Component {
+    return .array(components)
+  }
+
+  static func buildLimitedAvailability(_ component: Component) -> Component {
+    return component
+  }
+
+  static func buildFinalResult(_ component: Component) -> Component {
+    return component
+  }
+
+  static func buildPartialBlock(first component: Component) -> Component {
+    return component
+  }
+
+  static func buildPartialBlock(accumulated component: Component, next: Component) -> Component {
+    return component
+  }
+}
+
+func acceptComponentBuilder(@ComponentBuilder _ body: () -> Component) {
+  print(body())
+}
+
+acceptComponentBuilder {
+  "hello"
+}
+
+
import Cocoa
+
+@NSApplicationMain
+final class AppDelegate: NSObject, NSApplicationDelegate {
+    func applicationWillFinishLaunching(_ notification: Notification) {}
+    func applicationWillBecomeActive(_ notification: Notification) {}
+}
+
+
import Foundation
+
+public final class Foo: NSObject {
+    @IBAction private func foo() {}
+}
+
+
import Foundation
+
+public final class Foo: NSObject {
+    @objc func foo() {}
+}
+
+
import Foundation
+
+public final class Foo: NSObject {
+    @IBInspectable private var innerPaddingWidth: Int {
+        set { self.backgroundView.innerPaddingWidth = newValue }
+        get { return self.backgroundView.innerPaddingWidth }
+    }
+}
+
+
import Foundation
+
+public final class Foo: NSObject {
+    @IBOutlet private var bar: NSObject! {
+        set { fatalError() }
+        get { fatalError() }
+    }
+
+    @IBOutlet private var baz: NSObject! {
+        willSet { print("willSet") }
+    }
+
+    @IBOutlet private var buzz: NSObject! {
+        didSet { print("didSet") }
+    }
+}
+
+

Triggering Examples

+
let ↓kConstant = 0
+
+
struct Item {}
+struct ↓ResponseModel: Codable {
+    let ↓items: [Item]
+
+    enum ↓CodingKeys: String {
+        case items = "ResponseItems"
+    }
+}
+
+
class ↓ResponseModel {
+    func ↓foo() {
+    }
+}
+
+
//
+// include_public_and_open: true
+//
+
+public func ↓foo() {}
+
+
+
protocol Foo {
+    func ↓bar1()
+}
+
+extension Foo {
+    func bar1() {}
+    func ↓bar2() {}
+}
+
+struct MyStruct: Foo {}
+_ = MyStruct()
+
+
import XCTest
+class ↓MyTests: NSObject {
+    func ↓testExample() {}
+}
+
+
enum Component {
+  case string(StaticString)
+  indirect case array([Component])
+  indirect case optional(Component?)
+}
+
+struct ComponentBuilder {
+  func ↓buildExpression(_ string: StaticString) -> Component {
+    return .string(string)
+  }
+
+  func ↓buildBlock(_ components: Component...) -> Component {
+    return .array(components)
+  }
+
+  func ↓buildIf(_ value: Component?) -> Component {
+    return .optional(value)
+  }
+
+  static func ↓buildABear(_ components: Component...) -> Component {
+    return .array(components)
+  }
+}
+
+_ = ComponentBuilder()
+
+
protocol ↓Foo {}
+extension Foo {}
+
+
class ↓C<T> {}
+extension C<Int> {}
+
+
import Cocoa
+
+@NSApplicationMain
+final class AppDelegate: NSObject, NSApplicationDelegate {
+    func ↓appWillFinishLaunching(_ notification: Notification) {}
+    func applicationWillBecomeActive(_ notification: Notification) {}
+}
+
+
import Cocoa
+
+final class ↓AppDelegate: NSObject, NSApplicationDelegate {
+    func applicationWillFinishLaunching(_ notification: Notification) {}
+    func applicationWillBecomeActive(_ notification: Notification) {}
+}
+
+
import Foundation
+
+public final class Foo: NSObject {
+    @IBOutlet var ↓bar: NSObject!
+}
+
+
import Foundation
+
+public final class Foo: NSObject {
+    @IBInspectable var ↓bar: String!
+}
+
+
import Foundation
+
+final class Foo: NSObject {}
+final class ↓Bar {
+    var ↓foo = Foo()
+}
+
+ +
+
+ + +
+
+ + + diff --git a/unused_enumerated.html b/unused_enumerated.html new file mode 100644 index 000000000..261cd00cd --- /dev/null +++ b/unused_enumerated.html @@ -0,0 +1,435 @@ + + + + unused_enumerated Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unused Enumerated

+ +

When the index or the item is not used, .enumerated() can be removed.

+ +
    +
  • Identifier: unused_enumerated
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
for (idx, foo) in bar.enumerated() { }
+
+
for (_, foo) in bar.enumerated().something() { }
+
+
for (_, foo) in bar.something() { }
+
+
for foo in bar.enumerated() { }
+
+
for foo in bar { }
+
+
for (idx, _) in bar.enumerated().something() { }
+
+
for (idx, _) in bar.something() { }
+
+
for idx in bar.indices { }
+
+
for (section, (event, _)) in data.enumerated() {}
+
+
list.enumerated().map { idx, elem in "\(idx): \(elem)" }
+
+
list.enumerated().map { $0 + $1 }
+
+
list.enumerated().something().map { _, elem in elem }
+
+
list.enumerated().map { ($0.offset, $0.element) }
+
+
list.enumerated().map { ($0.0, $0.1) }
+
+
list.enumerated().map {
+    $1.enumerated().forEach { print($0, $1) }
+    return $0
+}
+
+

Triggering Examples

+
for (↓_, foo) in bar.enumerated() { }
+
+
for (↓_, foo) in abc.bar.enumerated() { }
+
+
for (↓_, foo) in abc.something().enumerated() { }
+
+
for (idx, ↓_) in bar.enumerated() { }
+
+
list.enumerated().map { idx, ↓_ in idx }
+
+
list.enumerated().map { ↓_, elem in elem }
+
+
list.↓enumerated().forEach { print($0) }
+
+
list.↓enumerated().map { $1 }
+
+
list.enumerated().map {
+    $1.↓enumerated().forEach { print($1) }
+    return $0
+}
+
+
list.↓enumerated().map {
+    $1.enumerated().forEach { print($0, $1) }
+    return 1
+}
+
+
list.↓enumerated().forEach {
+    let (i, _) = $0
+}
+
+ +
+
+ + +
+
+ + + diff --git a/unused_import.html b/unused_import.html new file mode 100644 index 000000000..f12571173 --- /dev/null +++ b/unused_import.html @@ -0,0 +1,454 @@ + + + + unused_import Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unused Import

+ +

All imported modules should be required to make the file compile

+ +
    +
  • Identifier: unused_import
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: Yes
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +require_explicit_imports + +false +
    +allowed_transitive_imports + +[] +
    +always_keep_imports + +[] +
  • +
+

Non Triggering Examples

+
import Dispatch // This is used
+dispatchMain()
+
+
@testable import Dispatch
+dispatchMain()
+
+
import Foundation
+@objc
+class A {}
+
+
import UnknownModule
+func foo(error: Swift.Error) {}
+
+
@_exported import UnknownModule
+
+
import Foundation
+let 👨‍👩‍👧‍👦 = #selector(NSArray.contains(_:))
+👨‍👩‍👧‍👦 == 👨‍👩‍👧‍👦
+
+
//
+// allowed_transitive_imports: [Foundation: ["CoreFoundation"]]
+//
+
+import Foundation
+enum E {
+    static let min: CGFloat = 44
+}
+
+
+

Triggering Examples

+
↓import Dispatch
+struct A {
+  static func dispatchMain() {}
+}
+A.dispatchMain()
+
+
↓import Foundation // This is unused
+struct A {
+  static func dispatchMain() {}
+}
+A.dispatchMain()
+↓import Dispatch
+
+
+
↓import Foundation
+dispatchMain()
+
+
↓import Foundation
+// @objc
+class A {}
+
+
↓import Foundation
+import UnknownModule
+func foo(error: Swift.Error) {}
+
+
↓import Swift
+↓import SwiftShims
+func foo(error: Swift.Error) {}
+
+ +
+
+ + +
+
+ + + diff --git a/unused_optional_binding.html b/unused_optional_binding.html new file mode 100644 index 000000000..226fb6346 --- /dev/null +++ b/unused_optional_binding.html @@ -0,0 +1,410 @@ + + + + unused_optional_binding Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unused Optional Binding

+ +

Prefer != nil over let _ =

+ +
    +
  • Identifier: unused_optional_binding
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +ignore_optional_try + +false +
  • +
+

Non Triggering Examples

+
if let bar = Foo.optionalValue {}
+
+
if let (_, second) = getOptionalTuple() {}
+
+
if let (_, asd, _) = getOptionalTuple(), let bar = Foo.optionalValue {}
+
+
if foo() { let _ = bar() }
+
+
if foo() { _ = bar() }
+
+
if case .some(_) = self {}
+
+
if let point = state.find({ _ in true }) {}
+
+

Triggering Examples

+
if let ↓_ = Foo.optionalValue {}
+
+
if let a = Foo.optionalValue, let ↓_ = Foo.optionalValue2 {}
+
+
guard let a = Foo.optionalValue, let ↓_ = Foo.optionalValue2 {}
+
+
if let (first, second) = getOptionalTuple(), let ↓_ = Foo.optionalValue {}
+
+
if let (first, _) = getOptionalTuple(), let ↓_ = Foo.optionalValue {}
+
+
if let (_, second) = getOptionalTuple(), let ↓_ = Foo.optionalValue {}
+
+
if let ↓(_, _, _) = getOptionalTuple(), let bar = Foo.optionalValue {}
+
+
func foo() { if let ↓_ = bar {} }
+
+ +
+
+ + +
+
+ + + diff --git a/unused_parameter.html b/unused_parameter.html new file mode 100644 index 000000000..cb24ef88c --- /dev/null +++ b/unused_parameter.html @@ -0,0 +1,449 @@ + + + + unused_parameter Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unused Parameter

+ +

Other than unused local variable declarations, unused function/initializer/subscript parameters are not marked by the Swift compiler. Since unused parameters are code smells, they should either be removed or replaced/shadowed by a wildcard ‘_’ to indicate that they are being deliberately disregarded.

+ +
    +
  • Identifier: unused_parameter
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func f(a: Int) {
+    _ = a
+}
+
+
func f(case: Int) {
+    _ = `case`
+}
+
+
func f(a _: Int) {}
+
+
func f(_: Int) {}
+
+
func f(a: Int, b c: String) {
+    func g() {
+        _ = a
+        _ = c
+    }
+}
+
+
func f(a: Int, c: Int) -> Int {
+    struct S {
+        let b = 1
+        func f(a: Int, b: Int = 2) -> Int { a + b }
+    }
+    return a + c
+}
+
+
func f(a: Int?) {
+    if let a {}
+}
+
+
func f(a: Int) {
+    let a = a
+    return a
+}
+
+
func f(`operator`: Int) -> Int { `operator` }
+
+

Triggering Examples

+
func f(↓a: Int) {}
+
+
func f(↓a: Int, b ↓c: String) {}
+
+
func f(↓a: Int, b ↓c: String) {
+    func g(a: Int, ↓b: Double) {
+        _ = a
+    }
+}
+
+
struct S {
+    let a: Int
+
+    init(a: Int, ↓b: Int) {
+        func f(↓a: Int, b: Int) -> Int { b }
+        self.a = f(a: a, b: 0)
+    }
+}
+
+
struct S {
+    subscript(a: Int, ↓b: Int) {
+        func f(↓a: Int, b: Int) -> Int { b }
+        return f(a: a, b: 0)
+    }
+}
+
+
func f(↓a: Int, ↓b: Int, c: Int) -> Int {
+    struct S {
+        let b = 1
+        func f(a: Int, ↓c: Int = 2) -> Int { a + b }
+    }
+    return S().f(a: c)
+}
+
+
func f(↓a: Int, c: String) {
+    let a = 1
+    return a + c
+}
+
+ +
+
+ + +
+
+ + + diff --git a/unused_setter_value.html b/unused_setter_value.html new file mode 100644 index 000000000..b715d35ab --- /dev/null +++ b/unused_setter_value.html @@ -0,0 +1,461 @@ + + + + unused_setter_value Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Unused Setter Value

+ +

Setter value is not used

+ +
    +
  • Identifier: unused_setter_value
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
var aValue: String {
+    get {
+        return Persister.shared.aValue
+    }
+    set {
+        Persister.shared.aValue = newValue
+    }
+}
+
+
var aValue: String {
+    set {
+        Persister.shared.aValue = newValue
+    }
+    get {
+        return Persister.shared.aValue
+    }
+}
+
+
var aValue: String {
+    get {
+        return Persister.shared.aValue
+    }
+    set(value) {
+        Persister.shared.aValue = value
+    }
+}
+
+
override var aValue: String {
+ get {
+     return Persister.shared.aValue
+ }
+ set { }
+}
+
+

Triggering Examples

+
var aValue: String {
+    get {
+        return Persister.shared.aValue
+    }
+    ↓set {
+        Persister.shared.aValue = aValue
+    }
+}
+
+
var aValue: String {
+    ↓set {
+        Persister.shared.aValue = aValue
+    }
+    get {
+        return Persister.shared.aValue
+    }
+}
+
+
var aValue: String {
+    get {
+        return Persister.shared.aValue
+    }
+    ↓set {
+        Persister.shared.aValue = aValue
+    }
+}
+
+
var aValue: String {
+    get {
+        let newValue = Persister.shared.aValue
+        return newValue
+    }
+    ↓set {
+        Persister.shared.aValue = aValue
+    }
+}
+
+
var aValue: String {
+    get {
+        return Persister.shared.aValue
+    }
+    ↓set(value) {
+        Persister.shared.aValue = aValue
+    }
+}
+
+
override var aValue: String {
+    get {
+        return Persister.shared.aValue
+    }
+    ↓set {
+        Persister.shared.aValue = aValue
+    }
+}
+
+ +
+
+ + +
+
+ + + diff --git a/valid_ibinspectable.html b/valid_ibinspectable.html new file mode 100644 index 000000000..3f4fc1b5c --- /dev/null +++ b/valid_ibinspectable.html @@ -0,0 +1,448 @@ + + + + valid_ibinspectable Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Valid IBInspectable

+ +

@IBInspectable should be applied to variables only, have its type explicit and be of a supported type

+ +
    +
  • Identifier: valid_ibinspectable
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class Foo {
+  @IBInspectable private var x: Int
+}
+
+
class Foo {
+  @IBInspectable private var x: String?
+}
+
+
class Foo {
+  @IBInspectable private var x: String!
+}
+
+
class Foo {
+  @IBInspectable private var count: Int = 0
+}
+
+
class Foo {
+  private var notInspectable = 0
+}
+
+
class Foo {
+  private let notInspectable: Int
+}
+
+
class Foo {
+  private let notInspectable: UInt8
+}
+
+
extension Foo {
+    @IBInspectable var color: UIColor {
+        set {
+            self.bar.textColor = newValue
+        }
+
+        get {
+            return self.bar.textColor
+        }
+    }
+}
+
+
class Foo {
+    @IBInspectable var borderColor: UIColor? = nil {
+        didSet {
+            updateAppearance()
+        }
+    }
+}
+
+

Triggering Examples

+
class Foo {
+  @IBInspectable private ↓let count: Int
+}
+
+
class Foo {
+  @IBInspectable private ↓var insets: UIEdgeInsets
+}
+
+
class Foo {
+  @IBInspectable private ↓var count = 0
+}
+
+
class Foo {
+  @IBInspectable private ↓var count: Int?
+}
+
+
class Foo {
+  @IBInspectable private ↓var count: Int!
+}
+
+
class Foo {
+  @IBInspectable private ↓var count: Optional<Int>
+}
+
+
class Foo {
+  @IBInspectable private ↓var x: Optional<String>
+}
+
+ +
+
+ + +
+
+ + + diff --git a/vertical_parameter_alignment.html b/vertical_parameter_alignment.html new file mode 100644 index 000000000..7ee457069 --- /dev/null +++ b/vertical_parameter_alignment.html @@ -0,0 +1,437 @@ + + + + vertical_parameter_alignment Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Vertical Parameter Alignment

+ +

Function parameters should be aligned vertically if they’re in multiple lines in a declaration

+ +
    +
  • Identifier: vertical_parameter_alignment
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func validateFunction(_ file: SwiftLintFile, kind: SwiftDeclarationKind,
+                      dictionary: SourceKittenDictionary) { }
+
+
func validateFunction(_ file: SwiftLintFile, kind: SwiftDeclarationKind,
+                      dictionary: SourceKittenDictionary) -> [StyleViolation]
+
+
func foo(bar: Int)
+
+
func foo(bar: Int) -> String
+
+
func validateFunction(_ file: SwiftLintFile, kind: SwiftDeclarationKind,
+                      dictionary: SourceKittenDictionary)
+                      -> [StyleViolation]
+
+
func validateFunction(
+   _ file: SwiftLintFile, kind: SwiftDeclarationKind,
+   dictionary: SourceKittenDictionary) -> [StyleViolation]
+
+
func validateFunction(
+   _ file: SwiftLintFile, kind: SwiftDeclarationKind,
+   dictionary: SourceKittenDictionary
+) -> [StyleViolation]
+
+
func regex(_ pattern: String,
+           options: NSRegularExpression.Options = [.anchorsMatchLines,
+                                                   .dotMatchesLineSeparators]) -> NSRegularExpression
+
+
func foo(a: Void,
+         b: [String: String] =
+         [:]) {
+}
+
+
func foo(data: (size: CGSize,
+                identifier: String)) {}
+
+
func foo(data: Data,
+         @ViewBuilder content: @escaping (Data.Element.IdentifiedValue) -> Content) {}
+
+
class A {
+    init(bar: Int)
+}
+
+
class A {
+    init(foo: Int,
+         bar: String)
+}
+
+

Triggering Examples

+
func validateFunction(_ file: SwiftLintFile, kind: SwiftDeclarationKind,
+                  ↓dictionary: SourceKittenDictionary) { }
+
+
func validateFunction(_ file: SwiftLintFile, kind: SwiftDeclarationKind,
+                       ↓dictionary: SourceKittenDictionary) { }
+
+
func validateFunction(_ file: SwiftLintFile,
+                  ↓kind: SwiftDeclarationKind,
+                  ↓dictionary: SourceKittenDictionary) { }
+
+
func foo(data: Data,
+            ↓@ViewBuilder content: @escaping (Data.Element.IdentifiedValue) -> Content) {}
+
+
class A {
+    init(data: Data,
+                ↓@ViewBuilder content: @escaping (Data.Element.IdentifiedValue) -> Content) {}
+}
+
+ +
+
+ + +
+
+ + + diff --git a/vertical_parameter_alignment_on_call.html b/vertical_parameter_alignment_on_call.html new file mode 100644 index 000000000..6ebc136e5 --- /dev/null +++ b/vertical_parameter_alignment_on_call.html @@ -0,0 +1,460 @@ + + + + vertical_parameter_alignment_on_call Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Vertical Parameter Alignment on Call

+ +

Function parameters should be aligned vertically if they’re in multiple lines in a method call

+ +
    +
  • Identifier: vertical_parameter_alignment_on_call
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
foo(param1: 1, param2: bar
+    param3: false, param4: true)
+
+
foo(param1: 1, param2: bar)
+
+
foo(param1: 1, param2: bar
+    param3: false,
+    param4: true)
+
+
foo(
+   param1: 1
+) { _ in }
+
+
UIView.animate(withDuration: 0.4, animations: {
+    blurredImageView.alpha = 1
+}, completion: { _ in
+    self.hideLoading()
+})
+
+
UIView.animate(withDuration: 0.4, animations: {
+    blurredImageView.alpha = 1
+},
+completion: { _ in
+    self.hideLoading()
+})
+
+
UIView.animate(withDuration: 0.4, animations: {
+    blurredImageView.alpha = 1
+} { _ in
+    self.hideLoading()
+}
+
+
foo(param1: 1, param2: { _ in },
+    param3: false, param4: true)
+
+
foo({ _ in
+       bar()
+   },
+   completion: { _ in
+       baz()
+   }
+)
+
+
foo(param1: 1, param2: [
+   0,
+   1
+], param3: 0)
+
+
myFunc(foo: 0,
+       bar: baz == 0)
+
+
UIViewPropertyAnimator.runningPropertyAnimator(
+    withDuration: 2.0,
+    delay: 0.0,
+    options: [.curveEaseIn]
+) {
+    // animations
+} completion: { _ in
+    // completion
+}
+
+

Triggering Examples

+
foo(param1: 1, param2: bar,
+                ↓param3: false, param4: true)
+
+
foo(param1: 1, param2: bar,
+ ↓param3: false, param4: true)
+
+
foo(param1: 1, param2: bar,
+       ↓param3: false,
+       ↓param4: true)
+
+
foo(param1: 1,
+       ↓param2: { _ in })
+
+
foo(param1: 1,
+    param2: { _ in
+}, param3: 2,
+ ↓param4: 0)
+
+
foo(param1: 1, param2: { _ in },
+       ↓param3: false, param4: true)
+
+
myFunc(foo: 0,
+        ↓bar: baz == 0)
+
+
myFunc(foo: 0, bar:
+        baz == 0, ↓baz: true)
+
+ +
+
+ + +
+
+ + + diff --git a/vertical_whitespace.html b/vertical_whitespace.html new file mode 100644 index 000000000..7e56d6975 --- /dev/null +++ b/vertical_whitespace.html @@ -0,0 +1,413 @@ + + + + vertical_whitespace Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Vertical Whitespace

+ +

Limit vertical whitespace to a single empty line.

+ +
    +
  • Identifier: vertical_whitespace
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +max_empty_lines + +1 +
  • +
+

Non Triggering Examples

+
let abc = 0
+
+
+
let abc = 0
+
+
+
+
/* bcs 
+
+
+
+*/
+
+
// bca 
+
+
+
+

Triggering Examples

+
let aaaa = 0
+
+
+
+
+
struct AAAA {}
+
+
+
+
+
+
class BBBB {}
+
+
+
+
+ +
+
+ + +
+
+ + + diff --git a/vertical_whitespace_between_cases.html b/vertical_whitespace_between_cases.html new file mode 100644 index 000000000..551a70406 --- /dev/null +++ b/vertical_whitespace_between_cases.html @@ -0,0 +1,482 @@ + + + + vertical_whitespace_between_cases Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Vertical Whitespace Between Cases

+ +

Include a single empty line between switch cases

+ +
    +
  • Identifier: vertical_whitespace_between_cases
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
switch x {
+
+case 0..<5:
+    print("x is low")
+
+case 5..<10:
+    print("x is high")
+
+default:
+    print("x is invalid")
+
+@unknown default:
+    print("x is out of this world")
+}
+
+
switch x {
+case .valid:
+    print("multiple ...")
+    print("... lines")
+
+case .invalid:
+    print("multiple ...")
+    print("... lines")
+}
+
+
switch x {
+case .valid:
+    print("x is valid")
+
+case .invalid:
+    print("x is invalid")
+}
+
+
switch x {
+case 0..<5:
+    print("x is low")
+
+case 5..<10:
+    print("x is high")
+
+default:
+    print("x is invalid")
+}
+
+
switch x {
+case 0..<5:
+    print("x is valid")
+
+default:
+    print("x is invalid")
+}
+
+
switch x {
+case 0..<5:
+    return "x is valid"
+
+default:
+    return "x is invalid"
+
+@unknown default:
+    print("x is out of this world")
+}
+
+
switch x {
+case 0..<5: print("x is low")
+case 5..<10: print("x is high")
+default: print("x is invalid")
+@unknown default: print("x is out of this world")
+}
+
+
switch x {    
+case 1:    
+    print("one")    
+
+default:    
+    print("not one")    
+}    
+
+

Triggering Examples

+
switch x {
+case .valid:
+    print("multiple ...")
+    print("... lines")
+↓case .invalid:
+    print("multiple ...")
+    print("... lines")
+}
+
+
switch x {
+case .valid:
+    print("x is valid")
+↓case .invalid:
+    print("x is invalid")
+}
+
+
switch x {
+case 0..<5:
+    print("x is valid")
+↓default:
+    print("x is invalid")
+}
+
+
switch x {
+case 0..<5:
+    return "x is valid"
+↓default:
+    return "x is invalid"
+↓@unknown default:
+    print("x is out of this world")
+}
+
+ +
+
+ + +
+
+ + + diff --git a/vertical_whitespace_closing_braces.html b/vertical_whitespace_closing_braces.html new file mode 100644 index 000000000..a5cf5a031 --- /dev/null +++ b/vertical_whitespace_closing_braces.html @@ -0,0 +1,510 @@ + + + + vertical_whitespace_closing_braces Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Vertical Whitespace before Closing Braces

+ +

Don’t include vertical whitespace (empty line) before closing braces

+ +
    +
  • Identifier: vertical_whitespace_closing_braces
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +only_enforce_before_trivial_lines + +false +
  • +
+

Non Triggering Examples

+
[
+1,
+2,
+3
+]
+
+
do {
+  print("x is 5")
+}
+
+
do {
+  print("x is 5")
+}
+
+
do {
+  print("x is 5")
+}
+
+
foo(
+    x: 5,
+    y:6
+)
+
+
func foo() {
+  run(5) { x in
+    print(x)
+  }
+}
+
+
//
+// only_enforce_before_trivial_lines: true
+//
+
+print([
+  1
+])
+
+
+
//
+// only_enforce_before_trivial_lines: true
+//
+
+print([foo {
+  var sum = 0
+  for i in 1...5 { sum += i }
+  return sum
+
+}, foo {
+  var mul = 1
+  for i in 1...5 { mul *= i }
+  return mul
+}])
+
+
+
[1, 2].map { $0 }.filter { true }
+
+
[1, 2].map { $0 }.filter { num in true }
+
+
/*
+    class X {
+
+        let x = 5
+
+    }
+*/
+
+

Triggering Examples

+
[
+1,
+2,
+3
+↓
+]
+
+
do {
+  print("x is 5")
+↓
+
+}
+
+
do {
+  print("x is 5")
+↓
+
+}
+
+
do {
+  print("x is 5")
+↓
+}
+
+
foo(
+    x: 5,
+    y:6
+↓
+)
+
+
func foo() {
+  run(5) { x in
+    print(x)
+  }
+↓
+}
+
+
//
+// only_enforce_before_trivial_lines: true
+//
+
+print([
+  1
+↓
+])
+
+
+
//
+// only_enforce_before_trivial_lines: true
+//
+
+print([foo {
+  var sum = 0
+  for i in 1...5 { sum += i }
+  return sum
+
+}, foo {
+  var mul = 1
+  for i in 1...5 { mul *= i }
+  return mul
+↓
+}])
+
+
+ +
+
+ + +
+
+ + + diff --git a/vertical_whitespace_opening_braces.html b/vertical_whitespace_opening_braces.html new file mode 100644 index 000000000..7e605c495 --- /dev/null +++ b/vertical_whitespace_opening_braces.html @@ -0,0 +1,486 @@ + + + + vertical_whitespace_opening_braces Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Vertical Whitespace after Opening Braces

+ +

Don’t include vertical whitespace (empty line) after opening braces

+ +
    +
  • Identifier: vertical_whitespace_opening_braces
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
/*
+    class X {
+
+        let x = 5
+
+    }
+*/
+
+
// [1, 2].map { $0 }.filter { num in true }
+
+
KingfisherManager.shared.retrieveImage(with: url, options: nil, progressBlock: nil) { image, _, _, _ in
+    guard let img = image else { return }
+}
+
+
[
+1,
+2,
+3
+]
+
+
[1, 2].map { $0 }.filter { num in true }
+
+
[1, 2].map { $0 }.foo()
+
+
class X {
+  struct Y {
+    class Z {
+    }
+  }
+}
+
+
foo(
+  x: 5,
+  y:6
+)
+
+
foo({ }) { _ in
+  self.dismiss(animated: false, completion: {
+  })
+}
+
+
func foo() {
+  run(5) { x in
+    print(x)
+  }
+}
+
+
if x == 5 {
+  print("x is 5")
+}
+
+
if x == 5 {
+  print("x is 5")
+}
+
+
struct MyStruct {
+  let x = 5
+}
+
+

Triggering Examples

+
KingfisherManager.shared.retrieveImage(with: url, options: nil, progressBlock: nil) { image, _, _, _ in
+↓
+    guard let img = image else { return }
+}
+
+
[
+↓
+1,
+2,
+3
+]
+
+
class X {
+  struct Y {
+↓
+    class Z {
+    }
+  }
+}
+
+
foo(
+↓
+  x: 5,
+  y:6
+)
+
+
foo({ }) { _ in
+↓
+  self.dismiss(animated: false, completion: {
+  })
+}
+
+
func foo() {
+↓
+  run(5) { x in
+    print(x)
+  }
+}
+
+
if x == 5 {
+↓
+
+  print("x is 5")
+}
+
+
if x == 5 {
+↓
+  print("x is 5")
+}
+
+
struct MyStruct {
+↓
+  let x = 5
+}
+
+ +
+
+ + +
+
+ + + diff --git a/void_function_in_ternary.html b/void_function_in_ternary.html new file mode 100644 index 000000000..27034bb7e --- /dev/null +++ b/void_function_in_ternary.html @@ -0,0 +1,451 @@ + + + + void_function_in_ternary Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Void Function in Ternary

+ +

Using ternary to call Void functions should be avoided

+ +
    +
  • Identifier: void_function_in_ternary
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.1.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let result = success ? foo() : bar()
+
+
if success {
+    askQuestion()
+} else {
+    exit()
+}
+
+
var price: Double {
+    return hasDiscount ? calculatePriceWithDiscount() : calculateRegularPrice()
+}
+
+
foo(x == 2 ? a() : b())
+
+
chevronView.image = collapsed ? .icon(.mediumChevronDown) : .icon(.mediumChevronUp)
+
+
array.map { elem in
+    elem.isEmpty() ? .emptyValue() : .number(elem)
+}
+
+
func compute(data: [Int]) -> Int {
+    data.isEmpty ? 0 : expensiveComputation(data)
+}
+
+
var value: Int {
+    mode == .fast ? fastComputation() : expensiveComputation()
+}
+
+
var value: Int {
+    get {
+        mode == .fast ? fastComputation() : expensiveComputation()
+    }
+}
+
+
subscript(index: Int) -> Int {
+    get {
+        index == 0 ? defaultValue() : compute(index)
+    }
+
+
subscript(index: Int) -> Int {
+    index == 0 ? defaultValue() : compute(index)
+
+

Triggering Examples

+
success ↓? askQuestion() : exit()
+
+
perform { elem in
+    elem.isEmpty() ↓? .emptyValue() : .number(elem)
+    return 1
+}
+
+
DispatchQueue.main.async {
+    self.sectionViewModels[section].collapsed.toggle()
+    self.sectionViewModels[section].collapsed
+        ↓? self.tableView.deleteRows(at: [IndexPath(row: 0, section: section)], with: .automatic)
+        : self.tableView.insertRows(at: [IndexPath(row: 0, section: section)], with: .automatic)
+    self.tableView.scrollToRow(at: IndexPath(row: NSNotFound, section: section), at: .top, animated: true)
+}
+
+
subscript(index: Int) -> Int {
+    index == 0 ↓? something() : somethingElse(index)
+    return index
+
+
var value: Int {
+    mode == .fast ↓? something() : somethingElse()
+    return 0
+}
+
+
var value: Int {
+    get {
+        mode == .fast ↓? something() : somethingElse()
+        return 0
+    }
+}
+
+
subscript(index: Int) -> Int {
+    get {
+        index == 0 ↓? something() : somethingElse(index)
+        return index
+    }
+
+ +
+
+ + +
+
+ + + diff --git a/void_return.html b/void_return.html new file mode 100644 index 000000000..183bd81f0 --- /dev/null +++ b/void_return.html @@ -0,0 +1,416 @@ + + + + void_return Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Void Return

+ +

Prefer -> Void over -> ()

+ +
    +
  • Identifier: void_return
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: Yes
  • +
  • Kind: style
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
let abc: () -> Void = {}
+
+
let abc: () -> (VoidVoid) = {}
+
+
func foo(completion: () -> Void)
+
+
let foo: (ConfigurationTests) -> () throws -> Void
+
+
let foo: (ConfigurationTests) ->   () throws -> Void
+
+
let foo: (ConfigurationTests) ->() throws -> Void
+
+
let foo: (ConfigurationTests) -> () -> Void
+
+
let foo: () -> () async -> Void
+
+
let foo: () -> () async throws -> Void
+
+
let foo: () -> () async -> Void
+
+
func foo() -> () async throws -> Void {}
+
+
func foo() async throws -> () async -> Void { return {} }
+
+
func foo() -> () async -> Int { 1 }
+
+

Triggering Examples

+
let abc: () -> ↓() = {}
+
+
let abc: () -> ↓(Void) = {}
+
+
let abc: () -> ↓(   Void ) = {}
+
+
func foo(completion: () -> ↓())
+
+
func foo(completion: () -> ↓(   ))
+
+
func foo(completion: () -> ↓(Void))
+
+
let foo: (ConfigurationTests) -> () throws -> ↓()
+
+
func foo() async -> ↓()
+
+
func foo() async throws -> ↓()
+
+ +
+
+ + +
+
+ + + diff --git a/weak_delegate.html b/weak_delegate.html new file mode 100644 index 000000000..c88dc5ba0 --- /dev/null +++ b/weak_delegate.html @@ -0,0 +1,453 @@ + + + + weak_delegate Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Weak Delegate

+ +

Delegates should be weak to avoid reference cycles

+ +
    +
  • Identifier: weak_delegate
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
class Foo {
+  weak var delegate: SomeProtocol?
+}
+
+
class Foo {
+  weak var someDelegate: SomeDelegateProtocol?
+}
+
+
class Foo {
+  weak var delegateScroll: ScrollDelegate?
+}
+
+
class Foo {
+  var scrollHandler: ScrollDelegate?
+}
+
+
func foo() {
+  var delegate: SomeDelegate
+}
+
+
class Foo {
+  var delegateNotified: Bool?
+}
+
+
protocol P {
+ var delegate: AnyObject? { get set }
+}
+
+
class Foo {
+ protocol P {
+ var delegate: AnyObject? { get set }
+}
+}
+
+
class Foo {
+ var computedDelegate: ComputedDelegate {
+ return bar() 
+} 
+}
+
+
class Foo {
+    var computedDelegate: ComputedDelegate {
+        get {
+            return bar()
+        }
+   }
+
+
struct Foo {
+ @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate 
+}
+
+
struct Foo {
+ @NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate 
+}
+
+
struct Foo {
+ @WKExtensionDelegateAdaptor(ExtensionDelegate.self) var extensionDelegate 
+}
+
+
class Foo {
+    func makeDelegate() -> SomeDelegate {
+        let delegate = SomeDelegate()
+        return delegate
+    }
+}
+
+

Triggering Examples

+
class Foo {
+  ↓var delegate: SomeProtocol?
+}
+
+
class Foo {
+  ↓var scrollDelegate: ScrollDelegate?
+}
+
+
class Foo {
+    ↓var delegate: SomeProtocol? {
+        didSet {
+            print("Updated delegate")
+        }
+   }
+
+ +
+
+ + +
+
+ + + diff --git a/xct_specific_matcher.html b/xct_specific_matcher.html new file mode 100644 index 000000000..d3e77e9bd --- /dev/null +++ b/xct_specific_matcher.html @@ -0,0 +1,560 @@ + + + + xct_specific_matcher Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

XCTest Specific Matcher

+ +

Prefer specific XCTest matchers over XCTAssertEqual and XCTAssertNotEqual.

+ +
    +
  • Identifier: xct_specific_matcher
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + + + + + +
    KeyValue
    +severity + +warning +
    +matchers + +[one-argument-asserts, two-argument-asserts] +
  • +
+

Non Triggering Examples

+
XCTAssert(foo
+
+
XCTAssertFalse(foo)
+
+
XCTAssertTrue(foo)
+
+
XCTAssertNil(foo)
+
+
XCTAssertNotNil(foo)
+
+
XCTAssertEqual(foo, 2)
+
+
XCTAssertNotEqual(foo, "false")
+
+
XCTAssertEqual(foo, [1, 2, 3, true])
+
+
XCTAssertEqual(foo, [1, 2, 3, false])
+
+
XCTAssertEqual(foo, [1, 2, 3, nil])
+
+
XCTAssertEqual(foo, [true, nil, true, nil])
+
+
XCTAssertEqual([1, 2, 3, true], foo)
+
+
XCTAssertEqual([1, 2, 3, false], foo)
+
+
XCTAssertEqual([1, 2, 3, nil], foo)
+
+
XCTAssertEqual([true, nil, true, nil], foo)
+
+
XCTAssertEqual(2, foo)
+
+
XCTAssertNotEqual("false"), foo)
+
+
XCTAssertEqual(false, foo?.bar)
+
+
XCTAssertEqual(true, foo?.bar)
+
+
XCTAssert(    foo  )
+
+
XCTAssertFalse(  foo  )
+
+
XCTAssertTrue(  foo  )
+
+
XCTAssertNil(  foo  )
+
+
XCTAssertNotNil(  foo  )
+
+
XCTAssertEqual(  foo  , 2  )
+
+
XCTAssertNotEqual(  foo, "false")
+
+
XCTAssertEqual(foo?.bar, false)
+
+
XCTAssertEqual(foo?.bar, true)
+
+
XCTAssertNil(foo?.bar)
+
+
XCTAssertNotNil(foo?.bar)
+
+
XCTAssertEqual(foo?.bar, 2)
+
+
XCTAssertNotEqual(foo?.bar, "false")
+
+
XCTAssertEqual(foo?.bar, toto())
+
+
XCTAssertEqual(foo?.bar, .toto(.zoo))
+
+
XCTAssertEqual(toto(), foo?.bar)
+
+
XCTAssertEqual(.toto(.zoo), foo?.bar)
+
+
XCTAssert(foo.self == bar)
+
+
XCTAssertTrue(type(of: foo) != Int.self)
+
+
XCTAssertTrue(a == (1, 3, 5)
+
+

Triggering Examples

+
↓XCTAssertEqual(foo, true)
+
+
↓XCTAssertEqual(foo, false)
+
+
↓XCTAssertEqual(foo, nil)
+
+
↓XCTAssertNotEqual(foo, true)
+
+
↓XCTAssertNotEqual(foo, false)
+
+
↓XCTAssertNotEqual(foo, nil)
+
+
↓XCTAssertEqual(true, foo)
+
+
↓XCTAssertEqual(false, foo)
+
+
↓XCTAssertEqual(nil, foo)
+
+
↓XCTAssertNotEqual(true, foo)
+
+
↓XCTAssertNotEqual(false, foo)
+
+
↓XCTAssertNotEqual(nil, foo)
+
+
↓XCTAssertEqual(foo, true, "toto")
+
+
↓XCTAssertEqual(foo, false, "toto")
+
+
↓XCTAssertEqual(foo, nil, "toto")
+
+
↓XCTAssertNotEqual(foo, true, "toto")
+
+
↓XCTAssertNotEqual(foo, false, "toto")
+
+
↓XCTAssertNotEqual(foo, nil, "toto")
+
+
↓XCTAssertEqual(true, foo, "toto")
+
+
↓XCTAssertEqual(false, foo, "toto")
+
+
↓XCTAssertEqual(nil, foo, "toto")
+
+
↓XCTAssertNotEqual(true, foo, "toto")
+
+
↓XCTAssertNotEqual(false, foo, "toto")
+
+
↓XCTAssertNotEqual(nil, foo, "toto")
+
+
↓XCTAssertEqual(foo,true)
+
+
↓XCTAssertEqual( foo , false )
+
+
↓XCTAssertEqual(  foo  ,  nil  )
+
+
↓XCTAssertEqual(true, [1, 2, 3, true].hasNumbers())
+
+
↓XCTAssertEqual([1, 2, 3, true].hasNumbers(), true)
+
+
↓XCTAssertEqual(foo?.bar, nil)
+
+
↓XCTAssertNotEqual(foo?.bar, nil)
+
+
↓XCTAssertEqual(nil, true)
+
+
↓XCTAssertEqual(nil, false)
+
+
↓XCTAssertEqual(true, nil)
+
+
↓XCTAssertEqual(false, nil)
+
+
↓XCTAssertEqual(nil, nil)
+
+
↓XCTAssertEqual(true, true)
+
+
↓XCTAssertEqual(false, false)
+
+
↓XCTAssert(foo == bar)
+
+
↓XCTAssertTrue(   foo  ==   bar  )
+
+
↓XCTAssertFalse(1 == foo)
+
+
↓XCTAssert(foo == bar, "toto")
+
+
↓XCTAssert(foo != bar)
+
+
↓XCTAssertTrue(   foo  !=   bar  )
+
+
↓XCTAssertFalse(1 != foo)
+
+
↓XCTAssert(foo != bar, "toto")
+
+
↓XCTAssert(  foo   ==  nil)
+
+
↓XCTAssert(nil == foo
+
+
↓XCTAssertTrue(  foo   !=  nil)
+
+
↓XCTAssertFalse(nil != foo
+
+
↓XCTAssert(foo == nil, "toto")
+
+ +
+
+ + +
+
+ + + diff --git a/xctfail_message.html b/xctfail_message.html new file mode 100644 index 000000000..e298dd076 --- /dev/null +++ b/xctfail_message.html @@ -0,0 +1,388 @@ + + + + xctfail_message Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

XCTFail Message

+ +

An XCTFail call should include a description of the assertion

+ +
    +
  • Identifier: xctfail_message
  • +
  • Enabled by default: Yes
  • +
  • Supports autocorrection: No
  • +
  • Kind: idiomatic
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
func testFoo() {
+  XCTFail("bar")
+}
+
+
func testFoo() {
+  XCTFail(bar)
+}
+
+

Triggering Examples

+
func testFoo() {
+  ↓XCTFail()
+}
+
+
func testFoo() {
+  ↓XCTFail("")
+}
+
+ +
+
+ + +
+
+ + + diff --git a/yoda_condition.html b/yoda_condition.html new file mode 100644 index 000000000..d1d1d8139 --- /dev/null +++ b/yoda_condition.html @@ -0,0 +1,410 @@ + + + + yoda_condition Reference + + + + + + + + + + + + + + + +
+

+ + SwiftLintCore 0.57.1 Docs + + (100% documented) +

+ +
+
+ +
+
+ +

+ + GitHub + View on GitHub + +

+ +

+ + Dash + Install in Dash + +

+
+ + + +
+ +
+ +
+
+ +

Yoda Condition

+ +

The constant literal should be placed on the right-hand side of the comparison operator

+ +
    +
  • Identifier: yoda_condition
  • +
  • Enabled by default: No
  • +
  • Supports autocorrection: No
  • +
  • Kind: lint
  • +
  • Analyzer rule: No
  • +
  • Minimum Swift compiler version: 5.0.0
  • +
  • Default configuration: + + + + + + + + + + +
    KeyValue
    +severity + +warning +
  • +
+

Non Triggering Examples

+
if foo == 42 {}
+
+
if foo <= 42.42 {}
+
+
guard foo >= 42 else { return }
+
+
guard foo != "str str" else { return }
+
+
while foo < 10 { }
+
+
while foo > 1 { }
+
+
while foo + 1 == 2 {}
+
+
if optionalValue?.property ?? 0 == 2 {}
+
+
if foo == nil {}
+
+
if flags & 1 == 1 {}
+
+

Triggering Examples

+
if ↓42 == foo {}
+
+
if ↓42.42 >= foo {}
+
+
guard ↓42 <= foo else { return }
+
+
guard ↓"str str" != foo else { return }
+
+
while ↓10 > foo { }
+
+
while ↓1 < foo { }
+
+
if ↓nil == foo {}
+
+
while ↓1 > i + 5 {}
+
+
if ↓200 <= i && i <= 299 || ↓600 <= i {}
+
+ +
+
+ + +
+
+ + +