Skip to content

Commit

Permalink
Remove WeakComputedProperyRule (#2761)
Browse files Browse the repository at this point in the history
* Remove WeakComputedProperyRule

Addresses #2712

* fixup! Remove WeakComputedProperyRule
  • Loading branch information
jpsim authored May 16, 2019
1 parent d01ed71 commit c216ccc
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 281 deletions.
8 changes: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@

#### Breaking

* None.
* Remove the `weak_computed_property` rule. Please see linked issue for
discussion and rationale.
[JP Simard](https://github.com/jpsim)
[#2712](https://github.com/realm/SwiftLint/issues/2712)

#### Experimental

* None.

#### Enhancements


* Add `" - "` delimiter to allow commenting SwiftLint commands without triggering
`superfluous_disable_command`.
`superfluous_disable_command`.
[Kevin Randrup](https://github.com/kevinrandrup)

* Make `testSimulateHomebrewTest()` test opt-in because it may fail on unknown
Expand Down
71 changes: 0 additions & 71 deletions Rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@
* [Vertical Whitespace before Closing Braces](#vertical-whitespace-before-closing-braces)
* [Vertical Whitespace after Opening Braces](#vertical-whitespace-after-opening-braces)
* [Void Return](#void-return)
* [Weak Computed Property](#weak-computed-property)
* [Weak Delegate](#weak-delegate)
* [XCTest Specific Matcher](#xctest-specific-matcher)
* [XCTFail Message](#xctfail-message)
Expand Down Expand Up @@ -24890,76 +24889,6 @@ let foo: (ConfigurationTests) -> () throws -> ↓())



## Weak Computed Property

Identifier | Enabled by default | Supports autocorrection | Kind | Analyzer | Minimum Swift Compiler Version
--- | --- | --- | --- | --- | ---
`weak_computed_property` | Enabled | Yes | lint | No | 4.1.0

Adding weak to a computed property has no effect.

### Examples

<details>
<summary>Non Triggering Examples</summary>

```swift
class Foo {
weak var delegate: SomeProtocol?
}
```

```swift
class Foo {
var delegate: SomeProtocol?
}
```

```swift
class Foo {
weak var delegate: SomeProtocol? {
didSet {
update(with: delegate)
}
}
}
```

```swift
class Foo {
weak var delegate: SomeProtocol? {
willSet {
update(with: delegate)
}
}
}
```

</details>
<details>
<summary>Triggering Examples</summary>

```swift
class Foo {
weak var delegate: SomeProtocol? { return bar() }
}
```

```swift
class Foo {
private weak var _delegate: SomeProtocol?

weak var delegate: SomeProtocol? {
get { return _delegate }
set { _delegate = newValue }
}
}
```

</details>



## Weak Delegate

Identifier | Enabled by default | Supports autocorrection | Kind | Analyzer | Minimum Swift Compiler Version
Expand Down
1 change: 0 additions & 1 deletion Source/SwiftLintFramework/Models/MasterRuleList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ public let masterRuleList = RuleList(rules: [
VerticalWhitespaceOpeningBracesRule.self,
VerticalWhitespaceRule.self,
VoidReturnRule.self,
WeakComputedProperyRule.self,
WeakDelegateRule.self,
XCTFailMessageRule.self,
XCTSpecificMatcherRule.self,
Expand Down
189 changes: 0 additions & 189 deletions Source/SwiftLintFramework/Rules/Lint/WeakComputedProperyRule.swift

This file was deleted.

4 changes: 0 additions & 4 deletions SwiftLint.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@
D41985EB21FAB63E003BE2B7 /* DeploymentTargetConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = D41985EA21FAB63E003BE2B7 /* DeploymentTargetConfiguration.swift */; };
D41985ED21FAD033003BE2B7 /* DeploymentTargetConfigurationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D41985EC21FAD033003BE2B7 /* DeploymentTargetConfigurationTests.swift */; };
D41985EF21FAD5E8003BE2B7 /* DeploymentTargetRuleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D41985EE21FAD5E8003BE2B7 /* DeploymentTargetRuleTests.swift */; };
D41985F121FC5AF7003BE2B7 /* WeakComputedProperyRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D41985F021FC5AF7003BE2B7 /* WeakComputedProperyRule.swift */; };
D41B57781ED8CEE0007B0470 /* ExtensionAccessModifierRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D41B57771ED8CEE0007B0470 /* ExtensionAccessModifierRule.swift */; };
D41E7E0B1DF9DABB0065259A /* RedundantStringEnumValueRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D41E7E0A1DF9DABB0065259A /* RedundantStringEnumValueRule.swift */; };
D4246D6D1F30D8620097E658 /* PrivateOverFilePrivateRuleConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4246D6C1F30D8620097E658 /* PrivateOverFilePrivateRuleConfiguration.swift */; };
Expand Down Expand Up @@ -734,7 +733,6 @@
D41985EA21FAB63E003BE2B7 /* DeploymentTargetConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeploymentTargetConfiguration.swift; sourceTree = "<group>"; };
D41985EC21FAD033003BE2B7 /* DeploymentTargetConfigurationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeploymentTargetConfigurationTests.swift; sourceTree = "<group>"; };
D41985EE21FAD5E8003BE2B7 /* DeploymentTargetRuleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeploymentTargetRuleTests.swift; sourceTree = "<group>"; };
D41985F021FC5AF7003BE2B7 /* WeakComputedProperyRule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeakComputedProperyRule.swift; sourceTree = "<group>"; };
D41B57771ED8CEE0007B0470 /* ExtensionAccessModifierRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExtensionAccessModifierRule.swift; sourceTree = "<group>"; };
D41E7E0A1DF9DABB0065259A /* RedundantStringEnumValueRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RedundantStringEnumValueRule.swift; sourceTree = "<group>"; };
D4246D6C1F30D8620097E658 /* PrivateOverFilePrivateRuleConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrivateOverFilePrivateRuleConfiguration.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1119,7 +1117,6 @@
8F6B3153213CDCD100858E44 /* UnusedPrivateDeclarationRule.swift */,
D4B3409C21F16B110038C79A /* UnusedSetterValueRule.swift */,
D442541E1DB87C3D00492EA4 /* ValidIBInspectableRule.swift */,
D41985F021FC5AF7003BE2B7 /* WeakComputedProperyRule.swift */,
094384FF1D5D2382009168CF /* WeakDelegateRule.swift */,
1872906F1FC37A9B0016BEA2 /* YodaConditionRule.swift */,
);
Expand Down Expand Up @@ -2106,7 +2103,6 @@
D4130D971E16183F00242361 /* IdentifierNameRuleExamples.swift in Sources */,
7250948A1D0859260039B353 /* StatementModeConfiguration.swift in Sources */,
E81619531BFC162C00946723 /* QueuedPrint.swift in Sources */,
D41985F121FC5AF7003BE2B7 /* WeakComputedProperyRule.swift in Sources */,
E87E4A051BFB927C00FCFE46 /* TrailingSemicolonRule.swift in Sources */,
D4B472411F66486300BD6EF1 /* FallthroughRule.swift in Sources */,
B25DCD0B1F7E9F9E0028A199 /* MultilineArgumentsRuleExamples.swift in Sources */,
Expand Down
9 changes: 2 additions & 7 deletions Tests/LinuxMain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,15 @@ extension CommandTests {
("testEnablePrevious", testEnablePrevious),
("testEnableThis", testEnableThis),
("testEnableNext", testEnableNext),
("testTrailingCOmment", testTrailingCOmment),
("testActionInverse", testActionInverse),
("testNoModifierCommandExpandsToItself", testNoModifierCommandExpandsToItself),
("testExpandPreviousCommand", testExpandPreviousCommand),
("testExpandThisCommand", testExpandThisCommand),
("testExpandNextCommand", testExpandNextCommand),
("testSuperfluousDisableCommands", testSuperfluousDisableCommands),
("testDisableAllOverridesSuperfluousDisableCommand", testDisableAllOverridesSuperfluousDisableCommand),
("testSuperfluousDisableCommandsIgnoreDelimiter", testSuperfluousDisableCommandsIgnoreDelimiter),
("testInvalidDisableCommands", testInvalidDisableCommands),
("testSuperfluousDisableCommandsDisabled", testSuperfluousDisableCommandsDisabled),
("testSuperfluousDisableCommandsDisabledOnConfiguration", testSuperfluousDisableCommandsDisabledOnConfiguration)
Expand Down Expand Up @@ -1454,12 +1456,6 @@ extension VoidReturnRuleTests {
]
}

extension WeakComputedProperyRuleTests {
static var allTests: [(String, (WeakComputedProperyRuleTests) -> () throws -> Void)] = [
("testWithDefaultConfiguration", testWithDefaultConfiguration)
]
}

extension WeakDelegateRuleTests {
static var allTests: [(String, (WeakDelegateRuleTests) -> () throws -> Void)] = [
("testWithDefaultConfiguration", testWithDefaultConfiguration)
Expand Down Expand Up @@ -1707,7 +1703,6 @@ XCTMain([
testCase(VerticalWhitespaceOpeningBracesRuleTests.allTests),
testCase(VerticalWhitespaceRuleTests.allTests),
testCase(VoidReturnRuleTests.allTests),
testCase(WeakComputedProperyRuleTests.allTests),
testCase(WeakDelegateRuleTests.allTests),
testCase(XCTFailMessageRuleTests.allTests),
testCase(XCTSpecificMatcherRuleTests.allTests),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -768,12 +768,6 @@ class VoidReturnRuleTests: XCTestCase {
}
}

class WeakComputedProperyRuleTests: XCTestCase {
func testWithDefaultConfiguration() {
verifyRule(WeakComputedProperyRule.description)
}
}

class WeakDelegateRuleTests: XCTestCase {
func testWithDefaultConfiguration() {
verifyRule(WeakDelegateRule.description)
Expand Down

0 comments on commit c216ccc

Please sign in to comment.