Use a documented constant for the docutils levels

Instead of having a implicitly defined constant that doesn't
explain why the value was set use a documented frozenset that
has the valid docutils messaging levels with links/comments to
describe why they are being used.

Change-Id: I372c1babfb02c33b5881e2e6a12d464f75d944f7
This commit is contained in:
Joshua Harlow 2014-09-05 17:24:41 -07:00
parent a16a84e37b
commit 9392f55fb7
1 changed files with 9 additions and 1 deletions

View File

@ -77,6 +77,14 @@ class CheckValidity(ContentCheck):
REPORTS = frozenset(["D000"])
EXT_MATCHER = re.compile(r"(.*)[.]rst", re.I)
# From docutils docs:
#
# Report system messages at or higher than <level>: "info" or "1",
# "warning"/"2" (default), "error"/"3", "severe"/"4", "none"/"5"
#
# See: http://docutils.sourceforge.net/docs/user/config.html#report-level
WARN_LEVELS = frozenset([2, 3, 4])
# Only used when running in sphinx mode.
SPHINX_IGNORES_REGEX = [
re.compile(r'^Unknown interpreted text'),
@ -93,7 +101,7 @@ class CheckValidity(ContentCheck):
for error in parsed_file.errors:
if error.line is None:
continue
if error.level <= 1:
if error.level not in self.WARN_LEVELS:
continue
ignore = False
if self._sphinx_mode: