Skip to content

Commit

Permalink
Pin SwiftLint to 0.53.0 (#522)
Browse files Browse the repository at this point in the history
Required:

Task/Issue URL: https://app.asana.com/0/0/1205634434068015/f
iOS PR: N/A
macOS PR: N/A
What kind of version bump will this require?: None, this is a workflow file change only

Description:

This PR pins SwiftLint to 0.53.0.

It also fixes some lint errors that crept back into the codebase.
  • Loading branch information
samsymons authored Oct 3, 2023
1 parent efcfbd7 commit ea0682a
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 34 deletions.
15 changes: 7 additions & 8 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@ on:
push:
branches: [ main ]
pull_request:

jobs:
swiftlint:

name: Run SwiftLint

runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v3
- name: Run SwiftLint on all files
uses: norio-nomura/[email protected]
with:
args: --force-exclude
- uses: actions/checkout@v3
- name: SwiftLint
uses: docker://norionomura/swiftlint:0.53.0
with:
args: swiftlint --reporter github-actions-logging --strict

unit-tests:

Expand Down
8 changes: 7 additions & 1 deletion Sources/Bookmarks/BookmarkListViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ public class BookmarkListViewModel: BookmarkListInteracting, ObservableObject {
}
}

public func createBookmark(title: String, url: String, folder: BookmarkEntity, folderIndex: Int, favoritesFolder: BookmarkEntity?, favoritesIndex: Int?) {
// swiftlint:disable:next function_parameter_count
public func createBookmark(title: String,
url: String,
folder: BookmarkEntity,
folderIndex: Int,
favoritesFolder: BookmarkEntity?,
favoritesIndex: Int?) {
let bookmark = BookmarkEntity.makeBookmark(title: title, url: url, parent: folder, context: context)
if let addedIndex = folder.childrenArray.firstIndex(of: bookmark) {
moveBookmark(bookmark, fromIndex: addedIndex, toIndex: folderIndex)
Expand Down
1 change: 1 addition & 0 deletions Sources/Bookmarks/BookmarksModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public protocol BookmarkListInteracting: BookmarkStoring {

func countBookmarksForDomain(_ domain: String) -> Int

// swiftlint:disable:next function_parameter_count
func createBookmark(title: String, url: String, folder: BookmarkEntity, folderIndex: Int, favoritesFolder: BookmarkEntity?, favoritesIndex: Int?)

}
Expand Down
14 changes: 7 additions & 7 deletions Sources/BrowserServicesKit/Suggestions/Suggestion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ public enum Suggestion: Equatable {
}

var title: String? {
switch self {
case .historyEntry(title: let title, url: _, allowedInTopHits: _):
return title
case .bookmark(title: let title, url: _, isFavorite: _, allowedInTopHits: _):
return title
case .phrase, .website, .unknown:
return nil
switch self {
case .historyEntry(title: let title, url: _, allowedInTopHits: _):
return title
case .bookmark(title: let title, url: _, isFavorite: _, allowedInTopHits: _):
return title
case .phrase, .website, .unknown:
return nil
}
}

Expand Down
1 change: 1 addition & 0 deletions Sources/DDGSync/DDGSync.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ public class DDGSync: DDGSyncing {
}
}

// swiftlint:disable:next function_body_length
private func updateAccount(_ account: SyncAccount? = nil) throws {
guard account?.state != .initializing else {
assertionFailure("Sync has not been initialized properly")
Expand Down
2 changes: 2 additions & 0 deletions Sources/Navigation/DistributedNavigationDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ private extension DistributedNavigationDelegate {
static var sigIntRaisedForResponders = Set<String>()
#endif

// swiftlint:disable function_parameter_count
/// continues until first non-nil Navigation Responder decision and returned to the `completion` callback
func makeAsyncDecision<T>(for actionDebugInfo: some CustomDebugStringConvertible,
boundToLifetimeOf webView: WKWebView,
Expand Down Expand Up @@ -171,6 +172,7 @@ private extension DistributedNavigationDelegate {

return task
}
// swiftlint:enable function_parameter_count

func makeAsyncDecision<T>(for actionDebugInfo: some CustomDebugStringConvertible,
boundToLifetimeOf webView: WKWebView,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public enum ExtensionMessage: RawRepresentable {
case simulateTunnelMemoryOveruse
case simulateConnectionInterruption

// swiftlint:disable:next cyclomatic_complexity
// swiftlint:disable:next cyclomatic_complexity function_body_length
public init?(rawValue data: Data) {
let name = data.first.flatMap(Name.init(rawValue:))
switch name {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ final class NetworkProtectionKeychainStore {
private let keychainType: KeychainType

init(label: String,
serviceName: String,
keychainType: KeychainType) {

serviceName: String,
keychainType: KeychainType) {
self.label = label
self.serviceName = serviceName
self.keychainType = keychainType
Expand Down
6 changes: 2 additions & 4 deletions Sources/SyncDataProviders/Settings/SettingsProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,11 @@ public struct SettingsSyncMetadataSaveError: Error {
}
}

// swiftlint:disable:next type_body_length
public final class SettingsProvider: DataProvider, SettingsSyncHandlingDelegate {

public struct Setting: Hashable {
let key: String

init(key: String) {
self.key = key
}
}

public convenience init(
Expand Down Expand Up @@ -188,6 +185,7 @@ public final class SettingsProvider: DataProvider, SettingsSyncHandlingDelegate

// MARK: - Internal

// swiftlint:disable:next function_body_length function_parameter_count
func handleSyncResponse(
isInitial: Bool,
sent: [Syncable],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ class ContentBlockerReferenceTests: XCTestCase {
var tds: TrackerData!
var tests = [RefTests.Test]()

override func setUp() {
super.setUp()
}

func setupWebViewForUserScripTests(trackerData: TrackerData,
userScriptDelegate: ContentBlockerRulesUserScriptDelegate,
schemeHandler: TestSchemeHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ class TrackerAllowlistReferenceTests: XCTestCase {
var tests = [AllowlistTests.Test]()
var mockWebsite: MockWebsite!

override func setUp() {
super.setUp()
}

func setupWebView(trackerData: TrackerData,
userScriptDelegate: ContentBlockerRulesUserScriptDelegate,
trackerAllowlist: PrivacyConfigurationData.TrackerAllowlistData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,5 +454,4 @@ class SecureVaultModelTests: XCTestCase {

}


}
2 changes: 1 addition & 1 deletion Tests/DDGSyncTests/DDGSyncLifecycleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ final class DDGSyncLifecycleTests: XCTestCase {
XCTAssertEqual(syncService.authState, .inactive)

// Shall we be removing the account? Keeping it tho, allows us to recover sync In case we somehow get back access to the keychain entry.
//XCTAssertNil(mockKeyValueStore.isSyncEnabled)
// XCTAssertNil(mockKeyValueStore.isSyncEnabled)

XCTAssertNil(secureStorageStub.theAccount)
XCTAssertEqual(mockErrorHandler.handledErrors, [])
Expand Down

0 comments on commit ea0682a

Please sign in to comment.