chore: clippy clean across the workspace, all targets
Zero warnings from `cargo clippy --workspace --all-targets`, which is now a hard rule rather than "clean except pre-existing": - ChartOfAccounts::add takes the Account it registers instead of eight loose parameters (too_many_arguments); Ledger::add_account builds it. Same validation, same errors. - close_period tool: collapse the nested if-let into a let chain. - iif.rs docs: the IIF layout example shows tabs as `\t` instead of literal tab characters (tabs_in_doc_comments). - Tests: drop an unused binding; assert! instead of assert_eq! against a literal bool. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MtYEaR6M6Ybdhm6X98BWNu
This commit is contained in:
1 parent
03212265ce
commit
42e600bbf2
7 files changed
+29
-48
No files matched your search
@@ -84,40 +84,20 @@ pub struct ChartOfAccounts {
|
|||||||
impl ChartOfAccounts {
|
impl ChartOfAccounts {
|
||||||
/// Register an account. Codes must be unique and non-empty; a parent, if
|
/// Register an account. Codes must be unique and non-empty; a parent, if
|
||||||
/// given, must already exist.
|
/// given, must already exist.
|
||||||
pub fn add(
|
pub fn add(&mut self, account: Account) -> Result<(), LedgerError> {
|
||||||
&mut self,
|
if account.code.is_empty() {
|
||||||
id: AccountId,
|
|
||||||
code: &str,
|
|
||||||
name: &str,
|
|
||||||
account_type: AccountType,
|
|
||||||
parent: Option<AccountId>,
|
|
||||||
placeholder: bool,
|
|
||||||
currency: Currency,
|
|
||||||
) -> Result<(), LedgerError> {
|
|
||||||
if code.is_empty() {
|
|
||||||
return Err(LedgerError::EmptyAccountCode);
|
return Err(LedgerError::EmptyAccountCode);
|
||||||
}
|
}
|
||||||
if self.by_code.contains_key(code) {
|
if self.by_code.contains_key(&account.code) {
|
||||||
return Err(LedgerError::DuplicateAccountCode(code.to_string()));
|
return Err(LedgerError::DuplicateAccountCode(account.code));
|
||||||
}
|
}
|
||||||
if let Some(p) = parent
|
if let Some(p) = account.parent
|
||||||
&& !self.accounts.contains_key(&p)
|
&& !self.accounts.contains_key(&p)
|
||||||
{
|
{
|
||||||
return Err(LedgerError::UnknownParentAccount(p));
|
return Err(LedgerError::UnknownParentAccount(p));
|
||||||
}
|
}
|
||||||
self.by_code.insert(code.to_string(), id);
|
self.by_code.insert(account.code.clone(), account.id);
|
||||||
self.accounts.insert(
|
self.accounts.insert(account.id, account);
|
||||||
id,
|
|
||||||
Account {
|
|
||||||
id,
|
|
||||||
code: code.to_string(),
|
|
||||||
name: name.to_string(),
|
|
||||||
account_type,
|
|
||||||
parent,
|
|
||||||
placeholder,
|
|
||||||
currency,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
//! audit trail and what will make the future oracle harness trustworthy.
|
//! audit trail and what will make the future oracle harness trustworthy.
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
AccountId, AccountType, AgingRow, Asset, AssetId, AssetStatus, Bill, BillId, ChartOfAccounts,
|
Account, AccountId, AccountType, AgingRow, Asset, AssetId, AssetStatus, Bill, BillId,
|
||||||
Class, ClassId, Currency, Customer, CustomerId, DocumentLine, DocumentStatus, EntryId,
|
ChartOfAccounts, Class, ClassId, Currency, Customer, CustomerId, DocumentLine, DocumentStatus,
|
||||||
EntryStatus, Invoice, InvoiceId, JournalEntry, JournalLine, LedgerError, Money, NewAsset,
|
EntryId, EntryStatus, Invoice, InvoiceId, JournalEntry, JournalLine, LedgerError, Money,
|
||||||
Period, PeriodId, PeriodStatus, Side, Vendor, VendorId, arap, assets,
|
NewAsset, Period, PeriodId, PeriodStatus, Side, Vendor, VendorId, arap, assets,
|
||||||
payroll::{
|
payroll::{
|
||||||
PayrollAccounts, PayrollLine, PayrollRun, PayrollRunId, payroll_entry_plan,
|
PayrollAccounts, PayrollLine, PayrollRun, PayrollRunId, payroll_entry_plan,
|
||||||
payroll_remit_plan, validate_payroll_lines,
|
payroll_remit_plan, validate_payroll_lines,
|
||||||
@@ -220,15 +220,15 @@ impl Ledger {
|
|||||||
) -> Result<AccountId, LedgerError> {
|
) -> Result<AccountId, LedgerError> {
|
||||||
let id = self.next_account_id;
|
let id = self.next_account_id;
|
||||||
self.next_account_id += 1;
|
self.next_account_id += 1;
|
||||||
self.chart.add(
|
self.chart.add(Account {
|
||||||
id,
|
id,
|
||||||
code,
|
code: code.to_string(),
|
||||||
name,
|
name: name.to_string(),
|
||||||
account_type,
|
account_type,
|
||||||
parent,
|
parent,
|
||||||
placeholder,
|
placeholder,
|
||||||
self.base_currency,
|
currency: self.base_currency,
|
||||||
)?;
|
})?;
|
||||||
Ok(id)
|
Ok(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -550,7 +550,7 @@ fn cash_flow_with_registered_asset_and_disposal() {
|
|||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let revenue = ledger
|
ledger
|
||||||
.add_account("4000", "Service Revenue", AccountType::Revenue, None, false)
|
.add_account("4000", "Service Revenue", AccountType::Revenue, None, false)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let gain = ledger
|
let gain = ledger
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
//! Generate Intuit Interchange Format (IIF) journal entries for QuickBooks
|
//! Generate Intuit Interchange Format (IIF) journal entries for QuickBooks
|
||||||
//! Desktop, which many CPAs still run.
|
//! Desktop, which many CPAs still run.
|
||||||
//!
|
//!
|
||||||
//! Layout per entry:
|
//! Layout per entry (fields are tab-separated; `\t` marks each tab):
|
||||||
//!
|
//!
|
||||||
//! ```text
|
//! ```text
|
||||||
//! !TRNS TRNSTYPE DATE ACCNT NAME AMOUNT DOCNUM MEMO
|
//! !TRNS\tTRNSTYPE\tDATE\tACCNT\tNAME\tAMOUNT\tDOCNUM\tMEMO
|
||||||
//! !SPL TRNSTYPE DATE ACCNT AMOUNT DOCNUM MEMO
|
//! !SPL\tTRNSTYPE\tDATE\tACCNT\tAMOUNT\tDOCNUM\tMEMO
|
||||||
//! !ENDTRNS
|
//! !ENDTRNS
|
||||||
//! TRNS GENERAL JOURNAL 01/15/2026 Cash 1000.00 1 Memo
|
//! TRNS\tGENERAL JOURNAL\t01/15/2026\tCash\t\t1000.00\t1\tMemo
|
||||||
//! SPL GENERAL JOURNAL 01/15/2026 Revenue -1000.00 1 Memo
|
//! SPL\tGENERAL JOURNAL\t01/15/2026\tRevenue\t-1000.00\t1\tMemo
|
||||||
//! ENDTRNS
|
//! ENDTRNS
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
|
|||||||
@@ -1893,8 +1893,9 @@ impl BooksServer {
|
|||||||
let closing = store.close_period(p.period_id).map_err(|e| e.to_string())?;
|
let closing = store.close_period(p.period_id).map_err(|e| e.to_string())?;
|
||||||
// Build line descriptions from the posted closing entry.
|
// Build line descriptions from the posted closing entry.
|
||||||
let mut lines = Vec::new();
|
let mut lines = Vec::new();
|
||||||
if let Some(eid) = closing {
|
if let Some(eid) = closing
|
||||||
if let Some(entry) = store.ledger().get_entry(eid) {
|
&& let Some(entry) = store.ledger().get_entry(eid)
|
||||||
|
{
|
||||||
for line in entry.lines() {
|
for line in entry.lines() {
|
||||||
let code = store
|
let code = store
|
||||||
.ledger()
|
.ledger()
|
||||||
@@ -1905,7 +1906,6 @@ impl BooksServer {
|
|||||||
lines.push(format!("{:?} {} {}", line.side, code, line.amount.amount));
|
lines.push(format!("{:?} {} {}", line.side, code, line.amount.amount));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Ok(Json(ClosePeriodOut {
|
Ok(Json(ClosePeriodOut {
|
||||||
status: "closed".to_string(),
|
status: "closed".to_string(),
|
||||||
period_id: p.period_id,
|
period_id: p.period_id,
|
||||||
|
|||||||
@@ -688,7 +688,7 @@ fn mcp_resources_over_stdio() {
|
|||||||
);
|
);
|
||||||
assert_eq!(init["result"]["serverInfo"]["name"], "wanderbooks");
|
assert_eq!(init["result"]["serverInfo"]["name"], "wanderbooks");
|
||||||
// Resources are advertised.
|
// Resources are advertised.
|
||||||
assert_eq!(init["result"]["capabilities"]["resources"].is_null(), false);
|
assert!(!init["result"]["capabilities"]["resources"].is_null());
|
||||||
mcp.notify("notifications/initialized");
|
mcp.notify("notifications/initialized");
|
||||||
|
|
||||||
mcp.call(
|
mcp.call(
|
||||||
|
|||||||
+3
-2
@@ -51,8 +51,9 @@ public. Parity is 12 of 12 against the spreadsheet workflow.
|
|||||||
the last caught a real month-length-drift bug, fixed with the final-month
|
the last caught a real month-length-drift bug, fixed with the final-month
|
||||||
true-up); `cargo-mutants` run on `ledger-core` (228 mutants); `cargo-fuzz`
|
true-up); `cargo-mutants` run on `ledger-core` (228 mutants); `cargo-fuzz`
|
||||||
targets (journal-line parsing, entry validation, op sequences) scaffolded.
|
targets (journal-line parsing, entry validation, op sequences) scaffolded.
|
||||||
- 40+ tests green workspace-wide; `cargo fmt` clean; clippy clean except one
|
- 120+ tests green workspace-wide; `cargo fmt` clean; `cargo clippy
|
||||||
pre-existing phase-1 style lint on a public engine signature.
|
--workspace --all-targets` clean, zero warnings (a hard rule: Stephen,
|
||||||
|
2026-10-11).
|
||||||
- Docs: AGENTS.md (operating manual), requirements, architecture, oracle
|
- Docs: AGENTS.md (operating manual), requirements, architecture, oracle
|
||||||
design, parity catalog (floor: 10 done), glossary, mcp-interface (incl. the
|
design, parity catalog (floor: 10 done), glossary, mcp-interface (incl. the
|
||||||
5 asset tools), receipt-store (journal design), capability-parity
|
5 asset tools), receipt-store (journal design), capability-parity
|
||||||
|
|||||||
Reference in new issue
Block a user