Skip to content

Commit

Permalink
Update swiftlint to 0.57.0 (#49)
Browse files Browse the repository at this point in the history
synced local file(s) with
[Nef10/common-swift-package](https://github.com/Nef10/common-swift-package).

---

This PR was created automatically by the
[repo-file-sync-action](https://github.com/BetaHuhn/repo-file-sync-action)
workflow run
[#12707840251](https://github.com/Nef10/common-swift-package/actions/runs/12707840251)

---------

Co-authored-by: file-sync-app[bot] <89714990+file-sync-app[bot]@users.noreply.github.com>
Co-authored-by: Steffen Kötte <steffen.koette@gmail.com>
  • Loading branch information
file-sync-app[bot] and Nef10 authored Jan 11, 2025
1 parent 7e56c80 commit 534d17d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
uses: swift-actions/setup-swift@v2.1.0
- name: Install SwiftLint
run: |
curl -L https://github.com/realm/SwiftLint/releases/download/0.54.0/swiftlint_linux.zip -o swiftlint.zip
curl -L https://github.com/realm/SwiftLint/releases/download/0.57.0/swiftlint_linux.zip -o swiftlint.zip
unzip swiftlint.zip -d swiftlint
./swiftlint/swiftlint --version
- name: Run SwiftLint
Expand Down
8 changes: 4 additions & 4 deletions Sources/SwiftBeanCountTax/TaxCalculator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ public enum TaxCalculator {
return try issuers.compactMap { issuer throws -> TaxSlip? in
let issuerTaxSlipRelevantAccounts = taxSlipRelevantAccounts.filter { $0.metaData[MetaDataKeys.issuer] ?? "" == issuer }
// collect all transactions which have a posting to a split account AND an account for this issuer
var splitTransactions = taxYearTransactions.filter { $0.postings.contains { issuerTaxSlipRelevantAccounts.map { $0.name }.contains($0.accountName) }
&& $0.postings.contains { splitAccounts.map { $0.0 }.contains($0.accountName.fullName) }
var splitTransactions = taxYearTransactions.filter { $0.postings.contains { issuerTaxSlipRelevantAccounts.map(\.name).contains($0.accountName) }
&& $0.postings.contains { splitAccounts.map(\.0).contains($0.accountName.fullName) }
}
let entries = issuerTaxSlipRelevantAccounts.flatMap { account -> [TaxSlipEntry] in
let postings = taxYearTransactions.flatMap { $0.postings.filter { $0.accountName == account.name } }
Expand All @@ -146,10 +146,10 @@ public enum TaxCalculator {
// split accounts
entries.append(contentsOf: splitAccounts.compactMap { splitAccount -> TaxSlipEntry? in
// filter splitTransactions for transactions for the current account, and get the posting to the split account
let splitPostings = splitTransactions.filter { [account.name.fullName, splitAccount.0].allSatisfy($0.postings.map { $0.accountName.fullName }.contains) }
let splitPostings = splitTransactions.filter { [account.name.fullName, splitAccount.0].allSatisfy($0.postings.map(\.accountName.fullName).contains) }
.flatMap { $0.postings.filter { $0.accountName.fullName == splitAccount.0 } }
// rmove the processed transactions - otherwise when a transaction has multiple accounts and a split account, it would be counted multiple times
splitTransactions.removeAll { [account.name.fullName, splitAccount.0].allSatisfy($0.postings.map { $0.accountName.fullName }.contains) }
splitTransactions.removeAll { [account.name.fullName, splitAccount.0].allSatisfy($0.postings.map(\.accountName.fullName).contains) }
if let (value, originalValue) = getValues(commodity: commodity, postings: splitPostings) {
return TaxSlipEntry(symbol: symbol, name: name, box: splitAccount.1, value: value, originalValue: originalValue)
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/SwiftBeanCountTax/TaxSlip.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public struct TaxSlip: Identifiable {

/// Boxes which have a value on the slip
public var boxes: [String] {
Array(Set(entries.map { $0.box })).sorted(by: boxNumberSort)
Array(Set(entries.map(\.box))).sorted(by: boxNumberSort)
}

/// If a slip is split by symbols (e.g. stocks), this contains the list of symbols, otherwise is is empty
Expand Down Expand Up @@ -166,7 +166,7 @@ extension TaxSlipRow: CustomStringConvertible {
}

public var description: String {
"\(displayName != nil ? "\(displayName!):\n" : "")\(values.sorted(by: rowValueBoxNumberSort).map { $0.description }.joined(separator: "\n") )"
"\(displayName != nil ? "\(displayName!):\n" : "")\(values.sorted(by: rowValueBoxNumberSort).map(\.description).joined(separator: "\n") )"
}
}

Expand All @@ -193,7 +193,7 @@ extension TaxSlip: CustomStringConvertible {
}

public var description: String {
"\(header)\n\(rows.map { $0.description }.joined(separator: "\n"))\(symbols.isEmpty ? "" : "\nSum:\n\(sumRow.description)")"
"\(header)\n\(rows.map(\.description).joined(separator: "\n"))\(symbols.isEmpty ? "" : "\nSum:\n\(sumRow.description)")"
}
}

Expand Down

0 comments on commit 534d17d

Please sign in to comment.