Use regex instead of prefix matches
To allow for any future additions to be added that are not just prefix matches lets switch the prefix match array for sphinx false positives to using regex instead. Change-Id: I7ec0188d1fee98dbafb5b99429f96982a2be261c
This commit is contained in:
parent
8ea62aff22
commit
8cf6a73aad
|
@ -77,11 +77,11 @@ class CheckValidity(ContentCheck):
|
|||
REPORTS = frozenset(["D000"])
|
||||
|
||||
# Only used when running in sphinx mode.
|
||||
SPHINX_PREFIX_IGNORES = [
|
||||
'Unknown interpreted text',
|
||||
'Unknown directive type',
|
||||
'Undefined substitution',
|
||||
'Substitution definition contains illegal element',
|
||||
SPHINX_IGNORES_REGEX = [
|
||||
re.compile(r'^Unknown interpreted text'),
|
||||
re.compile(r'^Unknown directive type'),
|
||||
re.compile(r'^Undefined substitution'),
|
||||
re.compile(r'^Substitution definition contains illegal element'),
|
||||
]
|
||||
|
||||
def __init__(self, cfg):
|
||||
|
@ -96,8 +96,8 @@ class CheckValidity(ContentCheck):
|
|||
continue
|
||||
ignore = False
|
||||
if self._sphinx_mode:
|
||||
for m in self.SPHINX_PREFIX_IGNORES:
|
||||
if error.message.startswith(m):
|
||||
for m in self.SPHINX_IGNORES_REGEX:
|
||||
if m.match(error.message):
|
||||
ignore = True
|
||||
break
|
||||
if not ignore:
|
||||
|
|
Loading…
Reference in New Issue