Code Monkey home page Code Monkey logo

Comments (8)

pwseo avatar pwseo commented on September 10, 2024 1

It is fixed indeed! I thank you for your dedication to this project :)

from hledger.

pwseo avatar pwseo commented on September 10, 2024

Some follow-up to what I have mentioned above: if I remove the account type: C tag from Node:Leaf B, suddenly it starts working correctly:

$ cat a.j
account Node:Leaf A  ; type: Cash
$ cat b.j 
account Node:Leaf B
$ hledger -s -f a.j accounts --types
Node:Leaf A    ; type: C
Node:Leaf B    ; type: 

Is there a file-scoped limit for account type tags? If so, I was not aware (and did not expect it, since account directives are global). Still, it seems like a bug is at play: when the type tag is read from an included file, previous tags are being discarded.

from hledger.

pwseo avatar pwseo commented on September 10, 2024

Okay, so things are a little bit weirder than I antecipated.
This behaviour manifests only for type tags with the same value.

Let's see another similar example:

$ cat a.j 
account Node:Leaf A  ; type: C
include b.j
include c.j
$ cat b.j 
account Node:Leaf B  ; type: C
$ cat c.j 
account Node:Leaf C  ; type: C

In this case, both Node:Leaf A and Node:Leaf B tags are ignored, only Node:Leaf C is kept:

$ hledger -s -f a.j accounts --types
Node:Leaf A    ; type: 
Node:Leaf B    ; type: 
Node:Leaf C    ; type: C

If we were to change Node:Leaf B to another type, both Node:Leaf B and Node:Leaf C would be correctly typed. Node:Leaf A's type will still be blank:

$ sed -i b.j -e 's/type: C/type: X/'
$ hledger -s -f a.j accounts --types
Node:Leaf A    ; type: 
Node:Leaf B    ; type: X
Node:Leaf C    ; type: C

And finally, if we change Node:Leaf A's type tag to something else, everything works:

$ sed -i a.j -e 's/type: C/type: R/'
$ hledger -s -f a.j accounts --types
Node:Leaf A    ; type: R
Node:Leaf B    ; type: X
Node:Leaf C    ; type: C

from hledger.

simonmichael avatar simonmichael commented on September 10, 2024

I agree, that is weird. Thanks for the report.

from hledger.

pwseo avatar pwseo commented on September 10, 2024

@simonmichael, I believe the commits 531d34a and a18425c should reference issue #2201.

from hledger.

pwseo avatar pwseo commented on September 10, 2024

I agree, that is weird. Thanks for the report.

I tried running hledger with --debug=9 but didn't find anything that might help.
Can I help with anything else? (my Haskell skills are not very good).

from hledger.

simonmichael avatar simonmichael commented on September 10, 2024

@simonmichael, I believe the commits 531d34a and a18425c should reference issue #2201.

Right you are! I edited and force-pushed them.

I tried running hledger with --debug=9 but didn't find anything that might help.
Can I help with anything else? (my Haskell skills are not very good).

I appreciate that. I tried the same, then I started adding dbg0 calls and reloading in ghci (just ghci). I have seen that Hledger.Read.Common.addDeclaredAccountTags is adding each tag declaration, but on each call it sees that jdeclaredaccounttags j is empty, which is strange (it should be accumulating results from each call.

from hledger.

simonmichael avatar simonmichael commented on September 10, 2024

I believe this is now fixed in master. Good catch (a bug with the original implementation of type:, not a regression).

from hledger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.