Handle the linter returning anonyomous line numbers
When sphinx (and by association restructuredtext-lint) finds an error with say a anonymous backref it does not include the line number (it defaults to none); so in this case covert that line number to ? and output that as the line number in the output shown to the user. Change-Id: I013857cdb6a24cf11d94265358b8294dfed0236d
This commit is contained in:
parent
4d82c269ab
commit
7ad4aaec88
|
@ -110,8 +110,6 @@ class CheckValidity(ContentCheck):
|
|||
|
||||
def report_iter(self, parsed_file):
|
||||
for error in parsed_file.errors:
|
||||
if error.line is None:
|
||||
continue
|
||||
if error.level not in self.WARN_LEVELS:
|
||||
continue
|
||||
ignore = False
|
||||
|
|
|
@ -226,6 +226,8 @@ def validate(cfg, files):
|
|||
for line_num, code, message in c.report_iter(f):
|
||||
if code in ignoreables:
|
||||
continue
|
||||
if not isinstance(line_num, (float, int)):
|
||||
line_num = "?"
|
||||
if cfg.get('verbose'):
|
||||
print(' - %s:%s: %s %s'
|
||||
% (f.filename, line_num, code, message))
|
||||
|
|
Loading…
Reference in New Issue