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

Trailing closure rule #1193

Merged
merged 6 commits into from
Jul 25, 2017
Merged

Trailing closure rule #1193

merged 6 commits into from
Jul 25, 2017

Conversation

marcelofabri
Copy link
Collaborator

@marcelofabri marcelofabri commented Jan 15, 2017

Fixes #54

I'm thinking maybe this should be opt-in because it's not clear what style the community prefers.

  • GitHub's style guide doesn't pick a style
  • Ray Wenderlich's one says that trailing closures are preferred
  • Erica Sadun says that “When a trailing closure argument is functional, use parentheses. When it is procedural, use braces.”

I'm curious to see the OSS check on this rule. One improvement that could be made is ignore a violation if there're other closure parameters in the call.

@SwiftLintBot
Copy link

SwiftLintBot commented Jan 15, 2017

762 Warnings
⚠️ This PR introduced a violation in Aerial: /Aerial/Source/Models/Cache/VideoDownload.swift#L198:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Aerial: /Aerial/Source/Models/Cache/VideoDownload.swift#L207:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Aerial: /Aerial/Source/Controllers/PreferencesWindowController.swift#L480:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Aerial: /Aerial/Source/Models/ManifestLoader.swift#L71:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Aerial: /Aerial/Source/Models/ManifestLoader.swift#L144:20: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Aerial: /Aerial/Source/Models/ManifestLoader.swift#L151:17: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Aerial: /Aerial/Source/Models/ManifestLoader.swift#L163:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Alamofire: /Tests/CacheTests.swift#L138:27: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Alamofire: /Tests/CacheTests.swift#L192:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Alamofire: /Tests/DownloadTests.swift#L261:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Alamofire: /Tests/DownloadTests.swift#L292:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Alamofire: /Tests/DownloadTests.swift#L322:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Alamofire: /Tests/DownloadTests.swift#L361:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Alamofire: /Tests/ResultTests.swift#L155:23: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Alamofire: /Tests/ResultTests.swift#L170:23: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Account/SyncAuthState.swift#L140:24: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Application/LeanplumIntegration.swift#L125:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Application/LeanplumIntegration.swift#L133:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Application/LeanplumIntegration.swift#L167:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Extensions/UIImageViewExtensions.swift#L99:36: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Application/AppDelegate.swift#L211:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Application/AppDelegate.swift#L233:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Application/AppDelegate.swift#L494:18: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/AuthenticationManager/AuthenticationSettingsViewController.swift#L15:5: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/AuthenticationManager/PasscodeViews.swift#L177:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/AuthenticationManager/PasscodeViews.swift#L198:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/AuthenticationManager/PasscodeViews.swift#L205:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BackForwardTableViewCell.swift#L52:17: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserPrompts.swift#L107:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BackForwardListViewController.swift#L104:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BackForwardListViewController.swift#L104:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BackForwardListViewController.swift#L114:53: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BackForwardListViewController.swift#L117:20: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController/BrowserViewController+WKNavigationDelegate.swift#L108:37: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/ButtonToast.swift#L155:17: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/ClipboardBarDisplayHandler.swift#L73:26: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/FaviconManager.swift#L54:20: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/FaviconManager.swift#L113:31: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/ErrorPageHelper.swift#L135:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/ErrorPageHelper.swift#L204:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/ErrorPageHelper.swift#L209:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/MailtoLinkHandler.swift#L28:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/MailProviders.swift#L32:5: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/LoginsHelper.swift#L165:17: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/LoginsHelper.swift#L171:17: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/LoginsHelper.swift#L206:17: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/LoginsHelper.swift#L212:17: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/LoginsHelper.swift#L234:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/OpenWithSettingsViewController.swift#L70:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/QRCodeViewController.swift#L144:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/QRCodeViewController.swift#L149:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/QRCodeViewController.swift#L214:29: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/QRCodeViewController.swift#L222:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/SearchEngines.swift#L96:20: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/SimpleToast.swift#L66:17: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/SwipeAnimator.swift#L64:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabLocationView.swift#L90:17: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/Tab.swift#L345:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/Tab.swift#L356:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/SearchViewController.swift#L441:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/SearchViewController.swift#L456:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabManager.swift#L364:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabManager.swift#L437:20: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabManager.swift#L441:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabManager.swift#L464:21: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabManager.swift#L929:17: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabManager.swift#L944:17: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TopTabsViewController.swift#L242:21: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TopTabsViewController.swift#L426:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L189:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L203:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L396:25: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L403:23: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L412:29: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L1169:26: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L1579:28: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L1719:30: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L2029:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L2099:21: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L2735:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L2772:17: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L2779:33: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L2849:26: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L3012:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabTrayController.swift#L684:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/URLBarView.swift#L424:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Home/ActivityStreamPanel.swift#L497:39: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Home/ActivityStreamPanel.swift#L589:16: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Home/ActivityStreamPanel.swift#L697:30: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Home/ActivityStreamPanel.swift#L707:30: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Home/ActivityStreamPanel.swift#L722:39: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Home/ActivityStreamPanel.swift#L730:27: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Home/ActivityStreamPanel.swift#L747:35: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Home/ActivityStreamPanel.swift#L752:38: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Home/ActivityStreamPanel.swift#L757:26: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Home/ActivityStreamPanel.swift#L761:32: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Home/ActivityStreamTopSitesCell.swift#L175:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Home/BookmarksPanel.swift#L370:22: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Home/BookmarksPanel.swift#L436:26: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Home/BookmarksPanel.swift#L447:32: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Home/HistoryPanel.swift#L361:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Home/HistoryPanel.swift#L548:22: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Home/HistoryPanel.swift#L568:28: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Home/HistoryPanel.swift#L572:26: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Home/RecentlyClosedTabsPanel.swift#L123:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Home/HomePanelViewController.swift#L321:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Home/ReaderPanel.swift#L467:51: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Login/LoginViewController.swift#L21:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Home/TopSitesPanel.swift#L347:35: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Home/TopSitesPanel.swift#L555:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Home/TopSitesPanel.swift#L642:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Reader/ReadabilityService.swift#L40:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Reader/ReaderMode.swift#L290:17: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Settings/Clearables.swift#L81:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Settings/Clearables.swift#L123:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Settings/Clearables.swift#L143:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Settings/FxAContentViewController.swift#L211:24: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Settings/SettingsContentViewController.swift#L27:17: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Settings/SettingsContentViewController.swift#L42:17: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Settings/AppSettingsOptions.swift#L545:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Settings/AppSettingsOptions.swift#L570:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Settings/LoginDetailViewController.swift#L348:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Settings/SearchSettingsTableViewController.swift#L32:33: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Share/ShareExtensionHelper.swift#L144:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Share/ShareExtensionHelper.swift#L160:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Widgets/ActivityStreamHighlightCell.swift#L155:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Widgets/AutocompleteTextField.swift#L73:29: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Widgets/Menu/MenuViewController.swift#L148:9: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Widgets/Menu/MenuViewController.swift#L157:13: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Widgets/SnackBar.swift#L289:33: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Widgets/SnackBar.swift#L293:33: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Widgets/TwoLineCell.swift#L237:21: warning: Trailing Closure Violation: Trailing closure syntax should be used whenever possible. (trailing_closure)
⚠️ Danger found 762 violations with this PR. Due to GitHub's max issue comment size, the number shown has been truncated to 132.
12 Messages
📖 Linting Aerial with this PR took 0.35s vs 0.34s on master (2% slower)
📖 Linting Alamofire with this PR took 2.41s vs 2.45s on master (1% faster)
📖 Linting Firefox with this PR took 10.37s vs 10.07s on master (2% slower)
📖 Linting Kickstarter with this PR took 14.97s vs 14.62s on master (2% slower)
📖 Linting Moya with this PR took 0.67s vs 0.69s on master (2% faster)
📖 Linting Nimble with this PR took 1.38s vs 1.34s on master (2% slower)
📖 Linting Quick with this PR took 0.45s vs 0.43s on master (4% slower)
📖 Linting Realm with this PR took 2.14s vs 2.07s on master (3% slower)
📖 Linting SourceKitten with this PR took 0.79s vs 0.78s on master (1% slower)
📖 Linting Sourcery with this PR took 3.54s vs 3.0s on master (18% slower)
📖 Linting Swift with this PR took 10.1s vs 9.95s on master (1% slower)
📖 Linting WordPress with this PR took 9.37s vs 9.56s on master (1% faster)

Generated by 🚫 Danger

@codecov-io
Copy link

codecov-io commented Jan 15, 2017

Codecov Report

Merging #1193 into master will increase coverage by 0.06%.
The diff coverage is 97.43%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1193      +/-   ##
==========================================
+ Coverage   87.35%   87.41%   +0.06%     
==========================================
  Files         207      208       +1     
  Lines       10206    10278      +72     
==========================================
+ Hits         8915     8985      +70     
- Misses       1291     1293       +2
Impacted Files Coverage Δ
...e/SwiftLintFramework/Reporters/EmojiReporter.swift 90.47% <100%> (ø) ⬆️
Source/SwiftLintFramework/Models/Linter.swift 71.26% <100%> (ø) ⬆️
...urce/SwiftLintFramework/Rules/LargeTupleRule.swift 95.76% <100%> (ø) ⬆️
...SwiftLintFramework/Extensions/File+SwiftLint.swift 93.17% <100%> (-0.04%) ⬇️
Tests/SwiftLintFrameworkTests/RulesTests.swift 100% <100%> (ø) ⬆️
...SwiftLintFramework/Rules/TrailingClosureRule.swift 97.18% <97.18%> (ø)

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 2a60cc6...354ec3c. Read the comment docs.

@jpsim
Copy link
Collaborator

jpsim commented Jan 25, 2017

I'm not sure about this one.

@marcelofabri
Copy link
Collaborator Author

I'm not sure about this one.

About this being a rule at all or being a default rule? I feel like it should be opt-in since it should trigger lots of warnings on projects and there's no definitive decision from the community.

@jpsim
Copy link
Collaborator

jpsim commented Jan 25, 2017

Even as opt-in I think it needs work. For example, I wouldn't consider accessing the property after a call to a closure to require it to use trailing closure syntax, such as the first OSSCheck violation reported here:

XCTAssertEqual(1, schema.objectSchema.filter({ $0.className == "SwiftStringObject" }).count)

@marcelofabri
Copy link
Collaborator Author

I think that could be a configuration, since I can see teams preferring one style over another.

@jpsim
Copy link
Collaborator

jpsim commented Jan 25, 2017

Danger found 1046 violations with this PR. Due to GitHub's max issue comment size, the number shown has been truncated to 133.

😳 . Should definitely be opt-in.

@Coeur
Copy link

Coeur commented Mar 30, 2017

does it support the case where we would have an ambiguity between two func?

func test(one: (String) -> Void) {}
func test(two: (Int) -> Void) {}
// error: ambiguous use of 'test'
//test { _ in }
// must not warn with SwiftLint
test(one: { _ in })

@marcelofabri
Copy link
Collaborator Author

@Coeur not really, and I'm not sure we'd able to address that. Another reason to make this opt-in.

@jpsim
Copy link
Collaborator

jpsim commented May 24, 2017

@marcelofabri what would you like to do with this?

@marcelofabri
Copy link
Collaborator Author

I can revive this, just want to be sure what the behavior should be regarding #1193 (comment)

@Mazyod
Copy link
Contributor

Mazyod commented May 25, 2017

Not sure if you guys already considered this, but just putting it out there. Trailing closure syntax doesn't work within a conditional statement:

  4> if a.filter { $0 == 1 }.isEmpty { 
  5.     print("no ones!") 
  6. } 
error: repl.swift:4:15: error: anonymous closure argument not contained in a closure
if a.filter { $0 == 1 }.isEmpty {
              ^

error: repl.swift:4:24: error: consecutive statements on a line must be separated by ';'
if a.filter { $0 == 1 }.isEmpty {
                       ^
                       ;


  4> if a.filter({ $0 == 1 }).isEmpty { 
  5.     print("no ones!") 
  6. } 

@Coeur
Copy link

Coeur commented May 25, 2017

@marcelofabri if the question is:

XCTAssertEqual(1, schema.objectSchema.filter({ $0.className == "SwiftStringObject" }).count)
or:
XCTAssertEqual(1, schema.objectSchema.filter { $0.className == "SwiftStringObject" }.count)

Then second syntax is fine. But again, I would personally not opt-in to this rule, because of the false positive this rule would cause like in the example I gave two months ago, so my opinion is biased.

@marcelofabri
Copy link
Collaborator Author

@Mazyod the rule already deals with it

@marcelofabri
Copy link
Collaborator Author

@jpsim I'm thinking about merging this one as it is. Later we can add a configuration to deal with #1193 (comment).

@jpsim
Copy link
Collaborator

jpsim commented Jul 25, 2017

Sounds good @marcelofabri!

@marcelofabri marcelofabri merged commit d6e7df2 into realm:master Jul 25, 2017
@marcelofabri marcelofabri deleted the trailing-closure-rule branch July 25, 2017 22:23
@jpsim
Copy link
Collaborator

jpsim commented Jul 25, 2017

Should we file an issue to allow parameterizing the rule to allow/disallow #1193 (comment)?

@marcelofabri
Copy link
Collaborator Author

Filled #1718.

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.

None yet

6 participants