deb-sig / double-entry-generator

Rule-based double-entry bookkeeping importer (from Alipay/WeChat/Huobi etc. to Beancount/Ledger).
https://github.com/deb-sig/double-entry-generator
Apache License 2.0
537 stars 79 forks source link

Is it more appropriate to use full match than partial match in some positions? #49

Closed z2z23n0 closed 2 years ago

z2z23n0 commented 2 years ago

Using partial matches in some items of the config file may cause problems.

For example, when I make the following settings:

method: 余额
methodAccount: Assets:Alipay:Balance

It will also match this record, which means you use two payment accounts:

...
method: "招商银行储蓄卡(8888)&余额"
...

This will result in only one payment account being generated and will not be marked with FIXME, so you may have difficulty finding errors.

So should we consider using full matches instead of partial matches in some items?

Triple-Z commented 2 years ago

SGTM, support a full match option in the rule will be fine.

/cc @gaocegege

Maybe like this:

    - method: 招商银行(9876)
      fullMatch: true
      methodAccount: Assets:Bank:CN:CMB-9876:Savings
z2z23n0 commented 2 years ago

I would like to make a PR about this if you guys are busy. @Triple-Z @gaocegege

Triple-Z commented 2 years ago

@z2z23n0 That will be great! Look forward to your PR~