From e6287ac435345a15062993ee164ed55b75c07ddb Mon Sep 17 00:00:00 2001 From: Josh Heald Date: Thu, 26 May 2022 16:32:04 +0100 Subject: [PATCH 1/4] Upgrade Swiftlint to 0.47.1 --- .hound.yml | 1 + .swiftlint.yml | 2 +- Rakefile | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.hound.yml b/.hound.yml index 41723af49c2..3d2e4ca7a53 100644 --- a/.hound.yml +++ b/.hound.yml @@ -1,5 +1,6 @@ swiftlint: config_file: .swiftlint.yml + version: 0.47.1 ruby: enabled: false diff --git a/.swiftlint.yml b/.swiftlint.yml index d5deb9421b9..5d56db4ed07 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -6,7 +6,7 @@ included: - Yosemite # Rules -whitelist_rules: +only_rules: # Closing brace with closing parenthesis should not have any whitespaces in # the middle. # - closing_brace diff --git a/Rakefile b/Rakefile index 92e98b68bb2..768d4107db8 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,6 @@ # frozen_string_literal: true -SWIFTLINT_VERSION = '0.27.0' +SWIFTLINT_VERSION = '0.47.1' XCODE_WORKSPACE = 'WooCommerce.xcworkspace' XCODE_SCHEME = 'WooCommerce' XCODE_CONFIGURATION = 'Debug' From 66ce1089770219b22a8bd738e756331c91e132f9 Mon Sep 17 00:00:00 2001 From: Josh Heald Date: Thu, 26 May 2022 16:50:31 +0100 Subject: [PATCH 2/4] Use Swiftlint 0.41.0 0.47.1 is not yet marked as supported by hound. 0.43.1 is the latest supported version, however, it will not cleanly install. 0.41.0 is the most recent version which will cleanly install. --- .hound.yml | 2 +- Rakefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.hound.yml b/.hound.yml index 3d2e4ca7a53..c57c795bb32 100644 --- a/.hound.yml +++ b/.hound.yml @@ -1,6 +1,6 @@ swiftlint: config_file: .swiftlint.yml - version: 0.47.1 + version: 0.41.0 ruby: enabled: false diff --git a/Rakefile b/Rakefile index 768d4107db8..0c66ce88ba7 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,6 @@ # frozen_string_literal: true -SWIFTLINT_VERSION = '0.47.1' +SWIFTLINT_VERSION = '0.41.0' XCODE_WORKSPACE = 'WooCommerce.xcworkspace' XCODE_SCHEME = 'WooCommerce' XCODE_CONFIGURATION = 'Debug' From 1fffa69d065e2c76ab7e00a54e1fb8710a3f7e58 Mon Sep 17 00:00:00 2001 From: Josh Heald Date: Thu, 26 May 2022 16:53:51 +0100 Subject: [PATCH 3/4] Fix `MARK: -` linting errors --- Networking/Networking/Network/AlamofireNetwork.swift | 4 ++-- .../CoreData/ManagedObjectModelsInventory.swift | 2 +- .../Cells/BillingAddressTableViewCell.swift | 6 +++--- .../Customer Section/CustomerInfoTableViewCell.swift | 2 +- .../Customer Section/CustomerNoteTableViewCell.swift | 2 +- .../Order Summary Section/SummaryTableViewCell.swift | 6 +++--- .../Product Details/PickListTableViewCell.swift | 8 ++++---- .../OrderTrackingTableViewCell.swift | 10 +++++----- .../Mocks/MockSwitchStoreUseCase.swift | 2 +- Yosemite/Yosemite/Stores/AvailabilityStore.swift | 4 ++-- Yosemite/Yosemite/Stores/CardPresentPaymentStore.swift | 4 ++-- Yosemite/Yosemite/Stores/SitePostStore.swift | 4 ++-- .../Tools/Stats/LeaderboardStatsConverter.swift | 2 +- .../Tools/Stats/LeaderboardStatsConverterTests.swift | 4 ++-- 14 files changed, 30 insertions(+), 30 deletions(-) diff --git a/Networking/Networking/Network/AlamofireNetwork.swift b/Networking/Networking/Network/AlamofireNetwork.swift index ce738f976ad..5dd8e7b7a9d 100644 --- a/Networking/Networking/Network/AlamofireNetwork.swift +++ b/Networking/Networking/Network/AlamofireNetwork.swift @@ -107,8 +107,8 @@ public class AlamofireNetwork: Network { } -/// MARK: - Alamofire.DataResponse: Private Methods -/// +// MARK: - Alamofire.DataResponse: Private Methods +// private extension Alamofire.DataResponse { /// Returns the Networking Layer Error (if any): diff --git a/Storage/Storage/CoreData/ManagedObjectModelsInventory.swift b/Storage/Storage/CoreData/ManagedObjectModelsInventory.swift index e8ab8bbd923..2698127c553 100644 --- a/Storage/Storage/CoreData/ManagedObjectModelsInventory.swift +++ b/Storage/Storage/CoreData/ManagedObjectModelsInventory.swift @@ -164,7 +164,7 @@ private extension ManagedObjectModelsInventory { } } -/// MARK: - Sorting +// MARK: - Sorting private extension Array where Element == ManagedObjectModelsInventory.ModelVersion { /// Sort the `ModelVersion` based on the convention that model versions are incremented diff --git a/WooCommerce/Classes/ViewRelated/Orders/Order Details/Customer Section/Billing Information/Cells/BillingAddressTableViewCell.swift b/WooCommerce/Classes/ViewRelated/Orders/Order Details/Customer Section/Billing Information/Cells/BillingAddressTableViewCell.swift index 13fe711ff36..3492ebb0494 100644 --- a/WooCommerce/Classes/ViewRelated/Orders/Order Details/Customer Section/Billing Information/Cells/BillingAddressTableViewCell.swift +++ b/WooCommerce/Classes/ViewRelated/Orders/Order Details/Customer Section/Billing Information/Cells/BillingAddressTableViewCell.swift @@ -68,8 +68,8 @@ final class BillingAddressTableViewCell: UITableViewCell { } } -/// MARK: - Private Methods -/// +// MARK: - Private Methods +// private extension BillingAddressTableViewCell { func configureBackground() { @@ -96,7 +96,7 @@ private extension BillingAddressTableViewCell { } } -/// MARK: - Testability +// MARK: - Testability extension BillingAddressTableViewCell { func getNameLabel() -> UILabel { diff --git a/WooCommerce/Classes/ViewRelated/Orders/Order Details/Customer Section/CustomerInfoTableViewCell.swift b/WooCommerce/Classes/ViewRelated/Orders/Order Details/Customer Section/CustomerInfoTableViewCell.swift index 73a78a7f556..3674c77ace7 100644 --- a/WooCommerce/Classes/ViewRelated/Orders/Order Details/Customer Section/CustomerInfoTableViewCell.swift +++ b/WooCommerce/Classes/ViewRelated/Orders/Order Details/Customer Section/CustomerInfoTableViewCell.swift @@ -139,7 +139,7 @@ private extension CustomerInfoTableViewCell { } } -/// MARK: - Testability +// MARK: - Testability extension CustomerInfoTableViewCell { func getTitleLabel() -> UILabel { return titleLabel diff --git a/WooCommerce/Classes/ViewRelated/Orders/Order Details/Customer Section/CustomerNoteTableViewCell.swift b/WooCommerce/Classes/ViewRelated/Orders/Order Details/Customer Section/CustomerNoteTableViewCell.swift index 02b76f94f52..284e295aecf 100644 --- a/WooCommerce/Classes/ViewRelated/Orders/Order Details/Customer Section/CustomerNoteTableViewCell.swift +++ b/WooCommerce/Classes/ViewRelated/Orders/Order Details/Customer Section/CustomerNoteTableViewCell.swift @@ -142,7 +142,7 @@ private extension CustomerNoteTableViewCell { } -/// MARK: - Testability +// MARK: - Testability extension CustomerNoteTableViewCell { func getHeadlineLabel() -> UILabel { return headlineLabel diff --git a/WooCommerce/Classes/ViewRelated/Orders/Order Details/Order Summary Section/SummaryTableViewCell.swift b/WooCommerce/Classes/ViewRelated/Orders/Order Details/Order Summary Section/SummaryTableViewCell.swift index 5766ad315d3..efd9de5bd11 100644 --- a/WooCommerce/Classes/ViewRelated/Orders/Order Details/Order Summary Section/SummaryTableViewCell.swift +++ b/WooCommerce/Classes/ViewRelated/Orders/Order Details/Order Summary Section/SummaryTableViewCell.swift @@ -175,8 +175,8 @@ private extension SummaryTableViewCell { } -/// MARK: - VoiceOver -/// +// MARK: - VoiceOver +// private extension SummaryTableViewCell { func configureIconForVoiceOver() { updateStatusButton.accessibilityLabel = NSLocalizedString("Update Order Status", @@ -187,7 +187,7 @@ private extension SummaryTableViewCell { } } -/// MARK: - Localization +// MARK: - Localization private extension SummaryTableViewCellViewModel { enum Localization { diff --git a/WooCommerce/Classes/ViewRelated/Orders/Order Details/Product List Section/Product Details/PickListTableViewCell.swift b/WooCommerce/Classes/ViewRelated/Orders/Order Details/Product List Section/Product Details/PickListTableViewCell.swift index 254b003cfaa..7026b468256 100644 --- a/WooCommerce/Classes/ViewRelated/Orders/Order Details/Product List Section/Product Details/PickListTableViewCell.swift +++ b/WooCommerce/Classes/ViewRelated/Orders/Order Details/Product List Section/Product Details/PickListTableViewCell.swift @@ -99,8 +99,8 @@ final class PickListTableViewCell: UITableViewCell { } -/// MARK: - Public Methods -/// +// MARK: - Public Methods +// extension PickListTableViewCell { /// Configure a pick list cell /// @@ -123,8 +123,8 @@ extension PickListTableViewCell { } } -/// MARK: - Private Methods -/// +// MARK: - Private Methods +// private extension PickListTableViewCell { func configureBackground() { diff --git a/WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipment Tracking Section/OrderTrackingTableViewCell.swift b/WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipment Tracking Section/OrderTrackingTableViewCell.swift index c6d1eb7d87b..3d97ed1fe55 100644 --- a/WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipment Tracking Section/OrderTrackingTableViewCell.swift +++ b/WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipment Tracking Section/OrderTrackingTableViewCell.swift @@ -83,7 +83,7 @@ final class OrderTrackingTableViewCell: UITableViewCell { } -/// MARK: - Actions +// MARK: - Actions private extension OrderTrackingTableViewCell { @objc func iconTapped() { onEllipsisTouchUp?() @@ -91,8 +91,8 @@ private extension OrderTrackingTableViewCell { } -/// MARK: - Accessibility -/// +// MARK: - Accessibility +// private extension OrderTrackingTableViewCell { func configureTopLineForVoiceOver() { topLine.accessibilityLabel = String.localizedStringWithFormat( @@ -126,8 +126,8 @@ private extension OrderTrackingTableViewCell { } } -/// MARK: - Expose private outlets for tests -/// +// MARK: - Expose private outlets for tests +// extension OrderTrackingTableViewCell { func getTopLabel() -> UILabel { return topLine diff --git a/WooCommerce/WooCommerceTests/Mocks/MockSwitchStoreUseCase.swift b/WooCommerce/WooCommerceTests/Mocks/MockSwitchStoreUseCase.swift index cc386458a99..f0e2530bded 100644 --- a/WooCommerce/WooCommerceTests/Mocks/MockSwitchStoreUseCase.swift +++ b/WooCommerce/WooCommerceTests/Mocks/MockSwitchStoreUseCase.swift @@ -13,7 +13,7 @@ final class MockSwitchStoreUseCase: SwitchStoreUseCaseProtocol { private(set) var destinationStoreIDs = [Int64]() } -/// MARK: - SwitchStoreUseCaseProtocol +// MARK: - SwitchStoreUseCaseProtocol extension MockSwitchStoreUseCase { func switchStore(with storeID: Int64, onCompletion: @escaping (Bool) -> Void) { diff --git a/Yosemite/Yosemite/Stores/AvailabilityStore.swift b/Yosemite/Yosemite/Stores/AvailabilityStore.swift index 5e3850ccde3..bf41934b835 100644 --- a/Yosemite/Yosemite/Stores/AvailabilityStore.swift +++ b/Yosemite/Yosemite/Stores/AvailabilityStore.swift @@ -1,8 +1,8 @@ import Networking import Storage -/// MARK: AvailabilityStore -/// +// MARK: AvailabilityStore +// final public class AvailabilityStore: Store { private let orderStatsRemote: OrderStatsRemoteV4 diff --git a/Yosemite/Yosemite/Stores/CardPresentPaymentStore.swift b/Yosemite/Yosemite/Stores/CardPresentPaymentStore.swift index 67e0a28d755..ed3297fda81 100644 --- a/Yosemite/Yosemite/Stores/CardPresentPaymentStore.swift +++ b/Yosemite/Yosemite/Stores/CardPresentPaymentStore.swift @@ -5,8 +5,8 @@ import Combine -/// MARK: CardPresentPaymentStore -/// +// MARK: CardPresentPaymentStore +// public final class CardPresentPaymentStore: Store { // Retaining the reference to the card reader service might end up being problematic. // At this point though, the ServiceLocator is part of the WooCommerce binary, so this is a good starting point. diff --git a/Yosemite/Yosemite/Stores/SitePostStore.swift b/Yosemite/Yosemite/Stores/SitePostStore.swift index 06e8a5379d2..69e7e09f048 100644 --- a/Yosemite/Yosemite/Stores/SitePostStore.swift +++ b/Yosemite/Yosemite/Stores/SitePostStore.swift @@ -1,8 +1,8 @@ import Networking import Storage -/// MARK: SitePostStore -/// +// MARK: SitePostStore +// final public class SitePostStore: Store { private let remote: SitePostsRemote diff --git a/Yosemite/Yosemite/Tools/Stats/LeaderboardStatsConverter.swift b/Yosemite/Yosemite/Tools/Stats/LeaderboardStatsConverter.swift index f1c0eb37338..77a0e4de722 100644 --- a/Yosemite/Yosemite/Tools/Stats/LeaderboardStatsConverter.swift +++ b/Yosemite/Yosemite/Tools/Stats/LeaderboardStatsConverter.swift @@ -38,7 +38,7 @@ struct LeaderboardStatsConverter { } } -/// MARK: Private helpers +// MARK: Private helpers private extension LeaderboardStatsConverter { /// Infers a product-id from an specific html string type diff --git a/Yosemite/YosemiteTests/Tools/Stats/LeaderboardStatsConverterTests.swift b/Yosemite/YosemiteTests/Tools/Stats/LeaderboardStatsConverterTests.swift index 47680c191a8..2c2ee82acba 100644 --- a/Yosemite/YosemiteTests/Tools/Stats/LeaderboardStatsConverterTests.swift +++ b/Yosemite/YosemiteTests/Tools/Stats/LeaderboardStatsConverterTests.swift @@ -78,8 +78,8 @@ final class LeaderboardStatsConverterTest: XCTestCase { } } -/// MARK: Test functions to generate sample data -/// +// MARK: Test functions to generate sample data +// private extension LeaderboardStatsConverterTest { func sampleLeaderboard(productIDs: [Int64]) -> Leaderboard { From b6cdc556ab318ebbc1084cc66b34951ed7325d25 Mon Sep 17 00:00:00 2001 From: Josh Heald Date: Thu, 26 May 2022 17:06:48 +0100 Subject: [PATCH 4/4] Try with the listed latest supported swiftlint --- .hound.yml | 2 +- Rakefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.hound.yml b/.hound.yml index c57c795bb32..0ce5eac5a79 100644 --- a/.hound.yml +++ b/.hound.yml @@ -1,6 +1,6 @@ swiftlint: config_file: .swiftlint.yml - version: 0.41.0 + version: 0.43.1 ruby: enabled: false diff --git a/Rakefile b/Rakefile index 0c66ce88ba7..7c814bed3a9 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,6 @@ # frozen_string_literal: true -SWIFTLINT_VERSION = '0.41.0' +SWIFTLINT_VERSION = '0.43.1' XCODE_WORKSPACE = 'WooCommerce.xcworkspace' XCODE_SCHEME = 'WooCommerce' XCODE_CONFIGURATION = 'Debug'