--strict and --pedantic

245 views
Skip to first unread message

Matthew Harris

unread,
Jun 15, 2012, 2:15:47 AM6/15/12
to ledge...@googlegroups.com
I have two questions about behaviors that seem like bugs to me. (And I'm running code I checked out from Git this week.)

First, I thought that I could put flags directly into my journal file and they would be equivalent to providing them on the command line. But with this input file:

--pedantic
2012/01/01 Payday
  Assets:Checking  $100.00
  Income

'ledger -f test.dat reg' doesn't complain about unknown accounts, but 'ledger -f test.dat reg --pedantic' does. Why?

Second, I expected that pedantic checking would protect me from typos in tag names, but apparently it doesn't:

account Assets:Checking
account Income
commodity $
tag foobar
2012/01/01 Payday
  * Assets:Checking  $100.00
  ; :foobaz:
  Income

For this file, Ledger doesn't complain about an unknown tag. If I unclear the posting (remove the *), Ledger complains. (And there's no "tags" command as there is for accounts and commodities, so it's doubly hard to find such typos. Come to think of it, there should be a "tags" command.)

Thank you, John, for all your work on Ledger.


Matthew

Martin Michlmayr

unread,
Jun 15, 2012, 3:33:13 AM6/15/12
to ledge...@googlegroups.com
* Matthew Harris <mharr...@gmail.com> [2012-06-14 23:15]:
> 2012/01/01 Payday
> * Assets:Checking $100.00
> ; :foobaz:
> Income
>
> For this file, Ledger doesn't complain about an unknown tag. If I unclear
> the posting (remove the *), Ledger complains.

afaik clearing a posting makes it a known entity and so --pedantic
won't warn. What you want is --explicit but this doesn't work for me:
http://bugs.ledger-cli.org/show_bug.cgi?id=771

| When --explicit is given, *only* predeclarations establish the
| "known-ness" of parsed entities. I.e., if you didn't predeclare
| it, you don't expect to ever see it.

> Come to think of it, there should be a "tags" command.)

Agreed. There's a feature request already:
http://bugs.ledger-cli.org/show_bug.cgi?id=522

--
Martin Michlmayr
http://www.cyrius.com/

Matthew Harris

unread,
Jun 15, 2012, 4:34:42 PM6/15/12
to ledge...@googlegroups.com
On Friday, June 15, 2012 12:33:13 AM UTC-7, Martin Michlmayr wrote:
* Matthew Harris <mharr...@gmail.com> [2012-06-14 23:15]:
> 2012/01/01 Payday
>   * Assets:Checking  $100.00
>   ; :foobaz:
>   Income
>
> For this file, Ledger doesn't complain about an unknown tag. If I unclear
> the posting (remove the *), Ledger complains.

afaik clearing a posting makes it a known entity and so --pedantic
won't warn.  What you want is --explicit but this doesn't work for me:
http://bugs.ledger-cli.org/show_bug.cgi?id=771

Ah, thanks. I didn't find --explicit in the manual, and I had forgotten about the announcement of that feature. FWIW, it does work for me at detecting the misspelled tag in my example, though I agree it doesn't work for detecting new account names in your example.
 

Matthew
Reply all
Reply to author
Forward
0 new messages