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

Make SortedImportsRule auto-correctable #1922

Merged
merged 7 commits into from
Oct 24, 2017
Merged

Make SortedImportsRule auto-correctable #1922

merged 7 commits into from
Oct 24, 2017

Conversation

jpsim
Copy link
Collaborator

@jpsim jpsim commented Oct 23, 2017

Addresses #1822. Continued from @sammy-SC's work in #1845.

Fixes some issues with the implementation in #1845:

  • Fix superfluous disable command producing false positives
  • Fix import formatting assumptions:
    • Exactly once space after import
    • No support for @testable import
  • Reduce indentation
  • Omit types when they can be inferred
  • Omit explicit references to self.
  • Fix typos in comments
  • Make constrained extensions more generic
  • Use explicit ACLs for all declarations

sammy-SC and others added 7 commits October 23, 2017 15:10
* Fix superfluous disable command producing false positives
* Fix import formatting assumptions:
  * Exactly once space after `import`
  * No support for `@testable import`
* Reduce indentation
* Omit types when they can be inferred
* Omit explicit references to `self.`
* Fix typos in comments
* Make constrained extensions more generic
* Use explicit ACLs for all declarations
@jpsim
Copy link
Collaborator Author

jpsim commented Oct 23, 2017

I'd appreciate a review from @sammy-SC & @sberrevoets

@SwiftLintBot
Copy link

3 Warnings
⚠️ This PR may need tests.
⚠️ This PR introduced a violation in SourceKitten: /Users/distiller/project/osscheck/SourceKitten/Source/sourcekitten/main.swift:9:36: error: Superfluous Disable Command Violation: SwiftLint rule 'sorted_imports' did not trigger a violation in the disabled region. Please remove the disable command. (superfluous_disable_command)
⚠️ This PR introduced a violation in WordPress: /Users/distiller/project/osscheck/WordPress/WordPress/Classes/ViewRelated/Themes/ThemeBrowserViewController.swift:5:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
47 Messages
📖 Linting Aerial with this PR took 0.45s vs 0.38s on master (18% slower)
📖 Linting Alamofire with this PR took 3.17s vs 3.2s on master (0% faster)
📖 Linting Firefox with this PR took 12.82s vs 12.77s on master (0% slower)
📖 Linting Kickstarter with this PR took 20.41s vs 20.36s on master (0% slower)
📖 Linting Moya with this PR took 1.66s vs 1.68s on master (1% faster)
📖 Linting Nimble with this PR took 1.96s vs 1.95s on master (0% slower)
📖 Linting Quick with this PR took 0.54s vs 0.56s on master (3% faster)
📖 Linting Realm with this PR took 3.38s vs 3.45s on master (2% faster)
📖 Linting SourceKitten with this PR took 1.09s vs 1.06s on master (2% slower)
📖 Linting Sourcery with this PR took 4.48s vs 4.48s on master (0% slower)
📖 Linting Swift with this PR took 14.64s vs 14.59s on master (0% slower)
📖 Linting WordPress with this PR took 12.58s vs 12.55s on master (0% slower)
📖 This PR fixed a violation in Alamofire: /Users/distiller/project/osscheck/Alamofire/Source/MultipartFormData.swift:30:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Application/QuickActions.swift:8:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Browser/OpenInHelper.swift:10:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Home/HistoryPanel.swift:7:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Firefox: /Users/distiller/project/osscheck/Firefox/Client/Frontend/Home/RecentlyClosedTabsPanel.swift:7:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Kickstarter: /Users/distiller/project/osscheck/Kickstarter/Kickstarter-iOS/AppDelegate.swift:9:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Moya: /Users/distiller/project/osscheck/Moya/Sources/Moya/Image.swift:5:12: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Moya: /Users/distiller/project/osscheck/Moya/Sources/ReactiveMoya/MoyaProvider+Reactive.swift:4:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Moya: /Users/distiller/project/osscheck/Moya/Sources/RxMoya/MoyaProvider+Rx.swift:4:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Moya: /Users/distiller/project/osscheck/Moya/Sources/ReactiveMoya/SignalProducer+Response.swift:4:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Moya: /Users/distiller/project/osscheck/Moya/Sources/RxMoya/Single+Response.swift:4:12: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Moya: /Users/distiller/project/osscheck/Moya/Sources/RxMoya/Observable+Response.swift:4:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Moya: /Users/distiller/project/osscheck/Moya/Tests/ErrorTests.swift:4:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Moya: /Users/distiller/project/osscheck/Moya/Tests/MoyaProvider+ReactiveSpec.swift:6:18: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Moya: /Users/distiller/project/osscheck/Moya/Tests/MoyaProvider+RxSpec.swift:6:18: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Moya: /Users/distiller/project/osscheck/Moya/Tests/MoyaProviderIntegrationTests.swift:5:18: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Moya: /Users/distiller/project/osscheck/Moya/Tests/TestHelpers.swift:7:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Nimble: /Users/distiller/project/osscheck/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift:4:12: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Nimble: /Users/distiller/project/osscheck/Nimble/Sources/Nimble/Utils/Async.swift:6:12: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Quick: /Users/distiller/project/osscheck/Quick/Sources/Quick/QuickSpec.swift:9:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Realm: /Users/distiller/project/osscheck/Realm/RealmSwift/Tests/RealmTests.swift:21:22: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Realm: /Users/distiller/project/osscheck/Realm/RealmSwift/Tests/RealmTests.swift:25:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Sourcery: /Users/distiller/project/osscheck/Sourcery/Sourcery/main.swift:183:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Sourcery: /Users/distiller/project/osscheck/Sourcery/SourceryTests/Helpers/CustomMatchers.swift:9:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Swift: /Users/distiller/project/osscheck/Swift/stdlib/private/StdlibUnittest/StdlibCoreExtras.swift:16:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Swift: /Users/distiller/project/osscheck/Swift/stdlib/private/StdlibUnittest/StdlibCoreExtras.swift:22:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Swift: /Users/distiller/project/osscheck/Swift/stdlib/private/StdlibUnittest/RaceTest.swift:43:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Swift: /Users/distiller/project/osscheck/Swift/stdlib/private/SwiftPrivateLibcExtras/SwiftPrivateLibcExtras.swift:15:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Swift: /Users/distiller/project/osscheck/Swift/stdlib/private/SwiftPrivateLibcExtras/Subprocess.swift:15:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Swift: /Users/distiller/project/osscheck/Swift/stdlib/public/SDK/Foundation/Data.swift:21:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Swift: /Users/distiller/project/osscheck/Swift/stdlib/public/SDK/UIKit/UIKit.swift:17:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in Swift: /Users/distiller/project/osscheck/Swift/stdlib/public/SDK/XCTest/XCTest.swift:15:8: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in WordPress: /Users/distiller/project/osscheck/WordPress/WordPress/WordPressTest/Extensions/UITextFieldTextHelperTests.swift:3:18: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in WordPress: /Users/distiller/project/osscheck/WordPress/WordPress/WordPressTest/PostTests.swift:4:18: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)
📖 This PR fixed a violation in WordPress: /Users/distiller/project/osscheck/WordPress/WordPress/WordPressTest/SigninHelperTests.swift:3:18: warning: Sorted Imports Violation: Imports should be sorted. (sorted_imports)

Generated by 🚫 Danger

@jpsim jpsim merged commit 4494dc1 into master Oct 24, 2017
@jpsim jpsim deleted the jp-sorted-imports branch October 24, 2017 04:53
@sammy-SC
Copy link
Contributor

@jpsim thank you for the fixes. I'm going over them.

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.

3 participants