On Thu, Jun 17, 2010 at 9:46 AM, Allan McRae <allan@archlinux.org> wrote:
The new error message is much less descriptive; "pkgname is not allowed to start with a hyphen" is very clear, while "'-foo' is an invalid value for pkgname" does not tell me what is wrong.
Using the regex in the error message is just going to confuse the hell out of people too. Reading an error message should not require you know regexes.
It is a two character regex; how are people expected to use makepkg and not know what ^- means? Besides that, the message in place *isn't* a regex.
And your quest to reduce code duplication can go to the point of being nonsensical. e.g. in this patch:
+ + local i + for i in 'pkgver' 'pkgrel'; do + var_lint '-' $i "${!i}" || return + done
That would be two lines without the loop...
You're thinking in line count whereas code repetition is about duplicating logic. What if you add a new field, do you copy paste it or add it to the loop? Quoting a slice of the patch when the vast majority of the changes are happening elsewere isn't helping things either. You missed a quote from that diff that's right on the top: 1 files changed, 28 insertions(+), 42 deletions(-) In other words, there's less lines, Allan. Andres P