Skip to content

Fix attributes rule false positive with Swift 5.2 - #3154

Merged
jpsim merged 1 commit into
masterfrom
fix-attributes-rule-false-positive-with-swift-5.2
Mar 27, 2020
Merged

jpsim merged 1 commit into
masterfrom
fix-attributes-rule-false-positive-with-swift-5.2

Conversation

@jpsim

@jpsim jpsim commented Mar 27, 2020 •

Copy link
Copy Markdown
Collaborator

The following was triggering:

func printBoolOrTrue(_ expression: @autoclosure () throws -> Bool?) rethrows {
  try print(expression() ?? true)
}

Fix by adding the rethrows attribute kind to the rule's blacklist.

The following was trigggering:

```swift
func printBoolOrTrue(_ expression: @autoclosure () throws -> Bool?) rethrows {
  try print(expression() ?? true)
}
```

Fix by adding the `rethrows` attribute kind to the rule's blacklist.
.open,
.setterPrivate,
.required,
.rethrows,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The addition of this kind is the only change in this file, but I resorted the collection literal to make it easier to update in the future.

@SwiftLintBot

Copy link
Copy Markdown
12 Messages
📖 Linting Aerial with this PR took 1.37s vs 1.35s on master (1% slower)
📖 Linting Alamofire with this PR took 2.2s vs 2.19s on master (0% slower)
📖 Linting Firefox with this PR took 9.12s vs 9.05s on master (0% slower)
📖 Linting Kickstarter with this PR took 14.16s vs 14.05s on master (0% slower)
📖 Linting Moya with this PR took 1.3s vs 1.29s on master (0% slower)
📖 Linting Nimble with this PR took 1.36s vs 1.34s on master (1% slower)
📖 Linting Quick with this PR took 0.53s vs 0.53s on master (0% slower)
📖 Linting Realm with this PR took 2.32s vs 2.36s on master (1% faster)
📖 Linting SourceKitten with this PR took 1.0s vs 1.01s on master (0% faster)
📖 Linting Sourcery with this PR took 6.7s vs 6.74s on master (0% faster)
📖 Linting Swift with this PR took 12.56s vs 12.6s on master (0% faster)
📖 Linting WordPress with this PR took 15.19s vs 15.22s on master (0% faster)

Generated by 🚫 Danger

@jpsim
jpsim merged commit 85d3425 into master Mar 27, 2020
@jpsim
jpsim deleted the fix-attributes-rule-false-positive-with-swift-5.2 branch March 27, 2020 16:33
pull Bot pushed a commit to scope-demo/SwiftLint that referenced this pull request Mar 27, 2020
The following was triggering:

```swift
func printBoolOrTrue(_ expression: @autoclosure () throws -> Bool?) rethrows {
  try print(expression() ?? true)
}
```

Fix by adding the `rethrows` attribute kind to the rule's blacklist.
optionalendeavors added a commit to optionalendeavors/SwiftLint that referenced this pull request Jul 12, 2020
* master: (101 commits)
  JUnit reporter for GitLab artifact:report:junit (realm#3177)
  Add empty changelog section
  release 0.39.2
  Update CI to run jobs with Xcode 11.0 to 11.4 (realm#3168)
  Fix false positives in valid_ibinspectable rule when using Swift 5.2 (realm#3155)
  Fix attributes rule false positive with Swift 5.2 (realm#3154)
  Fix CHANGELOG link
  Fix false positives in redundant_objc_attribute with Swift 5.2 (realm#3152)
  Fix false positives on implicit_getter with Swift 5.2+ (realm#3151)
  Simplify regex (realm#3145)
  fix links about configuration rules (realm#3142)
  Add unused_import config options to require imports for each module used (realm#3123)
  Add empty changelog section
  release 0.39.1
  Temporarily remove all SwiftSyntax rules and support (realm#3107)
  Fix unused_import rule reported locations and corrections (realm#3106)
  release 0.39.0
  Fix false positive in `empty_string` rule with multiline literals (realm#3101)
  Fix PrivateActionRule in Swift 5.2 (realm#3092)
  Fix false positive in implicit_getter with Swift 5.2 (realm#3099)
  ...

# Conflicts:
#	Source/SwiftLintFramework/Extensions/SwiftLintFile+Regex.swift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants