diff options
author | Anthony Sottile <asottile@umich.edu> | 2019-09-02 16:01:23 (GMT) |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2019-09-02 16:01:23 (GMT) |
commit | e1786b54162e2bfb01ca5aafa19d596c4af5a803 (patch) | |
tree | 6bde905d673b82f6f6c9569420c578187e40dde7 /Doc/tools | |
parent | 102e9b40ff6ee45086a5f0d34d9c60c581a1e5e5 (diff) | |
download | cpython-e1786b54162e2bfb01ca5aafa19d596c4af5a803.zip cpython-e1786b54162e2bfb01ca5aafa19d596c4af5a803.tar.gz cpython-e1786b54162e2bfb01ca5aafa19d596c4af5a803.tar.bz2 |
bpo-36853: Fix suspicious.py to actually print the unused rules (#13579)
* Fix suspicious.py to actually print the unused rules
* Fix the other `self.warn` calls
Diffstat (limited to 'Doc/tools')
-rw-r--r-- | Doc/tools/extensions/suspicious.py | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/Doc/tools/extensions/suspicious.py b/Doc/tools/extensions/suspicious.py index 34a0112..9e814fb 100644 --- a/Doc/tools/extensions/suspicious.py +++ b/Doc/tools/extensions/suspicious.py @@ -115,10 +115,12 @@ class CheckSuspiciousMarkupBuilder(Builder): def finish(self): unused_rules = [rule for rule in self.rules if not rule.used] if unused_rules: - self.logger.warn('Found %s/%s unused rules:' % - (len(unused_rules), len(self.rules))) - for rule in unused_rules: - self.logger.info(repr(rule)) + self.logger.warning( + 'Found %s/%s unused rules: %s' % ( + len(unused_rules), len(self.rules), + ''.join(repr(rule) for rule in unused_rules), + ) + ) return def check_issue(self, line, lineno, issue): @@ -151,14 +153,15 @@ class CheckSuspiciousMarkupBuilder(Builder): self.any_issue = True self.write_log_entry(lineno, issue, text) if py3: - self.logger.warn('[%s:%d] "%s" found in "%-.120s"' % - (self.docname, lineno, issue, text)) + self.logger.warning('[%s:%d] "%s" found in "%-.120s"' % + (self.docname, lineno, issue, text)) else: - self.logger.warn('[%s:%d] "%s" found in "%-.120s"' % ( - self.docname.encode(sys.getdefaultencoding(),'replace'), - lineno, - issue.encode(sys.getdefaultencoding(),'replace'), - text.strip().encode(sys.getdefaultencoding(),'replace'))) + self.logger.warning( + '[%s:%d] "%s" found in "%-.120s"' % ( + self.docname.encode(sys.getdefaultencoding(),'replace'), + lineno, + issue.encode(sys.getdefaultencoding(),'replace'), + text.strip().encode(sys.getdefaultencoding(),'replace'))) self.app.statuscode = 1 def write_log_entry(self, lineno, issue, text): |