Commit Graph

5632 Commits

Author SHA1 Message Date
Simon Michael
cba306d9e5 tools: make bench: disable slowest 10k-txn benchmarks by default 2017-12-05 14:38:55 -08:00
Simon Michael
79965c5186 tools: make bench: just run hledger in $PATH by default 2017-12-05 14:32:28 -08:00
Mykola Orliuk
95db5062d6 journal: inherit commodities in included files
Followup on some comments for simonmichael/hledger#487
2017-12-04 12:26:26 -08:00
Mykola Orliuk
9cdd02e0b0 journal: pretty errors for included files
Fixes simonmichael/hledger#660
2017-12-04 12:26:26 -08:00
Mykola Orliuk
fa2e680b2e lib: fix styles after cost application
Fixes simonmichael/hledger#509
2017-12-04 12:26:26 -08:00
Dmitry Astapov
58c755df86 lib: fix budget display to always show %% consumed and handle costs
For multi-column balance report, if there are no transactions in the
given period for budgeted account, display [0% of <budget>] for
consistency.

If balance is a mix of commodities, convert to cost basis for the
purposes of computing percent of balance spent.
2017-12-01 15:52:29 -08:00
Simon Michael
30e4d26534 tools: add bench.hs with notes; make quickbench -> make bench 2017-11-29 07:41:53 -08:00
Dmitry Astapov
6f92e70575 lib: remove needless numeric comparisons in bal/bs
accountsFromPostings is currently doing excessive work when adding up
postings in each account. It sorts (accountName, amount) tuples which
cause amounts in them to be compared. There is no need to look at amount
here at all since subsequent summing up and counting does not depend on
order. It is enough to sort by accountname only.

Went through similar pieces of code, made them all look uniform.
2017-11-29 07:08:18 -08:00
Dmitry Astapov
cf0dfa9f58 lib: add dependecy on 'extra' package
It has a collection of useful list processing functions.
2017-11-29 07:08:18 -08:00
Mykola Orliuk
d05bdd5b4e hledger-check: compatibility with stack8.0.yaml 2017-11-29 07:05:22 -08:00
Simon Michael
4228203740 doc: regenerate embedded manuals
[ci skip]
2017-11-28 17:37:27 -08:00
Simon Michael
c433873e04 ui: doc: mention A key 2017-11-28 17:37:16 -08:00
Mykola Orliuk
9df985f8c6 doc: resolving of amount decimal/group ambiguity 2017-11-27 15:47:56 -08:00
Mykola Orliuk
e58272f28f journal: use groups sep and prec for decimal hint
Use whole AmountStyle in process of resolving decimal/groups separator
ambiguity.

Resolve simonmichael/hledger#399
2017-11-27 15:47:56 -08:00
Mykola Orliuk
7cbdeb40a4 journal: get decimal hint from default commodity
If appropriate commodity directive is missing fallback to default
commodity directive to get number representation style.
2017-11-27 15:47:56 -08:00
Mykola Orliuk
b7dbe044b0 journal: use decimal sep hint for amount parser
Make use of commodity format directive as a hint for parsing amount.

Kinda resolves simonmichael/hledger#487
2017-11-27 15:47:56 -08:00
Mykola Orliuk
dafdaec1ca journal: factor out rawnumberp 2017-11-27 15:47:56 -08:00
Mykola Orliuk
bcf7a1add5 journal: make numbers parsing more strict
- Hunt down adjacent punctuations with altering char.
- Add some tests dedicated to parsing amounts.
2017-11-27 15:47:56 -08:00
Mykola Orliuk
53ad035b24 journal: limit scope of directives backtracking
Effectively improves error reporting for directives.

Resolves simonmichael/hledger#402
2017-11-27 14:32:48 -08:00
Mykola Orliuk
48623b4ceb lib: fix backtracking in periodexpr parser
- Simplify doctests for periodexpr.
- Besides consuming leading space consume ending space for periodexpr also.
- Drop implicit option (def, def) behaviour of periodexpr. I.e. disallow
  hledger reg -p '' and auto-transaction with heading just '~'.
- Slightly re-factor periodexpr.
- Ensure that reportinginterval doesn't consume trailing space.
  Useful if  we'll start disallowing periods like "every1stjan2009-".
