[LINTER] Improve check-doc regex
Summary:
Improve the regex:
- Use Perl type regex in grep to remove duplication. Previously there
was 2 alsmost identical regex, one posix compliant for egrep and one
Perl compliant for python re.
- Exclude the test folder from the source path rather than subtracting
its matching output
This improvements make the -h now detectable; it is added to the
undocumented exceptions.
Inspired from core PR12820.
Note that GNU grep is used instead of git grep to allow for
multiline regex (required due to our code format).
Test Plan:
Should return no error:
arc lint ./test/lint/check-doc.py
There should be 1 more used argument than before this patch (-h),
otherwise the output should be identical.
Reviewers: #bitcoin_abc, deadalnix, jasonbcox
Reviewed By: #bitcoin_abc, jasonbcox
Subscribers: teamcity, schancel
Differential Revision: https://reviews.bitcoinabc.org/D2694