Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] UnusedCaptureListRule: implicit self in @escaping closures #3352

Merged
merged 3 commits into from
Sep 18, 2020

Conversation

hank121314
Copy link
Contributor

Summary

This pr fixes: #3267 .

Since Swift 5.3 is released. It support implicit self in @escaping closures(SE-0269)

I think we should exclude self keyword from capture list rule.

Test Plan

I have already add some test in example.

Thanks you so much for your code review!

@SwiftLintBot
Copy link

SwiftLintBot commented Sep 18, 2020

12 Messages
📖 Linting Aerial with this PR took 0.84s vs 0.79s on master (6% slower)
📖 Linting Alamofire with this PR took 1.02s vs 0.99s on master (3% slower)
📖 Linting Firefox with this PR took 3.88s vs 3.7s on master (4% slower)
📖 Linting Kickstarter with this PR took 6.41s vs 6.29s on master (1% slower)
📖 Linting Moya with this PR took 0.53s vs 0.51s on master (3% slower)
📖 Linting Nimble with this PR took 0.55s vs 0.57s on master (3% faster)
📖 Linting Quick with this PR took 0.33s vs 0.3s on master (10% slower)
📖 Linting Realm with this PR took 1.14s vs 1.17s on master (2% faster)
📖 Linting SourceKitten with this PR took 0.49s vs 0.49s on master (0% slower)
📖 Linting Sourcery with this PR took 2.62s vs 2.52s on master (3% slower)
📖 Linting Swift with this PR took 8.2s vs 8.2s on master (0% slower)
📖 Linting WordPress with this PR took 7.06s vs 7.02s on master (0% slower)

Generated by 🚫 Danger

@codecov-commenter
Copy link

codecov-commenter commented Sep 18, 2020

Codecov Report

Merging #3352 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3352   +/-   ##
=======================================
  Coverage   90.50%   90.51%           
=======================================
  Files         417      417           
  Lines       20432    20434    +2     
=======================================
+ Hits        18493    18495    +2     
  Misses       1939     1939           
Impacted Files Coverage Δ
...ntFramework/Rules/Lint/UnusedCaptureListRule.swift 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d2e8cf...cdc70d4. Read the comment docs.

@jpsim
Copy link
Collaborator

jpsim commented Sep 18, 2020

Thank you so much for the PR!

@jpsim jpsim merged commit 5e537fa into realm:master Sep 18, 2020
@shawnkoh
Copy link

This fix only catches [self]
[unowned self] still triggers.

optionalendeavors added a commit to optionalendeavors/SwiftLint that referenced this pull request Oct 4, 2020
* master-upstream: (98 commits)
  Fix some false positives in rule `explicit_self` (realm#3368)
  Update SourceKitten to 0.30.1 (realm#3367)
  Fix issues with analyzer rules, Xcode 12 & SwiftUI (realm#3366)
  Add empty changelog section
  release 0.40.3
  Fix false positives for 'multiple_closures_with_trailing_closure' (realm#3353)
  [UnusedDeclarationRule] Work around SR-11985 (realm#3363)
  Revert "Fix finding the nested config when a single file path is passed (realm#3342)" (realm#3362)
  [CONTRIBUTING] Add building & running tips (realm#3360)
  Fix finding the nested config when a single file path is passed (realm#3342)
  Include Linux zip in list of GitHub release binaries (realm#3350)
  [UnusedDeclarationRule] Add more tests (realm#3359)
  Test CI with official Swift 5.3 release (realm#3356)
  Don't mark `@NSApplicationMain` or `@UIApplicationMain` classes as unused (realm#3355)
  [Fix] `UnusedCaptureListRule`: implicit self in @escaping closures (realm#3352)
  Skip correcting files with parser diagnostics (realm#3349)
  [SwiftLintFile] Remove lock in favor of UUID (realm#3347)
  [UnusedDeclarationRule] Speed up and detect more dead code (realm#3340)
  Add empty changelog section
  release 0.40.2
  ...

# Conflicts:
#	Source/swiftlint/Helpers/LintableFilesVisitor.swift
optionalendeavors added a commit to optionalendeavors/SwiftLint that referenced this pull request Oct 4, 2020
* master: (98 commits)
  Fix some false positives in rule `explicit_self` (realm#3368)
  Update SourceKitten to 0.30.1 (realm#3367)
  Fix issues with analyzer rules, Xcode 12 & SwiftUI (realm#3366)
  Add empty changelog section
  release 0.40.3
  Fix false positives for 'multiple_closures_with_trailing_closure' (realm#3353)
  [UnusedDeclarationRule] Work around SR-11985 (realm#3363)
  Revert "Fix finding the nested config when a single file path is passed (realm#3342)" (realm#3362)
  [CONTRIBUTING] Add building & running tips (realm#3360)
  Fix finding the nested config when a single file path is passed (realm#3342)
  Include Linux zip in list of GitHub release binaries (realm#3350)
  [UnusedDeclarationRule] Add more tests (realm#3359)
  Test CI with official Swift 5.3 release (realm#3356)
  Don't mark `@NSApplicationMain` or `@UIApplicationMain` classes as unused (realm#3355)
  [Fix] `UnusedCaptureListRule`: implicit self in @escaping closures (realm#3352)
  Skip correcting files with parser diagnostics (realm#3349)
  [SwiftLintFile] Remove lock in favor of UUID (realm#3347)
  [UnusedDeclarationRule] Speed up and detect more dead code (realm#3340)
  Add empty changelog section
  release 0.40.2
  ...
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.

unused_capture_list false positive with explicit capturing of strong self in Swift 5.3
5 participants