2017-11-27 06:38:47 -08:00
Simon Michael
8ab1911345 Merge branch 'adept-budgeting-and-forecasting' (#654)
Cleaned-up versions of a number of related PRs relating to budgeting,
periodic transactions, automated postings and period expressions, such
as: #644, #645, #646, #647, #651, #652, #653.
2017-11-26 14:57:27 -08:00
Dmitry Astapov
aca82cf400 doc: budgeting and forecasting how-to, demonstrating new features 2017-11-26 14:57:41 +00:00
Dmitry Astapov
8cd58b71ab bal: show percentage of budget spent 2017-11-26 14:57:41 +00:00
Dmitry Astapov
6ea5da2d9d bal: --budget shows budget performance
Budget goals specified with periodic transactions (as with
hledger-budget) can now be displayed in balance report (but not in bs/is/cf).

--budget shows the target amount and percentage alongside the actual
amount, per account and period.

Unbudgeted accounts will be hidden, unless --show-unbudgeted is used.

Budgeted accounts are displayed folded (depth-clipped) at a depth
matching the budget specification. Unbudgeted accounts, if shown, are
displayed at their usual depth (in full detail, or according to --depth).
2017-11-26 14:57:41 +00:00
Dmitry Astapov
23f3da4e92 cli: --auto adds automated postings to reports
Ledger-style automated postings, previously supported only by
hledger-budget, have landed as a first-class feature.  The --auto
flag activates them, so that any postings they generate are
included in reports.
2017-11-26 14:57:41 +00:00
Dmitry Astapov
f101d5b515 cli: --forecast adds periodic transactions to reports
Ledger-style periodic transactions, previously supported only by
hledger-budget, have landed as a first-class feature.  The --forecast
flag activates them, so that any transactions they generate are
included in reports.
2017-11-26 14:57:41 +00:00
Dmitry Astapov
50b4d76ce9 lib: runPeriodicTransaction's start date must line up with interval
This is very helpful for periodic transactions, because in budget mode
you need to ensure that no periodic transactions extend past the end
of the journal, and in forecast mode you need to make sure that all
periodic transactions are strictly after the end of the journal.
2017-11-26 14:57:41 +00:00
Dmitry Astapov
597e9c47c9 lib: more periodic transaction tests
Some of these demonstrate that runPeriodicTransaction could generate
transactions ouside of requested DateSpan. This happens because
runPeriodicTransaction uses splitSpan internally, and splitSpan always
generates dateSpans that fully cover original DateSpan, extending
beyound left/right boundary if necessary. This is ok if transactions
are generated for budgeting purpose, but during forecasting care should
be taken to check that all generated transactions are happening past
the end of the real journal.
2017-11-26 14:57:41 +00:00
Dmitry Astapov
0dfffed52c doc: expand documentation for period expressions
Document "first day of period" behavior. Document new period
expressions DayOfYear and WeekdayOfMonth.
2017-11-26 14:57:41 +00:00
Dmitry Astapov
950891b55b lib: support "every <weekday>"
A shorter spelling for "every <n>th day of week".
2017-11-26 14:57:41 +00:00
Dmitry Astapov
993e3f2b67 lib: support "every 2nd Thursday of month" in period expressions
Useful for periodic transactions.
2017-11-26 14:57:41 +00:00
Dmitry Astapov
f1b4618f2d lib: support "every 11th Nov" in period expressions
Useful for periodic transactions
Without it, once-per-year periodic transactions always occur on 1st Jan.
2017-11-26 14:57:37 +00:00
Dmitry Astapov
7acb5d45aa lib: make month names in period expressions case-insensitive
Currently only lower-case account names are supported, both on the
command line, and in the journal (in periodic transactions):

This works:
$ hledger balance -p nov

This does not:
$ hledger balance -p Nov

First transaction will parse, second will not:
```
cat every-month.journal                                                                                                                                ~/devel/haskell/darcs-get/hledger/examples
~ aug to sep
    assets
    expenses    $1

~ Aug to Sep
    assets
    expenses    $2
```

$../bin/hledger-budget bal -f every-month.journal
hledger-budget: Failed to parse "Aug to Sep": date parse error ()

This commit fixes both cases.
2017-11-26 00:25:08 +00:00
Dmitry Astapov
4049455f26 lib: Fix splitSpan for nthdayof{week,month} - start of DateSpan was not covered
Demonstration:

Consider year-test.journal:
```
2015/02/01 first half
    expenses  $1
    assets

2015/07/01 second half
    expenses  $2
    assets

2016/02/01 first half
    expenses  $4
    assets

2016/07/01 second half
    expenses  $8
    assets

2017/02/01 first half
    expenses  $16
    assets

2017/07/01 second half
    expenses  $32
    assets
```

Year balances are good:
```
$ hledger balance -f year-test.journal -p yearly
Balance changes in 2015/01/01-2017/12/31:

          || 2015  2016  2017
==========++==================
 assets   ||  $-3  $-12  $-48
 expenses ||   $3   $12   $48
----------++------------------
          ||    0     0     0
```

Note how first transaction in 2015 is not included. Note that this is old period expression, so this bug exsits in master:
```$ hledger balance -f year-test.journal -p 'every 2nd day of month'
Balance changes in 2015/07/02-2017/07/01:

          || 2015/07/02-2015/08/01  2015/08/02-2015/09/01  2015/09/02-2015/10/01  2015/10/02-2015/11/01  2015/11/02-2015/12/01  2015/12/02-2016/01/01  2016/01/02-2016/02/01  2016/02/02-2016/03/01  2016/03/02-2016/04/01  2016/04/02-2016/05/01  2016/05/02-2016/06/01  2016/06/02-2016/07/01  2016/07/02-2016/08/01  2016/08/02-2016/09/01  2016/09/02-2016/10/01  2016/10/02-2016/11/01  2016/11/02-2016/12/01  2016/12/02-2017/01/01  2017/01/02-2017/02/01  2017/02/02-2017/03/01  2017/03/02-2017/04/01  2017/04/02-2017/05/01  2017/05/02-2017/06/01  2017/06/02-2017/07/01
==========++========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
 assets   ||                     0                      0                      0                      0                      0                      0                    $-4                      0                      0                      0                      0                    $-8                      0                      0                      0                      0                      0                      0                   $-16                      0                      0                      0                      0                   $-32
 expenses ||                     0                      0                      0                      0                      0                      0                     $4                      0                      0                      0                      0                     $8                      0                      0                      0                      0                      0                      0                    $16                      0                      0                      0                      0                    $32
----------++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
          ||                     0                      0                      0                      0                      0                      0                      0                      0                      0                      0                      0                      0                      0                      0                      0                      0                      0                      0                      0                      0                      0                      0                      0                      0
```

Note how 2015 is absent entirely. This is new expression, but i think that general nature of bug is the same...
```
$ hledger balance -f year-test.journal -p 'every 4th Apr'
Balance changes in 2016/04/04-2018/04/03:

          || 2016/04/04-2017/04/03  2017/04/04-2018/04/03
==========++==============================================
 assets   ||                  $-24                   $-32
 expenses ||                   $24                    $32
----------++----------------------------------------------
          ||                     0                      0
```
2017-11-25 21:43:13 +00:00
Dmitry Astapov
fbd28be6cb Allow hledger-budget to generate transactions past the end date of the last real transaction if -b/-e are supplied 2017-11-16 16:45:08 -08:00
Simon Michael
7698d3171e api: allow swagger2 2.2 2017-11-10 20:21:54 -08:00
Simon Michael
56529daadc stack: test with latest nightly resolver 2017-11-10 19:23:09 -08:00
Simon Michael
80e4f2af83 ui: allow brick 0.29 2017-11-10 19:22:48 -08:00
Simon Michael
d3d80a3736 doc: faq: hledger doesn't allow mixed journal/timeclock syntax
[ci skip]
2017-11-09 19:12:58 -08:00
Simon Michael
f5a39f7bc4 doc: csv: expand description part, include examples
[ci skip]
2017-11-05 17:30:31 -08:00
Simon Michael
b312d51b8f doc: csv: drop redundant link to reference
[ci skip]
2017-11-05 17:29:40 -08:00
Simon Michael
0ea9793d81 doc: examples: simplify amazon csv rules slightly
[ci skip]
2017-11-05 17:29:05 -08:00
Simon Michael
49090d9e53 bin: stop listing addons after compiling them 2017-11-01 08:05:17 -07:00
Simon Michael
4ab71f0d0a journal: clarify that txn/posting comments must start with semicolon 2017-11-01 08:04:25 -07:00
Simon Michael
0e4d791371 doc: journal: use consistent semicolon comments in examples
About to add support for # posting comments, but using the semicolon
in examples makes them easier to test with Ledger.

[ci skip]
2017-11-01 06:12:55 -07:00
Simon Michael
949c53e203 doc: introduction cleanups, blurbs
[ci skip]
2017-10-31 14:05:31 -07:00
Simon Michael
c5cf6bcaad doc: move tutorial to Guide, update addons, blurbs
[ci skip]
2017-10-31 13:36:06 -07:00
Simon Michael
18d7c4b02c doc: rename Cookbook to Guide
Might need to be more specific or rename the developer/contributor guide
later. For users, for now, it's Introduction, Guide and Reference.
Still TBD where the basic getting started tutorial lives.

[ci skip]
2017-10-31 13:04:00 -07:00
Simon Michael
e3fc891ea6 doc: argument files: fix typos, add links
[ci skip]
2017-10-31 12:52:23 -07:00
Simon Michael
419395e3d5 doc: argument files: fix cookbook link
[ci skip]
2017-10-31 12:41:05 -07:00