Skip to content

Commit 7e8bd26

Browse files
authored
Spelling (#450)
* spelling: abbreviations * spelling: associated * spelling: behavior * spelling: calculated * spelling: capture * spelling: combobulator * spelling: container * spelling: documentation * spelling: formatted * spelling: indices * spelling: language * spelling: linted * spelling: objects * spelling: omitted * spelling: parameters * spelling: preexisting * spelling: remaining * spelling: returns * spelling: sentence * spelling: successfully * spelling: types Signed-off-by: Josh Soref <[email protected]>
1 parent 949c36d commit 7e8bd26

17 files changed

+38
-38
lines changed

Plugins/LintPlugin/plugin.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct LintPlugin {
2020
process.waitUntilExit()
2121

2222
if process.terminationReason == .exit && process.terminationStatus == 0 {
23-
print("Lintted the source code.")
23+
print("Linted the source code.")
2424
}
2525
else {
2626
let problem = "\(process.terminationReason):\(process.terminationStatus)"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ want to do.
6868
Once the build has finished, the `swift-format` executable will be located at
6969
`.build/release/swift-format`.
7070

71-
To test that the formatter was built succesfully and is compatible with your
71+
To test that the formatter was built successfully and is compatible with your
7272
Swift toolchain, you can also run the following command:
7373

7474
```sh

Sources/SwiftFormatPrettyPrint/PrettyPrint.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public class PrettyPrinter {
186186
outputBuffer.append(String(str))
187187
}
188188

189-
/// Writes newlines into the output stream, taking into account any pre-existing consecutive
189+
/// Writes newlines into the output stream, taking into account any preexisting consecutive
190190
/// newlines and the maximum allowed number of blank lines.
191191
///
192192
/// This function does some implicit collapsing of consecutive newlines to ensure that the
@@ -248,7 +248,7 @@ public class PrettyPrinter {
248248
/// Print out the provided token, and apply line-wrapping and indentation as needed.
249249
///
250250
/// This method takes a Token and it's length, and it keeps track of how much space is left on the
251-
/// current line it is printing on. If a token exceeds the remaning space, we break to a new line,
251+
/// current line it is printing on. If a token exceeds the remaining space, we break to a new line,
252252
/// and apply the appropriate level of indentation.
253253
///
254254
/// - Parameters:
@@ -569,7 +569,7 @@ public class PrettyPrinter {
569569
///
570570
/// - Returns: A String containing the formatted source code.
571571
public func prettyPrint() -> String {
572-
// Keep track of the indicies of the .open and .break token locations.
572+
// Keep track of the indices of the .open and .break token locations.
573573
var delimIndexStack = [Int]()
574574
// Keep a running total of the token lengths.
575575
var total = 0
@@ -584,7 +584,7 @@ public class PrettyPrinter {
584584
lengths.append(0)
585585

586586
// Open tokens have lengths equal to the total of the contents of its group. The value is
587-
// calcualted when close tokens are encountered.
587+
// calculated when close tokens are encountered.
588588
case .open:
589589
lengths.append(-total)
590590
delimIndexStack.append(i)

Sources/SwiftFormatPrettyPrint/Token.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ enum BreakKind: Equatable {
108108
case reset
109109

110110
/// A `contextual` break acts as either a `continue` break or maintains the existing level of
111-
/// indentation when it fires. The contextual breaking beahvior of a given contextual breaking
111+
/// indentation when it fires. The contextual breaking behavior of a given contextual breaking
112112
/// scope (i.e. inside a `contextualBreakingStart`/`contextualBreakingEnd` region) is set by the
113113
/// first child `contextualBreakingStart`/`contextualBreakingEnd` pair. When the first child is
114114
/// multiline the contextual breaks maintain indentation and they are continuations otherwise.

Sources/SwiftFormatRules/BeginDocumentationCommentWithOneLineSummary.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public final class BeginDocumentationCommentWithOneLineSummary: SyntaxLintRule {
162162
///
163163
/// This method is a fallback for platforms (like Linux, currently) where `String` does not
164164
/// support `NSLinguisticTagger` and its related APIs. It will fail to catch certain kinds of
165-
/// sentences (such as those containing abbrevations that are followed by a period, like "Dr.")
165+
/// sentences (such as those containing abbreviations that are followed by a period, like "Dr.")
166166
/// that the more advanced API can handle.
167167
private func nonLinguisticSentenceApproximations(in text: String) -> (
168168
sentences: [String], trailingText: Substring

Sources/SwiftFormatRules/DeclSyntaxProtocol+Comments.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ extension DeclSyntaxProtocol {
8787
var returnsDescription: String?
8888
var throwsDescription: String?
8989
// Takes the first sentence of the comment, and counts the number of lines it uses.
90-
let oneSenteceSummary = docComment.components(separatedBy: ".").first
91-
let numOfOneSentenceLines = oneSenteceSummary!.components(separatedBy: .newlines).count
90+
let oneSentenceSummary = docComment.components(separatedBy: ".").first
91+
let numOfOneSentenceLines = oneSentenceSummary!.components(separatedBy: .newlines).count
9292

9393
// Iterates to all the comments after the one sentence summary to find the parameter(s)
9494
// return tags and get their description.
@@ -114,7 +114,7 @@ extension DeclSyntaxProtocol {
114114
} else {
115115
switch currentSection {
116116
case .parameters:
117-
// After the paramters tag is found the following lines should be the parameters
117+
// After the parameters tag is found the following lines should be the parameters
118118
// description.
119119
guard let index = trimmedLine.firstIndex(of: ":") else { continue }
120120
let name = trimmedLine[..<index].trimmingCharacters(in: .init(charactersIn: " -:"))
@@ -138,7 +138,7 @@ extension DeclSyntaxProtocol {
138138
}
139139

140140
return ParseComment(
141-
oneSentenceSummary: oneSenteceSummary,
141+
oneSentenceSummary: oneSentenceSummary,
142142
commentParagraphs: commentParagraphs,
143143
parameters: params,
144144
throwsDescription: throwsDescription,

Sources/SwiftFormatRules/ModifierListSyntax+Convenience.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ extension ModifierListSyntax {
4646
return self
4747
}
4848

49-
/// Returns a foramatted declaration modifier token with the given name.
49+
/// Returns a formatted declaration modifier token with the given name.
5050
func createModifierToken(name: String) -> DeclModifierSyntax {
5151
let id = TokenSyntax.identifier(name, trailingTrivia: .spaces(1))
5252
let newModifier = DeclModifierSyntax(name: id, detail: nil)

Sources/SwiftFormatRules/OrderedImports.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public final class OrderedImports: SyntaxFormatRule {
188188
}
189189

190190
/// Sort the list of import lines lexicographically by the import path name. Any comments above an
191-
/// import lines should be assocaited with it, and move with the line during sorting. We also emit
191+
/// import lines should be associated with it, and move with the line during sorting. We also emit
192192
/// a linter error if an import line is discovered to be out of order.
193193
private func formatImports(_ imports: [Line]) -> [Line] {
194194
var linesWithLeadingComments: [(import: Line, comments: [Line])] = []
@@ -280,7 +280,7 @@ fileprivate func joinLines(_ inputLineLists: [Line]...) -> [Line] {
280280
}
281281

282282
/// This function transforms the statements in a CodeBlockItemListSyntax object into a list of Line
283-
/// obejcts. Blank lines and standalone comments are represented by their own Line object. Code with
283+
/// objects. Blank lines and standalone comments are represented by their own Line object. Code with
284284
/// a trailing comment are represented together in the same Line.
285285
fileprivate func generateLines(codeBlockItemList: CodeBlockItemListSyntax, context: Context)
286286
-> [Line]

Sources/SwiftFormatRules/UseShorthandTypeNames.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public final class UseShorthandTypeNames: SyntaxFormatRule {
197197
return (first, second)
198198
}
199199

200-
/// Retuns a `TypeSyntax` representing a shorthand array type (e.g., `[Foo]`) with the given
200+
/// Returns a `TypeSyntax` representing a shorthand array type (e.g., `[Foo]`) with the given
201201
/// element type and trivia.
202202
private func shorthandArrayType(
203203
element: TypeSyntax,

Sources/SwiftFormatRules/UseSynthesizedInitializer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ fileprivate enum AccessLevel {
201201
/// a struct that contains the given properties.
202202
///
203203
/// The rules for default memberwise initializer access levels are defined in The Swift
204-
/// Programming Languge:
204+
/// Programming Language:
205205
/// https://docs.swift.org/swift-book/LanguageGuide/AccessControl.html#ID21
206206
///
207207
/// - Parameter properties: The properties contained within the struct.

Sources/SwiftFormatRules/ValidateDocumentationComments.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public final class ValidateDocumentationComments: SyntaxLintRule {
4949
guard let params = commentInfo.parameters else { return .skipChildren }
5050

5151
// If a single sentence summary is the only documentation, parameter(s) and
52-
// returns tags may be ommitted.
52+
// returns tags may be omitted.
5353
if commentInfo.oneSentenceSummary != nil && commentInfo.commentParagraphs!.isEmpty && params
5454
.isEmpty && commentInfo.returnsDescription == nil
5555
{
@@ -79,7 +79,7 @@ public final class ValidateDocumentationComments: SyntaxLintRule {
7979
return .skipChildren
8080
}
8181

82-
// Ensures that the parameters of the documantation and the function signature
82+
// Ensures that the parameters of the documentation and the function signature
8383
// are the same.
8484
if (params.count != funcParameters.count) || !parametersAreEqual(
8585
params: params, funcParam: funcParameters)
@@ -132,7 +132,7 @@ public final class ValidateDocumentationComments: SyntaxLintRule {
132132
}
133133

134134
/// Iterates through every parameter of paramList and returns a list of the
135-
/// paramters identifiers.
135+
/// parameters identifiers.
136136
fileprivate func funcParametersIdentifiers(in paramList: FunctionParameterListSyntax) -> [String] {
137137
var funcParameters = [String]()
138138
for parameter in paramList {

Tests/SwiftFormatPrettyPrintTests/ForInStmtTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ final class ForInStmtTests: PrettyPrintTestCase {
7676
func testForLoopFullWrap() {
7777
let input =
7878
"""
79-
for item in aVeryLargeContainterObject where largeObject.hasProperty() && condition {
79+
for item in aVeryLargeContainerObject where largeObject.hasProperty() && condition {
8080
let a = 123
8181
let b = 456
8282
}
83-
for item in aVeryLargeContainterObject where tinyObj.hasProperty() && condition {
83+
for item in aVeryLargeContainerObject where tinyObj.hasProperty() && condition {
8484
let a = 123
8585
let b = 456
8686
}
@@ -89,7 +89,7 @@ final class ForInStmtTests: PrettyPrintTestCase {
8989
let expected =
9090
"""
9191
for item
92-
in aVeryLargeContainterObject
92+
in aVeryLargeContainerObject
9393
where
9494
largeObject.hasProperty()
9595
&& condition
@@ -98,7 +98,7 @@ final class ForInStmtTests: PrettyPrintTestCase {
9898
let b = 456
9999
}
100100
for item
101-
in aVeryLargeContainterObject
101+
in aVeryLargeContainerObject
102102
where tinyObj.hasProperty()
103103
&& condition
104104
{

Tests/SwiftFormatRulesTests/BeginDocumentationCommentWithOneLineSummaryTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ final class BeginDocumentationCommentWithOneLineSummaryTests: LintOrFormatRuleTe
1313
/// Returns a bottle of Dr Pepper from the vending machine.
1414
public func drPepper(from vendingMachine: VendingMachine) -> Soda {}
1515
16-
/// Contains a comment as description that needs a sentece
16+
/// Contains a comment as description that needs a sentence
1717
/// of two lines of code.
1818
public var twoLinesForOneSentence = "test"
1919
@@ -46,7 +46,7 @@ final class BeginDocumentationCommentWithOneLineSummaryTests: LintOrFormatRuleTe
4646
XCTAssertNotDiagnosed(.addBlankLineAfterFirstSentence(
4747
"Returns a bottle of Dr Pepper from the vending machine."))
4848
XCTAssertNotDiagnosed(.addBlankLineAfterFirstSentence(
49-
"Contains a comment as description that needs a sentece of two lines of code."))
49+
"Contains a comment as description that needs a sentence of two lines of code."))
5050
XCTAssertNotDiagnosed(.addBlankLineAfterFirstSentence("The background color of the view."))
5151
XCTAssertNotDiagnosed(.addBlankLineAfterFirstSentence("Returns the sum of the numbers."))
5252
}
@@ -107,7 +107,7 @@ final class BeginDocumentationCommentWithOneLineSummaryTests: LintOrFormatRuleTe
107107
/// Returns a bottle of Dr Pepper from the vending machine.
108108
public func drPepper(from vendingMachine: VendingMachine) -> Soda {}
109109
110-
/// Contains a comment as description that needs a sentece
110+
/// Contains a comment as description that needs a sentence
111111
/// of two lines of code.
112112
public var twoLinesForOneSentence = "test"
113113
@@ -140,7 +140,7 @@ final class BeginDocumentationCommentWithOneLineSummaryTests: LintOrFormatRuleTe
140140
XCTAssertNotDiagnosed(.addBlankLineAfterFirstSentence(
141141
"Returns a bottle of Dr Pepper from the vending machine."))
142142
XCTAssertNotDiagnosed(.addBlankLineAfterFirstSentence(
143-
"Contains a comment as description that needs a sentece of two lines of code."))
143+
"Contains a comment as description that needs a sentence of two lines of code."))
144144
XCTAssertNotDiagnosed(.addBlankLineAfterFirstSentence("The background color of the view."))
145145
XCTAssertNotDiagnosed(.addBlankLineAfterFirstSentence("Returns the sum of the numbers."))
146146
#endif

Tests/SwiftFormatRulesTests/UseEarlyExitsTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ final class UseEarlyExitsTests: LintOrFormatRuleTestCase {
8989
// Comment 4
9090
var result = 0
9191
for value in values {
92-
result += invertedCombobulatoryFactor(of: value)
92+
result += invertedCombobulatorFactor(of: value)
9393
}
9494
return result
9595
} else {
@@ -121,7 +121,7 @@ final class UseEarlyExitsTests: LintOrFormatRuleTestCase {
121121
// Comment 4
122122
var result = 0
123123
for value in values {
124-
result += invertedCombobulatoryFactor(of: value)
124+
result += invertedCombobulatorFactor(of: value)
125125
}
126126
return result
127127
}

Tests/SwiftFormatRulesTests/UseShorthandTypeNamesTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ final class UseShorthandTypeNamesTests: LintOrFormatRuleTestCase {
397397
""")
398398
}
399399

400-
func testOptionalsNestedInOtherTypseInStoredVarsAreStillChanged() {
400+
func testOptionalsNestedInOtherTypesInStoredVarsAreStillChanged() {
401401
XCTAssertFormatting(
402402
UseShorthandTypeNames.self,
403403
input:

Tests/SwiftFormatRulesTests/ValidateDocumentationCommentsTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ final class ValidateDocumentationCommentsTests: LintOrFormatRuleTestCase {
177177
/// Parameter(s) and Returns tags may be omitted only if the single-sentence
178178
/// brief summary fully describes the meaning of those items and including the
179179
/// tags would only repeat what has already been said
180-
func ommitedFunc(p1: Int)
180+
func omittedFunc(p1: Int)
181181
"""
182182
performLint(ValidateDocumentationComments.self, input: input)
183183
XCTAssertNotDiagnosed(.useSingularParameter)
@@ -196,9 +196,9 @@ final class ValidateDocumentationCommentsTests: LintOrFormatRuleTestCase {
196196
XCTAssertNotDiagnosed(.documentErrorsThrown(funcName: "pluralParam"))
197197
XCTAssertNotDiagnosed(.removeThrowsComment(funcName: "pluralParam"))
198198

199-
XCTAssertNotDiagnosed(.documentReturnValue(funcName: "ommitedFunc"))
200-
XCTAssertNotDiagnosed(.removeReturnComment(funcName: "ommitedFunc"))
201-
XCTAssertNotDiagnosed(.parametersDontMatch(funcName: "ommitedFunc"))
199+
XCTAssertNotDiagnosed(.documentReturnValue(funcName: "omittedFunc"))
200+
XCTAssertNotDiagnosed(.removeReturnComment(funcName: "omittedFunc"))
201+
XCTAssertNotDiagnosed(.parametersDontMatch(funcName: "omittedFunc"))
202202
}
203203

204204
func testSeparateLabelAndIdentifier() {

build-script-helper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def run(args):
133133
verbose=args.verbose
134134
)
135135
cmd = [args.swift_exec, 'build', '--show-bin-path'] + swiftpm_args
136-
bin_path = check_output(cmd, env=env, caputre_stderr=False, verbose=args.verbose).strip()
136+
bin_path = check_output(cmd, env=env, capture_stderr=False, verbose=args.verbose).strip()
137137

138138
for prefix in args.install_prefixes:
139139
cmd = ['rsync', '-a', os.path.join(bin_path, 'swift-format'), os.path.join(prefix, 'bin')]
@@ -206,10 +206,10 @@ def check_call(cmd, verbose, env=os.environ, **kwargs):
206206
print(' '.join([escape_cmd_arg(arg) for arg in cmd]))
207207
return subprocess.check_call(cmd, env=env, stderr=subprocess.STDOUT, **kwargs)
208208

209-
def check_output(cmd, verbose, env=os.environ, caputre_stderr=True, **kwargs):
209+
def check_output(cmd, verbose, env=os.environ, capture_stderr=True, **kwargs):
210210
if verbose:
211211
print(' '.join([escape_cmd_arg(arg) for arg in cmd]))
212-
if caputre_stderr:
212+
if capture_stderr:
213213
stderr = subprocess.STDOUT
214214
else:
215215
stderr = subprocess.DEVNULL

0 commit comments

Comments
 (0)