Closed DamienCassou closed 2 years ago
It seems the undeclared account error message is also wrong.
Here is a patch to fix both but there are probably more to fix:
@@ -72,7 +72,7 @@ (flycheck-define-checker hledger
:error-patterns
(
;; Unbalanced transaction:
- (error line-start "hledger: " (file-name) ":" line "-" end-line "\n"
+ (error line-start "hledger: \"" (file-name) "\" (lines " line "-" end-line ")\n"
(message (zero-or-more line-start (zero-or-more not-newline) "\n")) "\n")
;; Failing balance assertion:
(error line-start "hledger: balance assertion: " (file-name) ":" line ":" column "\n"
@@ -82,7 +82,7 @@ (flycheck-define-checker hledger
(error line-start "hledger: " (message "this regular expression" (zero-or-more not-newline)) "\n")
;; Undeclared account:
(error line-start "hledger: " (message) "\n"
- "in transaction at: " (file-name) ":" line "-" end-line "\n")
+ "in transaction at: \"" (file-name) "\" (lines " line "-" end-line ")\n")
;; Undeclared commodity:
(error line-start "hledger: " (message) "\n" ; hledger: prefix
"at: " (file-name) ":" line "-" end-line "\n")
It turns out #10's commit 0f11d6e actually updates flycheck-hledger for current hledger master, not hledger 1.25. It was already compatible with 1.25. I'm sorry for the confusion.
It turns out https://github.com/DamienCassou/flycheck-hledger/pull/10's commit https://github.com/DamienCassou/flycheck-hledger/commit/0f11d6ea4d6f85b7f1cb243815f7b967a080e6d0 actually updates flycheck-hledger for current hledger master, not hledger 1.25. It was already compatible with 1.25.
Thank you for your analysis. I'm reverting your PR in #12. Feel free to reopen it when 1.26 is out.
I'm sorry for the confusion.
Don't worry about that. Only those who do things make mistakes :-).
Here is what hledger 1.25 outputs for an unbalanced transaction:
And here is how the matching code looks in
flycheck-hledger
:As you can see, there are double-quotes around the filename in the error message but not in the matching code. These double-quotes were removes by 0f11d6ea4d6f85b7f1cb243815f7b967a080e6d0: