-
-
Notifications
You must be signed in to change notification settings - Fork 377
rules: directives are evaluated "first wins", contra Manual description #2539
Copy link
Copy link
Open
Labels
A-BUGSomething wrong, confusing or sub-standard in the software, docs, or user experience.Something wrong, confusing or sub-standard in the software, docs, or user experience.affects4-manyAffects potentially a significant number of users.Affects potentially a significant number of users.annoyance2-minorMinor to moderate usability/doc bug, reasonably easy to avoid or tolerate.Minor to moderate usability/doc bug, reasonably easy to avoid or tolerate.csvThe csv file format, csv output format, or generally CSV-related.The csv file format, csv output format, or generally CSV-related.docsDocumentation-related.Documentation-related.
Metadata
Metadata
Assignees
Labels
A-BUGSomething wrong, confusing or sub-standard in the software, docs, or user experience.Something wrong, confusing or sub-standard in the software, docs, or user experience.affects4-manyAffects potentially a significant number of users.Affects potentially a significant number of users.annoyance2-minorMinor to moderate usability/doc bug, reasonably easy to avoid or tolerate.Minor to moderate usability/doc bug, reasonably easy to avoid or tolerate.csvThe csv file format, csv output format, or generally CSV-related.The csv file format, csv output format, or generally CSV-related.docsDocumentation-related.Documentation-related.
Per https://hledger.org/1.51/hledger.html?search=#how-csv-rules-are-evaluated:
In fact the first one wins.
Example:
This complicates using a hierarchy of rule inclusions to provide a hierarchy of default directives, e.g., a general
date-formatfor Assets, a different one for Assets:BankOne, and yet a different one for Assets:BankOne:Savings.A work-around is to adopt self-discipline of specifying directives as a group before any conditionals and to put any
includedirective between the local directives and the local conditionals, as in this contrived example:Given the explanation in the Manual, however, I assume the current behavior is a bug. Perhaps it can be resolved by removing the
reverseinsidemkrulesforrdirectivesathledger/hledger-lib/Hledger/Read/RulesReader.hs
Line 622 in 865bced
Seeing the code, I assume a similar issue arises for field assignments, which could be resolved by removing the
reverseforrassignmentsat line 624.My system: