Skip to content

Commit

Permalink
Merge pull request #869 from realm/jp-fix-typo-coalescing
Browse files Browse the repository at this point in the history
fix typo: coalesing -> coalescing
  • Loading branch information
jpsim committed Nov 7, 2016
2 parents 2246bb9 + 55a0b5e commit 1b82909
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Source/SwiftLintFramework/Models/MasterRuleList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public let masterRuleList = RuleList(rules:
OperatorFunctionWhitespaceRule.self,
PrivateOutletRule.self,
PrivateUnitTestRule.self,
RedundantNilCoalesingRule.self,
RedundantNilCoalescingRule.self,
ReturnArrowWhitespaceRule.self,
StatementPositionRule.self,
OverridenSuperCallRule.self,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// RedundantNilCoalesingRule.swift
// RedundantNilCoalescingRule.swift
// SwiftLint
//
// Created by Daniel Beard on 8/24/16.
Expand All @@ -10,25 +10,25 @@ import Foundation
import SourceKittenFramework

extension File {
private func violatingRedundantNilCoalesingRanges() -> [NSRange] {
private func violatingRedundantNilCoalescingRanges() -> [NSRange] {
return matchPattern(
"\\?\\?\\s*nil\\b", // ?? {whitespace} nil {word boundary}
excludingSyntaxKinds: SyntaxKind.commentAndStringKinds()
)
}
}

public struct RedundantNilCoalesingRule: OptInRule, ConfigurationProviderRule {
public struct RedundantNilCoalescingRule: OptInRule, ConfigurationProviderRule {

public var configuration = SeverityConfiguration(.Warning)

public init() {}

public static let description = RuleDescription(
identifier: "redundant_nil_coalesing",
name: "Redundant Nil Coalesing",
identifier: "redundant_nil_coalescing",
name: "Redundant Nil Coalescing",
description: "nil coalescing operator is only evaluated if the lhs is nil " +
", coalesing operator with nil as rhs is redundant",
", coalescing operator with nil as rhs is redundant",
nonTriggeringExamples: [
"var myVar: Int?; myVar ?? 0"
],
Expand All @@ -38,7 +38,7 @@ public struct RedundantNilCoalesingRule: OptInRule, ConfigurationProviderRule {
)

public func validateFile(file: File) -> [StyleViolation] {
return file.violatingRedundantNilCoalesingRanges().map {
return file.violatingRedundantNilCoalescingRanges().map {
StyleViolation(ruleDescription: self.dynamicType.description,
severity: configuration.severity,
location: Location(file: file, characterOffset: $0.location))
Expand Down
8 changes: 4 additions & 4 deletions SwiftLint.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
1E82D5591D7775C7009553D7 /* ClosureSpacingRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E82D5581D7775C7009553D7 /* ClosureSpacingRule.swift */; };
1EC163521D5992D900DD2928 /* VerticalWhitespaceRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EC163511D5992D900DD2928 /* VerticalWhitespaceRule.swift */; };
1F11B3CF1C252F23002E8FA8 /* ClosingBraceRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F11B3CE1C252F23002E8FA8 /* ClosingBraceRule.swift */; };
24B4DF0D1D6DFDE90097803B /* RedundantNilCoalesingRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24B4DF0B1D6DFA370097803B /* RedundantNilCoalesingRule.swift */; };
24B4DF0D1D6DFDE90097803B /* RedundantNilCoalescingRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24B4DF0B1D6DFA370097803B /* RedundantNilCoalescingRule.swift */; };
24E17F721B14BB3F008195BE /* File+Cache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24E17F701B1481FF008195BE /* File+Cache.swift */; };
2E02005F1C54BF680024D09D /* CyclomaticComplexityRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E02005E1C54BF680024D09D /* CyclomaticComplexityRule.swift */; };
2E5761AA1C573B83003271AF /* FunctionParameterCountRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E5761A91C573B83003271AF /* FunctionParameterCountRule.swift */; };
Expand Down Expand Up @@ -192,7 +192,7 @@
1E82D5581D7775C7009553D7 /* ClosureSpacingRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClosureSpacingRule.swift; sourceTree = "<group>"; };
1EC163511D5992D900DD2928 /* VerticalWhitespaceRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VerticalWhitespaceRule.swift; sourceTree = "<group>"; };
1F11B3CE1C252F23002E8FA8 /* ClosingBraceRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClosingBraceRule.swift; sourceTree = "<group>"; };
24B4DF0B1D6DFA370097803B /* RedundantNilCoalesingRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RedundantNilCoalesingRule.swift; sourceTree = "<group>"; };
24B4DF0B1D6DFA370097803B /* RedundantNilCoalescingRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RedundantNilCoalescingRule.swift; sourceTree = "<group>"; };
24E17F701B1481FF008195BE /* File+Cache.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "File+Cache.swift"; sourceTree = "<group>"; };
2E02005E1C54BF680024D09D /* CyclomaticComplexityRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CyclomaticComplexityRule.swift; sourceTree = "<group>"; };
2E5761A91C573B83003271AF /* FunctionParameterCountRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FunctionParameterCountRule.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -642,7 +642,7 @@
78F032441D7C877800BE709A /* OverridenSuperCallRule.swift */,
B2902A0B1D66815600BFCCF7 /* PrivateUnitTestRule.swift */,
094385021D5D4F78009168CF /* PrivateOutletRule.swift */,
24B4DF0B1D6DFA370097803B /* RedundantNilCoalesingRule.swift */,
24B4DF0B1D6DFA370097803B /* RedundantNilCoalescingRule.swift */,
E57B23C01B1D8BF000DEA512 /* ReturnArrowWhitespaceRule.swift */,
3BCC04CE1C4F56D3006073C3 /* RuleConfigurations */,
692B60AB1BD8F2E700C7AA22 /* StatementPositionRule.swift */,
Expand Down Expand Up @@ -976,7 +976,7 @@
93E0C3CE1D67BD7F007FA25D /* ConditionalReturnsOnNewline.swift in Sources */,
7C0C2E7A1D2866CB0076435A /* ExplicitInitRule.swift in Sources */,
E88DEA771B098D0C00A66CB0 /* Rule.swift in Sources */,
24B4DF0D1D6DFDE90097803B /* RedundantNilCoalesingRule.swift in Sources */,
24B4DF0D1D6DFDE90097803B /* RedundantNilCoalescingRule.swift in Sources */,
7250948A1D0859260039B353 /* StatementPositionConfiguration.swift in Sources */,
E81619531BFC162C00946723 /* QueuedPrint.swift in Sources */,
E87E4A051BFB927C00FCFE46 /* TrailingSemicolonRule.swift in Sources */,
Expand Down
4 changes: 2 additions & 2 deletions Tests/SwiftLintFramework/RulesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ class RulesTests: XCTestCase {
verifyRule(PrivateUnitTestRule.description)
}

func testRedundantNilCoalesing() {
verifyRule(RedundantNilCoalesingRule.description)
func testRedundantNilCoalescing() {
verifyRule(RedundantNilCoalescingRule.description)
}

func testReturnArrowWhitespace() {
Expand Down

0 comments on commit 1b82909

Please sign in to comment.