summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2015-03-05 14:51:10 -0800
committerJoshua Harlow <harlowja@yahoo-inc.com>2015-03-05 22:56:51 +0000
commit7ad4aaec88c130723409bc85ff3a3e6af53be574 (patch)
tree5e1d7a7deaa67d0e38e0049ca7b72c41b77a2072
parent4d82c269ab46f0c5370c1f00be06e0c406164e85 (diff)
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
Notes
Notes (review): Verified+2: Jenkins Code-Review+2: Joshua Harlow <harlowja@yahoo-inc.com> Workflow+1: Joshua Harlow <harlowja@yahoo-inc.com> Submitted-by: Jenkins Submitted-at: Tue, 31 Mar 2015 23:16:33 +0000 Reviewed-on: https://review.openstack.org/161937 Project: stackforge/doc8 Branch: refs/heads/master
-rw-r--r--doc8/checks.py2
-rw-r--r--doc8/main.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/doc8/checks.py b/doc8/checks.py
index 648e499..9d8578a 100644
--- a/doc8/checks.py
+++ b/doc8/checks.py
@@ -110,8 +110,6 @@ class CheckValidity(ContentCheck):
110 110
111 def report_iter(self, parsed_file): 111 def report_iter(self, parsed_file):
112 for error in parsed_file.errors: 112 for error in parsed_file.errors:
113 if error.line is None:
114 continue
115 if error.level not in self.WARN_LEVELS: 113 if error.level not in self.WARN_LEVELS:
116 continue 114 continue
117 ignore = False 115 ignore = False
diff --git a/doc8/main.py b/doc8/main.py
index 2f34527..19b5171 100644
--- a/doc8/main.py
+++ b/doc8/main.py
@@ -226,6 +226,8 @@ def validate(cfg, files):
226 for line_num, code, message in c.report_iter(f): 226 for line_num, code, message in c.report_iter(f):
227 if code in ignoreables: 227 if code in ignoreables:
228 continue 228 continue
229 if not isinstance(line_num, (float, int)):
230 line_num = "?"
229 if cfg.get('verbose'): 231 if cfg.get('verbose'):
230 print(' - %s:%s: %s %s' 232 print(' - %s:%s: %s %s'
231 % (f.filename, line_num, code, message)) 233 % (f.filename, line_num, code, message))