Commit Graph

1163 Commits

Author SHA1 Message Date
Simon Michael
da11d74ae6 dev: refactor: clarify journalAccountTypes 2024-10-20 09:13:58 -10:00
Simon Michael
e44cbbf1a4 dev: refactor, clarify detection of cost/conversion postings 2024-10-20 09:13:58 -10:00
Simon Michael
2d90550e25 dev: cleanups 2024-10-20 09:13:58 -10:00
Simon Michael
b940254025 imp:cli: detect --color more safely in most cases
--color now also works in a config file, like --pager, except for two
cases: it does not affect colouring of debug output, or the colouring
helpers used in the check recentassertions error message.
2024-10-19 16:28:36 -10:00
Simon Michael
711d921774 imp:cli: --no-pager -> --pager, make this and --color safe options 2024-10-19 16:28:36 -10:00
Simon Michael
0f7aaa9600 imp: check accounts: simplify confusing suggestion in error message, 2 2024-10-16 21:19:51 -10:00
Simon Michael
36d1093b84 imp: check accounts: simplify confusing suggestion in error message 2024-10-15 16:36:54 -10:00
Simon Michael
71a7879213 fix:check tags: _price-matched -> _cost-matched, and whitelisted [#2247] 2024-10-14 14:49:18 -10:00
Simon Michael
6dd9c92d32 lib: add Hledger.Data.Currency, currencySymbolToCode, currencyCodeToSymbol 2024-10-11 14:56:03 -10:00
Simon Michael
66fce53c0b dev: extract beancount output helpers to Hledger.Write.Beancount 2024-10-10 23:25:07 -10:00
Simon Michael
21a84fb336 fix: calculate value correctly when P amounts have few decimal digits [#2254]
Valuation in another commoditay could sometimes be inaccurate if the P
price amounts did not have enough decimal places.
2024-10-08 23:11:57 -10:00
Simon Michael
4e6f6611a6 dev: fix DisplayName's off-by-one indent value, noted in #2246
Now displayIndent (and prrIndent) 0 means no indent, 1 means one
indent step, etc.
2024-10-08 23:11:57 -10:00
Simon Michael
8c71d071d7 imp:print:beancount:convert account names more robustly; better errors 2024-10-03 23:19:32 -10:00
Simon Michael
c92b601028 dev: fix warnings with ghc 9.10 / base 4.20
Older ghc versions should also still build cleanly (tested with 9.8 so far).

I don't like enabling CPP in so many modules but it's easier that
figuring out how to do it with base-compat; hopefully no noticeable
compilation impact.
2024-09-30 17:20:13 -10:00
Michael Rees
e34fa491af Add abs implementation for MixedAmount 2024-09-05 11:56:07 +01:00
Simon Michael
3fbad1892d dev: rename some Intervals for clarity [#2218] 2024-09-04 16:07:54 +01:00
Simon Michael
038ebd8c7a fix: three more interval start date cases; add tests; cleanup [#2218] 2024-09-04 16:07:54 +01:00
Simon Michael
c8b6ca7b70 fix: 'every Nth day of month from DATE' start date [#2218] 2024-09-04 16:07:54 +01:00
Henning Thielemann
da61b64f94 cli: Command.Balance: support FODS export for multibalance
Data.Amount.showMixedAmountLinesPartsB: new helper function
2024-08-16 16:57:38 +02:00
Simon Michael
4b3abfd470 ;imp: check: recentassertions: improve message readability 2024-07-16 22:12:41 +01:00
Simon Michael
f5c2ec681c dev: refactor: merge Text.Megaparsec.Custom into Hledger.Utils.Parse 2024-06-25 18:37:54 +01:00
Simon Michael
6c47fa034a ;dev: update doctests for weekly headings change [#2204] 2024-06-25 18:36:43 +01:00
Victor Mihalache
60efd035f5 imp: abbreviate week naming for weekly reports 2024-06-14 09:37:32 +01:00
Simon Michael
5b83e5c2f0 ;dev: cleanup [#2202] 2024-06-10 08:46:19 +01:00
Simon Michael
e89bea8563 fix: handle account type declarations in multiple files correctly [#2202]
Tags and types declared in account directives in sibling files or
included files are now combined more carefully.

In particular, when merging two Journals into one,

- jdeclaredaccounttags and jdeclaredaccounttypes no longer lose information;
  any duplicated/conflicting tag/type values are preserved.

- jaccounttypes now prefers the last type declared in case of
  conflict, not the first.
2024-06-10 08:32:54 +01:00
Simon Michael
8d1ad8a3fe lib: add journalDbg, for inspecting Journal fields 2024-06-10 08:26:58 +01:00
Simon Michael
0ccfc78844 ;dev: cleanup 2024-06-07 06:32:52 -07:00
Simon Michael
ea58a7ccd7 imp: check: check ordereddates before balance assertions, when both are enabled 2024-05-02 21:11:04 -10:00
Simon Michael
6796decb72 fix: show trailing decimal mark on cost amounts too, when needed 2024-05-01 14:17:46 -10:00
Simon Michael
55401282a0 imp: run checks in a well-defined order; and tweak that order
Now commodities are checked before accounts, and tags before recentassertions.
Also some check doc cleanups.
2024-04-26 18:59:45 -10:00
Simon Michael
4cbf72ab1f imp!: check ordereddates: drop --date2 support; check primary dates only
date2 is a deprecated feature and was getting in the way, so has been dropped
from the ordereddates check, simplifying it.
2024-04-26 18:59:45 -10:00
Simon Michael
afe9e2c6f4 dev: move journalCheckBalanceAssertions to JournalChecks 2024-04-26 18:59:45 -10:00
Simon Michael
3ca208a3b6 fix:queries: fix OR-ing open-ended dates, spanUnion; add spanExtend [#2177] 2024-03-01 18:10:24 -10:00
Simon Michael
1ee0e80719 imp:errors:unbalanced transaction: show more precise amounts (#2135)
Like we used to in 1.30, but better (show all available decimal digits,
unless they're infinite in which case show 8, show trailing zeros,
show commodity symbol with zero).
2024-02-29 12:34:17 -10:00
Simon Michael
3ec432bd53 dev: rename/improve amountSetFullPrecisionUpTo, add mixedAmountSetFullPrecisionUpTo 2024-02-29 12:31:07 -10:00
Simon Michael
8f1ae401f4 dev: fix some partial head/tails, silence ghc 9.8's new warnings
Note the headErr/tailErr calls will print stack traces if they fail
(small ones: five lines, one of which is the useful location info),
which may or may not be best UX.
2024-02-28 15:58:21 -10:00
Simon Michael
a4c2776a18 feat:close: support --round, like print 2024-02-25 17:37:59 -10:00
Simon Michael
d3ad743b36 imp: print, close: disambiguate balance assertion/assignment amount also (#2176)
Add a trailing decimal mark when necessary to disambiguate a single
digit group mark in the balance assertion/assignment amount, also.
2024-02-25 16:47:58 -10:00
Simon Michael
baca5f8b54 fix:check:tags: add date and date2 to the implicitly-declared special tags
And add tests/comments.
2024-02-17 13:06:10 -10:00
Michael Rees
d4ecdb3fea imp: Support tsv and ssv prefixes (#2164) 2024-02-08 06:44:44 -10:00
Simon Michael
12e67e4859 dev: postingAddInferredEquityPostings: cleanup 2024-01-26 15:04:44 -10:00
Simon Michael
21adfe2c25 fix: really fix slowdown with many accounts [#2153]
The previous #2153 fix used accountNameTreeFrom, but it turns out this
has always had O(n^2) performance, so our tests with 10k accounts ran
even slower than before. Now it's faster, the main #2153 slowdown
should really be fixed, and other commands which build an account tree
should also be free of this slowdown when there are very many accounts.
2024-01-26 13:53:47 -10:00
Simon Michael
a38af98c9e fix: a slowdown with many txns and many accounts since 1.29 [#2153]
When processing costs and equity postings in transactions during
journal finalisation, we now pass just the conversion account name(s)
rather than the entire map of account types. This slowdown was severe
for some users/data/machines.
2024-01-25 13:49:49 -10:00
Simon Michael
508ccfc7d2 imp: balance assertions error: show costs detail with --debug=2 2024-01-23 22:18:34 -10:00
Simon Michael
54c60b4de9 imp: balance assertions error: clarify wording 2024-01-23 22:18:34 -10:00
Simon Michael
e694e7869d fix: check mixed-cost balances correctly again; cleanup (#2150)
The code is a bit clearer, and it no longer discards amounts other
than the first when the running balance contains multiple costs.
(This bug was exposed by the fix for #2039).
2024-01-23 21:35:07 -10:00
Simon Michael
8ec46baec9 dev: clarify behaviour of filterMixedAmountByCommodity, showMixedAmount* 2024-01-23 21:35:06 -10:00
Simon Michael
df79aa5e35 dev: distinguish oneLineFmt and oneLineNoCostFmt; add fullZeroFmt 2024-01-23 21:35:06 -10:00
Simon Michael
999cba8c31 dev: cleanup; add showAmountWith, showMixedAmountWith 2024-01-23 21:35:06 -10:00
Simon Michael
0cb382cf0e dev: rename AmountDisplayOpts -> AmountFormat, and related constants
noColour          -> defaultFmt
noCost            -> noCostFmt
oneLine           -> oneLineFmt
csvDisplay        -> machineFmt
2024-01-23 21:35:06 -10:00