mirror of
https://github.com/realm/SwiftLint.git
synced 2026-05-07 20:12:49 +00:00
921 lines
49 KiB
HTML
921 lines
49 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<title>Example Structure Reference</title>
|
||
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
||
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
||
<meta charset="utf-8">
|
||
<script src="../js/jquery.min.js" defer></script>
|
||
<script src="../js/jazzy.js" defer></script>
|
||
|
||
<script src="../js/lunr.min.js" defer></script>
|
||
<script src="../js/typeahead.jquery.js" defer></script>
|
||
<script src="../js/jazzy.search.js" defer></script>
|
||
</head>
|
||
<body>
|
||
|
||
<a name="//apple_ref/swift/Struct/Example" class="dashAnchor"></a>
|
||
|
||
<a title="Example Structure Reference"></a>
|
||
|
||
<header class="header">
|
||
<p class="header-col header-col--primary">
|
||
<a class="header-link" href="../index.html">
|
||
SwiftLintCore 0.59.1 Docs
|
||
</a>
|
||
(100% documented)
|
||
</p>
|
||
|
||
<div class="header-col--secondary">
|
||
<form role="search" action="../search.json">
|
||
<input type="text" placeholder="Search documentation" data-typeahead>
|
||
</form>
|
||
</div>
|
||
|
||
<p class="header-col header-col--secondary">
|
||
<a class="header-link" href="https://github.com/realm/SwiftLint">
|
||
<img class="header-icon" src="../img/gh.png" alt="GitHub"/>
|
||
View on GitHub
|
||
</a>
|
||
</p>
|
||
|
||
<p class="header-col header-col--secondary">
|
||
<a class="header-link" href="dash-feed://https%3A%2F%2Frealm.github.io%2FSwiftLint%2Fdocsets%2FSwiftLintCore.xml">
|
||
<img class="header-icon" src="../img/dash.png" alt="Dash"/>
|
||
Install in Dash
|
||
</a>
|
||
</p>
|
||
</header>
|
||
|
||
<p class="breadcrumbs">
|
||
<a class="breadcrumb" href="../index.html">SwiftLintCore</a>
|
||
<img class="carat" src="../img/carat.png" alt=""/>
|
||
<a class="breadcrumb" href="../Structs.html">Structures</a>
|
||
<img class="carat" src="../img/carat.png" alt=""/>
|
||
Example Structure Reference
|
||
</p>
|
||
|
||
<div class="content-wrapper">
|
||
<nav class="navigation">
|
||
<ul class="nav-groups">
|
||
<li class="nav-group-name">
|
||
<a class="nav-group-name-link" href="../Rules.html">Rules</a>
|
||
<ul class="nav-group-tasks">
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../rule-directory.html">Rule Directory</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="nav-group-name">
|
||
<a class="nav-group-name-link" href="../Classes.html">Classes</a>
|
||
<ul class="nav-group-tasks">
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Classes/BodyLengthVisitor.html">BodyLengthVisitor</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Classes/CodeBlockVisitor.html">CodeBlockVisitor</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Classes/CodeIndentingRewriter.html">CodeIndentingRewriter</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Classes/CodeIndentingRewriter/IndentationStyle.html">– IndentationStyle</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Classes/DeclaredIdentifiersTrackingVisitor.html">DeclaredIdentifiersTrackingVisitor</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Classes/RuleRegistry.html">RuleRegistry</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Classes/RuleStorage.html">RuleStorage</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Classes/SwiftLintFile.html">SwiftLintFile</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Classes/ViolationsSyntaxRewriter.html">ViolationsSyntaxRewriter</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Classes/ViolationsSyntaxVisitor.html">ViolationsSyntaxVisitor</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="nav-group-name">
|
||
<a class="nav-group-name-link" href="../Enums.html">Enumerations</a>
|
||
<ul class="nav-group-tasks">
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Enums/AccessControlLevel.html">AccessControlLevel</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Enums/CurrentRule.html">CurrentRule</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Enums/IdentifierDeclaration.html">IdentifierDeclaration</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Enums/Issue.html">Issue</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Enums/OptionType.html">OptionType</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Enums/RuleIdentifier.html">RuleIdentifier</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Enums/RuleKind.html">RuleKind</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Enums/RuleListError.html">RuleListError</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Enums/SwiftExpressionKind.html">SwiftExpressionKind</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Enums/SwiftSyntaxKindBridge.html">SwiftSyntaxKindBridge</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Enums/ViolationSeverity.html">ViolationSeverity</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="nav-group-name">
|
||
<a class="nav-group-name-link" href="../Extensions.html">Extensions</a>
|
||
<ul class="nav-group-tasks">
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Extensions/Array.html">Array</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Extensions/Bool.html">Bool</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Extensions/Double.html">Double</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Extensions/Int.html">Int</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Extensions/Optional.html">Optional</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Extensions/Set.html">Set</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Extensions/String.html">String</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="nav-group-name">
|
||
<a class="nav-group-name-link" href="../Protocols.html">Protocols</a>
|
||
<ul class="nav-group-tasks">
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Protocols/ASTRule.html">ASTRule</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Protocols/AcceptableByConfigurationElement.html">AcceptableByConfigurationElement</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Protocols/AnalyzerRule.html">AnalyzerRule</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Protocols.html#/s:13SwiftLintCore17AnyCollectingRuleP">AnyCollectingRule</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Protocols/CacheDescriptionProvider.html">CacheDescriptionProvider</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Protocols/CollectingRule.html">CollectingRule</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Protocols/ConditionallySourceKitFree.html">ConditionallySourceKitFree</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Protocols/CorrectableRule.html">CorrectableRule</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Protocols/Documentable.html">Documentable</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Protocols.html#/s:13SwiftLintCore19InlinableOptionTypeP">InlinableOptionType</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Protocols.html#/s:13SwiftLintCore9OptInRuleP">OptInRule</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Protocols/Rule.html">Rule</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Protocols/RuleConfiguration.html">RuleConfiguration</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Protocols/SeverityBasedRuleConfiguration.html">SeverityBasedRuleConfiguration</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Protocols.html#/s:13SwiftLintCore17SourceKitFreeRuleP">SourceKitFreeRule</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Protocols/SubstitutionCorrectableRule.html">SubstitutionCorrectableRule</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Protocols/SwiftSyntaxCorrectableRule.html">SwiftSyntaxCorrectableRule</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Protocols/SwiftSyntaxRule.html">SwiftSyntaxRule</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Protocols/VersionComparable.html">VersionComparable</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="nav-group-name">
|
||
<a class="nav-group-name-link" href="../Structs.html">Structures</a>
|
||
<ul class="nav-group-tasks">
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/Baseline.html">Baseline</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/ChildOptionSeverityConfiguration.html">ChildOptionSeverityConfiguration</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/Command.html">Command</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/Command/Action.html">– Action</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/Command/Modifier.html">– Modifier</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/ConfigurationElement.html">ConfigurationElement</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/ConfigurationElement/DeprecationNotice.html">– DeprecationNotice</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/Correction.html">Correction</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/Example.html">Example</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/Location.html">Location</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/ReasonedRuleViolation.html">ReasonedRuleViolation</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/ReasonedRuleViolation/ViolationCorrection.html">– ViolationCorrection</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/RegexConfiguration.html">RegexConfiguration</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/RegexConfiguration/ExecutionMode.html">– ExecutionMode</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/Region.html">Region</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/RuleConfigurationDescription.html">RuleConfigurationDescription</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs.html#/s:13SwiftLintCore35RuleConfigurationDescriptionBuilderV">RuleConfigurationDescriptionBuilder</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/RuleConfigurationOption.html">RuleConfigurationOption</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/RuleDescription.html">RuleDescription</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/RuleList.html">RuleList</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/RuleParameter.html">RuleParameter</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/SeverityConfiguration.html">SeverityConfiguration</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/SeverityLevelsConfiguration.html">SeverityLevelsConfiguration</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/Stack.html">Stack</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/StyleViolation.html">StyleViolation</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/SwiftLintSyntaxMap.html">SwiftLintSyntaxMap</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/SwiftLintSyntaxToken.html">SwiftLintSyntaxToken</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Structs/SwiftVersion.html">SwiftVersion</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="nav-group-name">
|
||
<a class="nav-group-name-link" href="../Macros.html">Macros</a>
|
||
<ul class="nav-group-tasks">
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Macros.html#/s:13SwiftLintCore32AcceptableByConfigurationElementyycfm">AcceptableByConfigurationElement()</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Macros.html#/s:13SwiftLintCore16AutoConfigParseryycfm">AutoConfigParser()</a>
|
||
</li>
|
||
<li class="nav-group-task">
|
||
<a class="nav-group-task-link" href="../Macros.html#/s:13SwiftLintCore0A10SyntaxRule15foldExpressions16explicitRewriter11correctable5optInySb_S3btcfm">SwiftSyntaxRule(foldExpressions:explicitRewriter:correctable:optIn:)</a>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</nav>
|
||
<article class="main-content">
|
||
|
||
<section class="section">
|
||
<div class="section-content top-matter">
|
||
<h1>Example</h1>
|
||
<div class="declaration">
|
||
<div class="language">
|
||
|
||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">struct</span> <span class="kt">Example</span> <span class="p">:</span> <span class="kt">Sendable</span></code></pre>
|
||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Example</span><span class="p">:</span> <span class="kt">Hashable</span></code></pre>
|
||
<pre class="highlight swift"><code><span class="kd">extension</span> <span class="kt">Example</span><span class="p">:</span> <span class="kt">Comparable</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<p>Captures code and context information for an example of a triggering or
|
||
non-triggering style</p>
|
||
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/realm/SwiftLint/tree/main/Source/SwiftLintCore/Models/Example.swift#L3-L44">Show on GitHub</a>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<section class="section">
|
||
<div class="section-content">
|
||
<div class="task-group">
|
||
<ul class="item-container">
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:13SwiftLintCore7ExampleV4codeSSvp"></a>
|
||
<a name="//apple_ref/swift/Property/code" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:13SwiftLintCore7ExampleV4codeSSvp">code</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>The contents of the example</p>
|
||
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">private(set)</span> <span class="k">var</span> <span class="nv">code</span><span class="p">:</span> <span class="kt">String</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/realm/SwiftLint/tree/main/Source/SwiftLintCore/Models/Example.swift#L5">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:13SwiftLintCore7ExampleV13configurationSDySSs8Sendable_pGSgvp"></a>
|
||
<a name="//apple_ref/swift/Property/configuration" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:13SwiftLintCore7ExampleV13configurationSDySSs8Sendable_pGSgvp">configuration</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>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.</p>
|
||
|
||
<p>For example, if the following YAML would be used to configure the rule:</p>
|
||
<pre class="highlight swift"><code><span class="nv">severity</span><span class="p">:</span> <span class="n">warning</span>
|
||
</code></pre>
|
||
|
||
<p>Then the equivalent configuration value would be <code>["severity": "warning"]</code>.</p>
|
||
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">private(set)</span> <span class="k">var</span> <span class="nv">configuration</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span> <span class="p">:</span> <span class="kd">any</span> <span class="kt">Sendable</span><span class="p">]?</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/realm/SwiftLint/tree/main/Source/SwiftLintCore/Models/Example.swift#L16">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:13SwiftLintCore7ExampleV20testMultiByteOffsetsSbvp"></a>
|
||
<a name="//apple_ref/swift/Property/testMultiByteOffsets" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:13SwiftLintCore7ExampleV20testMultiByteOffsetsSbvp">testMultiByteOffsets</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>Whether the example should be tested by prepending multibyte grapheme clusters</p>
|
||
<div class="aside aside-see-also">
|
||
<p class="aside-title">See also</p>
|
||
addEmoji(_:)
|
||
|
||
</div>
|
||
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">private(set)</span> <span class="k">var</span> <span class="nv">testMultiByteOffsets</span><span class="p">:</span> <span class="kt">Bool</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/realm/SwiftLint/tree/main/Source/SwiftLintCore/Models/Example.swift#L20">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:13SwiftLintCore7ExampleV11testOnLinuxSbvp"></a>
|
||
<a name="//apple_ref/swift/Property/testOnLinux" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:13SwiftLintCore7ExampleV11testOnLinuxSbvp">testOnLinux</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>Whether the example should be tested on Linux</p>
|
||
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">private(set)</span> <span class="k">var</span> <span class="nv">testOnLinux</span><span class="p">:</span> <span class="kt">Bool</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/realm/SwiftLint/tree/main/Source/SwiftLintCore/Models/Example.swift#L28">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:13SwiftLintCore7ExampleV4files12StaticStringVvp"></a>
|
||
<a name="//apple_ref/swift/Property/file" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:13SwiftLintCore7ExampleV4files12StaticStringVvp">file</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>The path to the file where the example was created</p>
|
||
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">private(set)</span> <span class="k">var</span> <span class="nv">file</span><span class="p">:</span> <span class="kt">StaticString</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/realm/SwiftLint/tree/main/Source/SwiftLintCore/Models/Example.swift#L30">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:13SwiftLintCore7ExampleV4lineSuvp"></a>
|
||
<a name="//apple_ref/swift/Property/line" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:13SwiftLintCore7ExampleV4lineSuvp">line</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>The line in the file where the example was created</p>
|
||
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">line</span><span class="p">:</span> <span class="kt">UInt</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/realm/SwiftLint/tree/main/Source/SwiftLintCore/Models/Example.swift#L32">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:13SwiftLintCore7ExampleV_13configuration20testMultiByteOffsets0F17WrappingInComment0fjK6String0F14DisableCommand0F7OnLinux4file4line24excludeFromDocumentationACSS_SDySSs8Sendable_pGSgS5bs06StaticM0VSuSbtcfc"></a>
|
||
<a name="//apple_ref/swift/Method/init(_:configuration:testMultiByteOffsets:testWrappingInComment:testWrappingInString:testDisableCommand:testOnLinux:file:line:excludeFromDocumentation:)" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:13SwiftLintCore7ExampleV_13configuration20testMultiByteOffsets0F17WrappingInComment0fjK6String0F14DisableCommand0F7OnLinux4file4line24excludeFromDocumentationACSS_SDySSs8Sendable_pGSgS5bs06StaticM0VSuSbtcfc">init(_:<wbr>configuration:<wbr>testMultiByteOffsets:<wbr>testWrappingInComment:<wbr>testWrappingInString:<wbr>testDisableCommand:<wbr>testOnLinux:<wbr>file:<wbr>line:<wbr>excludeFromDocumentation:<wbr>)</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>Create a new Example with the specified code, file, and line.</p>
|
||
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="nf">init</span><span class="p">(</span><span class="n">_</span> <span class="nv">code</span><span class="p">:</span> <span class="kt">String</span><span class="p">,</span>
|
||
<span class="nv">configuration</span><span class="p">:</span> <span class="p">[</span><span class="kt">String</span><span class="p">:</span> <span class="kd">any</span> <span class="kt">Sendable</span><span class="p">]?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">,</span>
|
||
<span class="nv">testMultiByteOffsets</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
|
||
<span class="nv">testWrappingInComment</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
|
||
<span class="nv">testWrappingInString</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
|
||
<span class="nv">testDisableCommand</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
|
||
<span class="nv">testOnLinux</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">true</span><span class="p">,</span>
|
||
<span class="nv">file</span><span class="p">:</span> <span class="kt">StaticString</span> <span class="o">=</span> <span class="k">#filePath</span><span class="p">,</span>
|
||
<span class="nv">line</span><span class="p">:</span> <span class="kt">UInt</span> <span class="o">=</span> <span class="k">#line</span><span class="p">,</span>
|
||
<span class="nv">excludeFromDocumentation</span><span class="p">:</span> <span class="kt">Bool</span> <span class="o">=</span> <span class="kc">false</span><span class="p">)</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div>
|
||
<h4>Parameters</h4>
|
||
<table class="graybox">
|
||
<tbody>
|
||
<tr>
|
||
<td>
|
||
<code>
|
||
<em>code</em>
|
||
</code>
|
||
</td>
|
||
<td>
|
||
<div>
|
||
<p>The contents of the example.</p>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>
|
||
<code>
|
||
<em>configuration</em>
|
||
</code>
|
||
</td>
|
||
<td>
|
||
<div>
|
||
<p>The untyped configuration to apply to the rule, if deviating from the default
|
||
configuration.</p>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>
|
||
<code>
|
||
<em>testMultibyteOffsets</em>
|
||
</code>
|
||
</td>
|
||
<td>
|
||
<div>
|
||
<p>Whether the example should be tested by prepending multibyte grapheme clusters.</p>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>
|
||
<code>
|
||
<em>testWrappingInComment</em>
|
||
</code>
|
||
</td>
|
||
<td>
|
||
<div>
|
||
<p>Whether test shall verify that the example wrapped in a comment doesn’t trigger.</p>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>
|
||
<code>
|
||
<em>testWrappingInString</em>
|
||
</code>
|
||
</td>
|
||
<td>
|
||
<div>
|
||
<p>Whether tests shall verify that the example wrapped into a string doesn’t trigger.</p>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>
|
||
<code>
|
||
<em>testDisableCommand</em>
|
||
</code>
|
||
</td>
|
||
<td>
|
||
<div>
|
||
<p>Whether tests shall verify that the disabled rule (comment in the example) doesn’t
|
||
trigger.</p>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>
|
||
<code>
|
||
<em>testOnLinux</em>
|
||
</code>
|
||
</td>
|
||
<td>
|
||
<div>
|
||
<p>Whether the example should be tested on Linux.</p>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>
|
||
<code>
|
||
<em>file</em>
|
||
</code>
|
||
</td>
|
||
<td>
|
||
<div>
|
||
<p>The path to the file where the example is located.
|
||
Defaults to the file where this initializer is called.</p>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>
|
||
<code>
|
||
<em>line</em>
|
||
</code>
|
||
</td>
|
||
<td>
|
||
<div>
|
||
<p>The line in the file where the example is located.
|
||
Defaults to the line where this initializer is called.</p>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/realm/SwiftLint/tree/main/Source/SwiftLintCore/Models/Example.swift#L62-L83">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:13SwiftLintCore7ExampleV4with4codeACSS_tF"></a>
|
||
<a name="//apple_ref/swift/Method/with(code:)" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:13SwiftLintCore7ExampleV4with4codeACSS_tF">with(code:<wbr>)</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>Returns the same example, but with the <code><a href="../Structs/Example.html#/s:13SwiftLintCore7ExampleV4codeSSvp">code</a></code> that is passed in</p>
|
||
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">with</span><span class="p">(</span><span class="nv">code</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-></span> <span class="kt">Example</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div>
|
||
<h4>Parameters</h4>
|
||
<table class="graybox">
|
||
<tbody>
|
||
<tr>
|
||
<td>
|
||
<code>
|
||
<em>code</em>
|
||
</code>
|
||
</td>
|
||
<td>
|
||
<div>
|
||
<p>the new code to use in the modified example</p>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/realm/SwiftLint/tree/main/Source/SwiftLintCore/Models/Example.swift#L87-L91">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:13SwiftLintCore7ExampleV24removingViolationMarkersACyF"></a>
|
||
<a name="//apple_ref/swift/Method/removingViolationMarkers()" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:13SwiftLintCore7ExampleV24removingViolationMarkersACyF">removingViolationMarkers()</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>Returns a copy of the Example with all instances of the “↓” character removed.</p>
|
||
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">removingViolationMarkers</span><span class="p">()</span> <span class="o">-></span> <span class="kt">Example</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/realm/SwiftLint/tree/main/Source/SwiftLintCore/Models/Example.swift#L94-L96">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:13SwiftLintCore7ExampleV7focusedACyF"></a>
|
||
<a name="//apple_ref/swift/Method/focused()" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:13SwiftLintCore7ExampleV7focusedACyF">focused()</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
<p>Makes the current example focused. This is for debugging purposes only.</p>
|
||
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">focused</span><span class="p">()</span> <span class="o">-></span> <span class="kt">Example</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/realm/SwiftLint/tree/main/Source/SwiftLintCore/Models/Example.swift#L125-L129">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:SQ2eeoiySbx_xtFZ"></a>
|
||
<a name="//apple_ref/swift/Method/==(_:_:)" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:SQ2eeoiySbx_xtFZ">==(_:<wbr>_:<wbr>)</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o">==</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="kt">Example</span><span class="p">,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="kt">Example</span><span class="p">)</span> <span class="o">-></span> <span class="kt">Bool</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/realm/SwiftLint/tree/main/Source/SwiftLintCore/Models/Example.swift#L133-L137">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:SH4hash4intoys6HasherVz_tF"></a>
|
||
<a name="//apple_ref/swift/Method/hash(into:)" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:SH4hash4intoys6HasherVz_tF">hash(into:<wbr>)</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">hash</span><span class="p">(</span><span class="n">into</span> <span class="nv">hasher</span><span class="p">:</span> <span class="k">inout</span> <span class="kt">Hasher</span><span class="p">)</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/realm/SwiftLint/tree/main/Source/SwiftLintCore/Models/Example.swift#L139-L143">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
<li class="item">
|
||
<div>
|
||
<code>
|
||
<a name="/s:SL1loiySbx_xtFZ"></a>
|
||
<a name="//apple_ref/swift/Method/<(_:_:)" class="dashAnchor"></a>
|
||
<a class="token" href="#/s:SL1loiySbx_xtFZ"><(_:<wbr>_:<wbr>)</a>
|
||
</code>
|
||
</div>
|
||
<div class="height-container">
|
||
<div class="pointer-container"></div>
|
||
<section class="section">
|
||
<div class="pointer"></div>
|
||
<div class="abstract">
|
||
|
||
</div>
|
||
<div class="declaration">
|
||
<h4>Declaration</h4>
|
||
<div class="language">
|
||
<p class="aside-title">Swift</p>
|
||
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">static</span> <span class="kd">func</span> <span class="o"><</span> <span class="p">(</span><span class="nv">lhs</span><span class="p">:</span> <span class="kt">Example</span><span class="p">,</span> <span class="nv">rhs</span><span class="p">:</span> <span class="kt">Example</span><span class="p">)</span> <span class="o">-></span> <span class="kt">Bool</span></code></pre>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="slightly-smaller">
|
||
<a href="https://github.com/realm/SwiftLint/tree/main/Source/SwiftLintCore/Models/Example.swift#L147-L149">Show on GitHub</a>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
</article>
|
||
</div>
|
||
<section class="footer">
|
||
<p>© 2023 <a class="link" href="https://jpsim.com" target="_blank" rel="external noopener">JP Simard</a> under MIT.</p>
|
||
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.15.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
|
||
</section>
|
||
</body>
|
||
</html>
|