Rely on SPM plugins to consume SwiftLint and SwiftFormat

Use their latest releases and fix some violations and issues.

# Conflicts:
#	.github/workflows/linting.yml
#	.github/workflows/testing.yml
This commit is contained in:
Danny Mösch 2024-11-24 13:14:38 +01:00
parent 358908f161
commit 1bdf9d684b
40 changed files with 126 additions and 186 deletions

View file

@ -8,11 +8,12 @@
import XCTest
// swiftformat:disable:next sortedImports
@testable import passKit
@testable import Gopenpgp
class CryptoFrameworkTest: XCTestCase {
// swiftformat:disable:next sortedImports
@testable import passKit
final class CryptoFrameworkTest: XCTestCase {
private typealias MessageConverter = (CryptoPGPMessage, NSErrorPointer) -> CryptoPGPMessage?
private let testText = "Hello World!"

View file

@ -11,11 +11,11 @@ import XCTest
@testable import passKit
class PGPAgentTest: XCTestCase {
final class PGPAgentTest: XCTestCase {
private var keychain: KeyStore!
private var pgpAgent: PGPAgent!
private let testData = "Hello World!".data(using: .utf8)!
private let testData = Data("Hello World!".utf8)
override func setUp() {
super.setUp()

View file

@ -10,7 +10,7 @@ import XCTest
@testable import passKit
class ArraySlicesTest: XCTestCase {
final class ArraySlicesTest: XCTestCase {
func testZeroCount() {
XCTAssertEqual([1, 2, 3].slices(count: 0), [])
}

View file

@ -10,7 +10,7 @@ import XCTest
@testable import passKit
class StringUtilitiesTest: XCTestCase {
final class StringUtilitiesTest: XCTestCase {
func testTrimmed() {
[
(" ", ""),

View file

@ -10,7 +10,7 @@ import XCTest
@testable import passKit
class KeyFileManagerTest: XCTestCase {
final class KeyFileManagerTest: XCTestCase {
private static let filePath = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("test.txt").path
private static let keyFileManager = KeyFileManager(keyType: PGPKey.PUBLIC, keyPath: filePath) { _, _ in }

View file

@ -12,7 +12,7 @@ import ObjectiveGit
import SwiftyUserDefaults
@testable import passKit
class GitCredentialTest: XCTestCase {
final class GitCredentialTest: XCTestCase {
private static let defaultsID = "SharedDefaultsForGitCredentialTest"
private let keyStore = DictBasedKeychain()

View file

@ -12,7 +12,7 @@ import XCTest
@testable import passKit
class PasswordStoreTest: XCTestCase {
final class PasswordStoreTest: XCTestCase {
private let remoteRepoURL = URL(string: "https://github.com/mssun/passforios-password-store.git")!
func testCloneAndDecryptMultiKeys() throws {

View file

@ -10,7 +10,7 @@ import XCTest
@testable import passKit
class PasswordTableEntryTest: XCTestCase {
final class PasswordTableEntryTest: XCTestCase {
func testExample() {
let nameWithCategoryList = [
"github",

View file

@ -10,7 +10,7 @@ import XCTest
@testable import passKit
class PasswordTest: XCTestCase {
final class PasswordTest: XCTestCase {
func testURL() {
let password = getPasswordObjectWith(content: "")

View file

@ -10,7 +10,7 @@ import XCTest
@testable import passKit
class AdditionFieldTest: XCTestCase {
final class AdditionFieldTest: XCTestCase {
func testAdditionField() {
let field1 = AdditionField(title: "key", content: "value")
let field2 = AdditionField(title: "no content")

View file

@ -10,7 +10,7 @@ import XCTest
@testable import passKit
class ConstantsTest: XCTestCase {
final class ConstantsTest: XCTestCase {
func testIsOtpRelated() {
XCTAssert(Constants.isOtpRelated(line: "otpauth://something"))
XCTAssert(Constants.isOtpRelated(line: "otp_algorithm: algorithm"))

View file

@ -11,9 +11,9 @@ import XCTest
@testable import passKit
class OTPTypeTest: XCTestCase {
final class OTPTypeTest: XCTestCase {
func testInitFromToken() {
let secret = "secret".data(using: .utf8)!
let secret = Data("secret".utf8)
let totpGenerator = Generator(factor: .timer(period: 30.0), secret: secret, algorithm: .sha1, digits: 6)!
let totpToken = Token(name: "", issuer: "", generator: totpGenerator)

View file

@ -9,7 +9,7 @@
import XCTest
@testable import passKit
class ParserTest: XCTestCase {
final class ParserTest: XCTestCase {
func testInit() {
[
("", "", "", []),

View file

@ -12,7 +12,7 @@ import XCTest
@testable import passKit
class TokenBuilderTest: XCTestCase {
final class TokenBuilderTest: XCTestCase {
private let SECRET = "secret"
private let DIGITS = Constants.DEFAULT_DIGITS
private let TIMER = Generator.Factor.timer(period: Constants.DEFAULT_PERIOD)

View file

@ -10,7 +10,7 @@ import XCTest
@testable import passKit
class PasswordGeneratorFlavorTest: XCTestCase {
final class PasswordGeneratorFlavorTest: XCTestCase {
func testLengthLimits() {
// Ensure properly chosen length limits. So this check no longer needs to be performed in the code.
PasswordGeneratorFlavor.allCases.map(\.lengthLimits).forEach {

View file

@ -10,7 +10,7 @@ import XCTest
@testable import passKit
class PasswordGeneratorTest: XCTestCase {
final class PasswordGeneratorTest: XCTestCase {
func testLimitedLength() {
[
PasswordGenerator(length: 15),

View file

@ -11,7 +11,7 @@ import XCTest
@testable import passKit
struct PGPTestSet {
fileprivate static var ALL_TEST_SETS: [String: PGPTestSet] = [:] // swiftlint:disable:this strict_fileprivate
fileprivate static var ALL_TEST_SETS: [String: Self] = [:] // swiftlint:disable:this strict_fileprivate
let publicKey: String
let privateKey: String