a style guide entry for using BBMASK?
is there a *preferred* format for setting BBMASK? in my travels,
i've seen variations such as:
"dir/dir"
"dir/dir/"
"dir/dir/*"
".*/dir/dir"
and so on. is there an aesthetic preference of any kind?
rday
Signature · 7 lines
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================Quoted 10 lines · Robert P. J. Day
is there a *preferred* format for setting BBMASK? in my travels,
i've seen variations such as:"dir/dir"
"dir/dir/"
"dir/dir/*"
".*/dir/dir"and so on. is there an aesthetic preference of any kind?
It's just a regular expression, so as long as it matches, we're fine, but that said, there are certain things to keep in mind:
- First, 'dir/dir' will also match 'foodir/dirbar', which while an unlikely case, is something you should avoid, and this is what having the leading/trailing slashes helps you avoid. It's not as unlikely as it seems, also. Consider something like recipes/libfoo/ and recipes/libfoobar/
- It uses re.search, not re.match, so the leading .* is unnecessary
- /* will only match a series of slashes, not "anything" — that sounds like a case of someone thinking it's a glob when it's actually a regex. further, without a ^ to anchor the end of the expression, there's no need to match anything past what you're searching for (that is, no need to do something like dir/dir/.*)
So given those points, I'd suggest the form of BBMASK = "/dir/dir/" — note the leading and trailing slashes to ensure it doesn't match anything that doesn't exactly match those directories.
Signature · 1 line
Christopher Larson