Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: third_party/pylint/reporters/html.py

Issue 719313003: Revert "pylint: upgrade to 1.3.1" (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/pylint/reporters/guireporter.py ('k') | third_party/pylint/reporters/text.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE). 1 # Copyright (c) 2003-2006 Sylvain Thenault (thenault@gmail.com).
2 # Copyright (c) 2003-2011 LOGILAB S.A. (Paris, FRANCE).
2 # This program is free software; you can redistribute it and/or modify it under 3 # This program is free software; you can redistribute it and/or modify it under
3 # the terms of the GNU General Public License as published by the Free Software 4 # the terms of the GNU General Public License as published by the Free Software
4 # Foundation; either version 2 of the License, or (at your option) any later 5 # Foundation; either version 2 of the License, or (at your option) any later
5 # version. 6 # version.
6 # 7 #
7 # This program is distributed in the hope that it will be useful, but WITHOUT 8 # This program is distributed in the hope that it will be useful, but WITHOUT
8 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 10 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
10 # 11 #
11 # You should have received a copy of the GNU General Public License along with 12 # You should have received a copy of the GNU General Public License along with
12 # this program; if not, write to the Free Software Foundation, Inc., 13 # this program; if not, write to the Free Software Foundation, Inc.,
13 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 14 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
14 """HTML reporter""" 15 """HTML reporter"""
15 16
16 import sys 17 import sys
17 from cgi import escape 18 from cgi import escape
18 19
19 from logilab.common.ureports import HTMLWriter, Section, Table 20 from logilab.common.ureports import HTMLWriter, Section, Table
20 21
21 from pylint.interfaces import IReporter 22 from pylint.interfaces import IReporter
22 from pylint.reporters import BaseReporter, Message 23 from pylint.reporters import BaseReporter
23 24
24 25
25 class HTMLReporter(BaseReporter): 26 class HTMLReporter(BaseReporter):
26 """report messages and layouts in HTML""" 27 """report messages and layouts in HTML"""
27 28
28 __implements__ = IReporter 29 __implements__ = IReporter
29 name = 'html'
30 extension = 'html' 30 extension = 'html'
31 31
32 def __init__(self, output=sys.stdout): 32 def __init__(self, output=sys.stdout):
33 BaseReporter.__init__(self, output) 33 BaseReporter.__init__(self, output)
34 self.msgs = [] 34 self.msgs = []
35 35
36 def add_message(self, msg_id, location, msg): 36 def add_message(self, msg_id, location, msg):
37 """manage message of different type and in the context of path""" 37 """manage message of different type and in the context of path"""
38 msg = Message(self, msg_id, location, msg) 38 module, obj, line, col_offset = location[1:]
39 self.msgs += (msg.category, msg.module, msg.obj, 39 if self.include_ids:
40 str(msg.line), str(msg.column), escape(msg.msg)) 40 sigle = msg_id
41 else:
42 sigle = msg_id[0]
43 self.msgs += [sigle, module, obj, str(line), str(col_offset), escape(msg )]
41 44
42 def set_output(self, output=None): 45 def set_output(self, output=None):
43 """set output stream 46 """set output stream
44 47
45 messages buffered for old output is processed first""" 48 messages buffered for old output is processed first"""
46 if self.out and self.msgs: 49 if self.out and self.msgs:
47 self._display(Section()) 50 self._display(Section())
48 BaseReporter.set_output(self, output) 51 BaseReporter.set_output(self, output)
49 52
50 def _display(self, layout): 53 def _display(self, layout):
51 """launch layouts display 54 """launch layouts display
52 55
53 overridden from BaseReporter to add insert the messages section 56 overridden from BaseReporter to add insert the messages section
54 (in add_message, message is not displayed, just collected so it 57 (in add_message, message is not displayed, just collected so it
55 can be displayed in an html table) 58 can be displayed in an html table)
56 """ 59 """
57 if self.msgs: 60 if self.msgs:
58 # add stored messages to the layout 61 # add stored messages to the layout
59 msgs = ['type', 'module', 'object', 'line', 'col_offset', 'message'] 62 msgs = ['type', 'module', 'object', 'line', 'col_offset', 'message']
60 msgs += self.msgs 63 msgs += self.msgs
61 sect = Section('Messages') 64 sect = Section('Messages')
62 layout.append(sect) 65 layout.append(sect)
63 sect.append(Table(cols=6, children=msgs, rheaders=1)) 66 sect.append(Table(cols=6, children=msgs, rheaders=1))
64 self.msgs = [] 67 self.msgs = []
65 HTMLWriter().format(layout, self.out) 68 HTMLWriter().format(layout, self.out)
66 69
67
68 def register(linter):
69 """Register the reporter classes with the linter."""
70 linter.register_reporter(HTMLReporter)
OLDNEW
« no previous file with comments | « third_party/pylint/reporters/guireporter.py ('k') | third_party/pylint/reporters/text.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698