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

No Grouping Extension Rule #1789

Merged
merged 14 commits into from
Aug 27, 2017
Merged

No Grouping Extension Rule #1789

merged 14 commits into from
Aug 27, 2017

Conversation

Mazyod
Copy link
Contributor

@Mazyod Mazyod commented Aug 19, 2017

Hello again!

This attempts to implement the opt-in rule for warning against grouping extensions (couldn't think of a better name).

  1. Traverse the AST once, creating a subtype Element which we can use.
  2. While traversing, note down the namespace for later checking.
  3. Check the enum, struct, & class types against the extension names.

Fixes #1767

@Mazyod
Copy link
Contributor Author

Mazyod commented Aug 19, 2017

I can see a good configuration for this might be include_nested_types. Extensions on nested types are helpful for keeping things flat.

@SwiftLintBot
Copy link

SwiftLintBot commented Aug 19, 2017

1 Error
🚫 Please rebase to get rid of the merge commits in this PR
1118 Warnings
⚠️ Make sure that the docs are updated by running the Generate docs scheme.
⚠️ This PR introduced a violation in Alamofire: /Example/Source/DetailViewController.swift#L145:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Example/Source/DetailViewController.swift#L177:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/NetworkReachabilityManager.swift#L208:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/AFError.swift#L147:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/AFError.swift#L185:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/AFError.swift#L262:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/AFError.swift#L273:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/AFError.swift#L298:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/AFError.swift#L327:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/AFError.swift#L349:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/AFError.swift#L366:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/AFError.swift#L379:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/AFError.swift#L418:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/AFError.swift#L439:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/Response.swift#L124:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/Response.swift#L148:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/Response.swift#L327:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/Response.swift#L354:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/Response.swift#L436:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/Response.swift#L444:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/Response.swift#L452:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/Response.swift#L460:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/Result.swift#L76:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/Result.swift#L91:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/Result.swift#L106:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/Request.swift#L241:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/Request.swift#L265:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/Timeline.swift#L83:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/Timeline.swift#L107:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/SessionDelegate.swift#L239:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/SessionDelegate.swift#L303:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/SessionDelegate.swift#L496:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/SessionDelegate.swift#L594:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Source/SessionDelegate.swift#L678:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Alamofire: /Tests/URLProtocolTests.swift#L95:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Account/FxAClient10.swift#L74:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Account/FxAClient10.swift#L378:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Account/FxAPushMessageHandler.swift#L28:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Account/FxAPushMessageHandler.swift#L98:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Account/FxAPushMessageHandler.swift#L115:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Account/FxAPushMessageHandler.swift#L125:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Account/FxAPushMessageHandler.swift#L163:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Account/FxAPushMessageHandler.swift#L169:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Account/FxAPushMessageHandler.swift#L175:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Account/FxAPushMessageHandler.swift#L181:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Account/FxAPushMessageHandler.swift#L195:13: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Account/SyncAuthState.swift#L42:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Account/TokenServerClient.swift#L71:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Application/AdjustIntegration.swift#L124:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Accessors/HomePageAccessors.swift#L39:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/AuthenticationManager/BasePasscodeViewController.swift#L39:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Application/AppDelegate.swift#L764:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Application/AppDelegate.swift#L776:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Application/AppDelegate.swift#L790:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Application/AppDelegate.swift#L798:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Application/AppDelegate.swift#L804:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/AuthenticationManager/PagingPasscodeViewController.swift#L51:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/AuthenticationManager/PasscodeEntryViewController.swift#L65:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/AuthenticationManager/AuthenticationSettingsViewController.swift#L138:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/AuthenticationManager/AuthenticationSettingsViewController.swift#L314:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/AuthenticationManager/AuthenticationSettingsViewController.swift#L322:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/AuthenticationManager/SensitiveViewController.swift#L103:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BackForwardListAnimator.swift#L35:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BackForwardListAnimator.swift#L47:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserTrayAnimators.swift#L21:9: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserTrayAnimators.swift#L108:9: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/ErrorPageHelper.swift#L258:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/ReaderModeBarView.swift#L160:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/SwipeAnimator.swift#L62:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/SwipeAnimator.swift#L106:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/SwipeAnimator.swift#L144:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabLocationView.swift#L246:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabLocationView.swift#L257:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabLocationView.swift#L266:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/Tab.swift#L468:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/SearchViewController.swift#L566:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabScrollController.swift#L155:9: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabScrollController.swift#L265:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabScrollController.swift#L272:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabToolbar.swift#L283:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabToolbar.swift#L293:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabToolbar.swift#L303:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabManager.swift#L633:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabManager.swift#L807:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabManager.swift#L858:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TopTabsViewController.swift#L254:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TopTabsViewController.swift#L270:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TopTabsViewController.swift#L283:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TopTabsViewController.swift#L330:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TopTabsViewController.swift#L340:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TopTabsViewController.swift#L466:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/ContentBlocker/ContentBlockerHelper.swift#L177:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabTrayController.swift#L655:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabTrayController.swift#L672:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabTrayController.swift#L680:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabTrayController.swift#L686:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabTrayController.swift#L766:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabTrayController.swift#L799:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabTrayController.swift#L810:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabTrayController.swift#L818:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabTrayController.swift#L1062:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabTrayController.swift#L1084:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabTrayController.swift#L1114:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabTrayController.swift#L1128:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabTrayController.swift#L1136:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/TabTrayController.swift#L1144:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/URLBarView.swift#L569:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/URLBarView.swift#L617:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/URLBarView.swift#L653:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/URLBarView.swift#L679:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/URLBarView.swift#L700:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/URLBarView.swift#L722:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/URLBarView.swift#L903:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L1356:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L1362:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L1371:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L1447:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L1454:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L1460:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L1471:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L1497:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L1695:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L1819:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L1852:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L1858:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L2078:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L2114:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L2130:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ This PR introduced a violation in Firefox: /Client/Frontend/Browser/BrowserViewController.swift#L2294:1: warning: No Grouping Extension Violation: Extensions shouldn’t be used to group code within the same source file. (no_grouping_extension)
⚠️ Danger found 1118 violations with this PR. Due to GitHub's max issue comment size, the number shown has been truncated to 130.
12 Messages
📖 Linting Aerial with this PR took 0.38s vs 0.35s on master (8% slower)
📖 Linting Alamofire with this PR took 2.42s vs 2.45s on master (1% faster)
📖 Linting Firefox with this PR took 10.25s vs 10.44s on master (1% faster)
📖 Linting Kickstarter with this PR took 15.62s vs 16.16s on master (3% faster)
📖 Linting Moya with this PR took 1.19s vs 1.18s on master (0% slower)
📖 Linting Nimble with this PR took 1.53s vs 1.42s on master (7% slower)
📖 Linting Quick with this PR took 0.48s vs 0.49s on master (2% faster)
📖 Linting Realm with this PR took 2.2s vs 2.27s on master (3% faster)
📖 Linting SourceKitten with this PR took 0.85s vs 0.87s on master (2% faster)
📖 Linting Sourcery with this PR took 3.71s vs 3.83s on master (3% faster)
📖 Linting Swift with this PR took 10.43s vs 10.62s on master (1% faster)
📖 Linting WordPress with this PR took 9.64s vs 9.65s on master (0% faster)

Generated by 🚫 Danger

@marcelofabri
Copy link
Collaborator

I can see a good configuration for this might be include_nested_types. Extensions on nested types are helpful for keeping things flat.

I think this can be a future improvement, since (in my experience) it's not common to have extensions on nested types that you own.

Copy link
Collaborator

@marcelofabri marcelofabri left a comment

Choose a reason for hiding this comment

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

I really liked the implementation 💯

Just some minor comments. Also, I'm not a big fan of this rule name, since "ban" is too negative and strong IMO. Can we think about something else? Maybe NoGroupingExtensionRule?


extension GroupingExtensionBanRule {

struct Element {
Copy link
Collaborator

Choose a reason for hiding this comment

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

what do you think about making this a private top level declaration? This declaration shouldn't be visible for other classes anyway.

}

private func findAllElements(in dictionary: [String: SourceKitRepresentable],
ofTypes types: [SwiftDeclarationKind],
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe change ofTypes to of?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, what do you think about changing types to Set<SwiftDeclarationKind>?

namespace: [String] = []) -> [Element] {

return dictionary.substructure
.flatMap { subDict -> [Element] in
Copy link
Collaborator

Choose a reason for hiding this comment

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

do you need to break line here (before .flatMap)

@Mazyod
Copy link
Contributor Author

Mazyod commented Aug 21, 2017

Also, I'm not a big fan of this rule name, since "ban" is too negative and strong IMO. Can we think about something else? Maybe NoGroupingExtensionRule?

Fair enough. My personal opinion is that Swiftlint needs a common suffix for discouraged (banned) practices, in order to easily navigate the rules and add consistency to naming. Starting rules with a common word like "No" and "Discourage" might group those rules and hide the actual name "GroupingExtension".

I will proceed with your suggestion now, but thought I shed light on the issue above for possible future enhancements.

@Mazyod Mazyod changed the title Grouping Extension Ban Rule No Grouping Extension Rule Aug 26, 2017
@Mazyod
Copy link
Contributor Author

Mazyod commented Aug 26, 2017

Weekend is finally here! All requested changes are done. Btw, what do you think about the sourcery version header? Didn't know what to do with it.

@codecov-io
Copy link

codecov-io commented Aug 26, 2017

Codecov Report

Merging #1789 into master will increase coverage by <.01%.
The diff coverage is 90.24%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1789      +/-   ##
==========================================
+ Coverage   88.17%   88.18%   +<.01%     
==========================================
  Files         223      224       +1     
  Lines       11027    11068      +41     
==========================================
+ Hits         9723     9760      +37     
- Misses       1304     1308       +4
Impacted Files Coverage Δ
Tests/SwiftLintFrameworkTests/RulesTests.swift 100% <100%> (ø) ⬆️
...tLintFramework/Rules/NoGroupingExtensionRule.swift 89.74% <89.74%> (ø)

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 a71e792...d70e14d. Read the comment docs.

@marcelofabri
Copy link
Collaborator

@Mazyod could you just rebase to fix the conflict? Thanks!

@Mazyod
Copy link
Contributor Author

Mazyod commented Aug 26, 2017

TIL how to resolve conflicts right from within github 😅 .. I pulled and tested, now getting file length lint error. I think I should resolve that?

@Mazyod
Copy link
Contributor Author

Mazyod commented Aug 26, 2017

Adding // swiftlint:disable type_body_length to RulesTests.swift resolved the swift test failure. Should I commit that?

@marcelofabri
Copy link
Collaborator

Should I commit that?

Yeah, we can do that by now 🤷‍♂️

@marcelofabri
Copy link
Collaborator

Also, can you try rebasing to get rid of 4c7f262? 😬

@Mazyod
Copy link
Contributor Author

Mazyod commented Aug 27, 2017

Ah, I thought you guys just squash and merge. @marcelofabri is that an option?

@marcelofabri
Copy link
Collaborator

I can do that 👍

@@ -133,6 +135,10 @@ class RulesTests: XCTestCase {
verifyRule(FunctionParameterCountRule.description)
}

func testNoGroupingExtension() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

just one more thing: we try to keep this list sorted. Can you please move it (and run make sourcery again)? 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of course! Sorry about that.

@marcelofabri marcelofabri merged commit 03676c9 into realm:master Aug 27, 2017
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.

4 participants