Skip to content

errors in included csv rules files are reported with wrong location #2537

@Thaodan

Description

@Thaodan

Description

Hledger doesn't refer to the included file if the errors in the file are located in said file.
But it does tell that the error is in the file which included it but with a false offset.

Example

foo.rules

line 
line 
line
include ./bar.rules

bar.rules

line
line
line-with-error

The output will be something like:
hledger: Error: ./foo.rules: 6:1 : ...

Environment

hledger setup:

Checking your hledger setup..
Legend: good, neutral, unknown, warning

hledger
* is a released version ?                  yes  hledger 1.50.3, linux-x86_64
* is up to date ?                           no  1.50.3 installed, latest is 1.51.2
* is a native binary for this machine ?    yes  x86_64
* is installed in PATH (this version) ?    yes  /usr/bin/hledger
* has a system text encoding configured ?  yes  UTF-8, data files must use this encoding
* has a user config file ?                  no  
* has a local config file ?                 no  

terminal
* the NO_COLOR variable is defined ?        no  
* --color is configured by config file ?    no  
* hledger will use color by default ?      yes  
* the PAGER variable is defined ?          yes  cat
* --pager is configured by config file ?    no  
* hledger will use a pager when needed ?   yes  /usr/bin/cat
* tables will use box-drawing chars ?       no  you can use --pretty to enable them

journal
* the LEDGER_FILE variable is defined ?    yes  ~/Dokumente/Finanzen/Ledger/Main.journal
* a default journal file is readable ?     yes  /home/bidar/Dokumente/Finanzen/Ledger/Main.journal
* it includes additional files ?            no  
* all commodities are declared ?           yes  0 commodities
* all accounts are declared ?              yes  0 accounts
* all accounts have types ?                yes  
* accounts of all types exist ?             no  ALERXCV accounts not found; some reports may not work
* commodities/accounts are being checked ?  no  you can use -s to check them
* balance assertions are being checked ?   yes  you can use -I to ignore them

cat /etc/os-release

> cat /etc/os-release 
NAME="openSUSE Tumbleweed"
# VERSION="20251211"
ID="opensuse-tumbleweed"
ID_LIKE="opensuse suse"
VERSION_ID="20251211"
PRETTY_NAME="openSUSE Tumbleweed"
ANSI_COLOR="0;32"
# CPE 2.3 format, boo#1217921
CPE_NAME="cpe:2.3:o:opensuse:tumbleweed:20251211:*:*:*:*:*:*:*"
#CPE 2.2 format
#CPE_NAME="cpe:/o:opensuse:tumbleweed:20251211"
BUG_REPORT_URL="https://bugzilla.opensuse.org"
SUPPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org"
DOCUMENTATION_URL="https://en.opensuse.org/Portal:Tumbleweed"
LOGO="distributor-logo-Tumbleweed"

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-BUGSomething wrong, confusing or sub-standard in the software, docs, or user experience.affects4-manyAffects potentially a significant number of users.annoyance2-minorMinor to moderate usability/doc bug, reasonably easy to avoid or tolerate.csvThe csv file format, csv output format, or generally CSV-related.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions