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

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

Issue 739393004: Revert "Revert "pylint: upgrade to 1.3.1"" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
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 | Annotate | Revision Log
« 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-2006 Sylvain Thenault (thenault@gmail.com). 1 # Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
2 # Copyright (c) 2003-2011 LOGILAB S.A. (Paris, FRANCE).
3 # This program is free software; you can redistribute it and/or modify it under 2 # This program is free software; you can redistribute it and/or modify it under
4 # the terms of the GNU General Public License as published by the Free Software 3 # the terms of the GNU General Public License as published by the Free Software
5 # Foundation; either version 2 of the License, or (at your option) any later 4 # Foundation; either version 2 of the License, or (at your option) any later
6 # version. 5 # version.
7 # 6 #
8 # This program is distributed in the hope that it will be useful, but WITHOUT 7 # This program is distributed in the hope that it will be useful, but WITHOUT
9 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 8 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 9 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
11 # 10 #
12 # You should have received a copy of the GNU General Public License along with 11 # You should have received a copy of the GNU General Public License along with
13 # this program; if not, write to the Free Software Foundation, Inc., 12 # this program; if not, write to the Free Software Foundation, Inc.,
14 # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 13 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15 """HTML reporter""" 14 """HTML reporter"""
16 15
17 import sys 16 import sys
18 from cgi import escape 17 from cgi import escape
19 18
20 from logilab.common.ureports import HTMLWriter, Section, Table 19 from logilab.common.ureports import HTMLWriter, Section, Table
21 20
22 from pylint.interfaces import IReporter 21 from pylint.interfaces import IReporter
23 from pylint.reporters import BaseReporter 22 from pylint.reporters import BaseReporter, Message
24 23
25 24
26 class HTMLReporter(BaseReporter): 25 class HTMLReporter(BaseReporter):
27 """report messages and layouts in HTML""" 26 """report messages and layouts in HTML"""
28 27
29 __implements__ = IReporter 28 __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 module, obj, line, col_offset = location[1:] 38 msg = Message(self, msg_id, location, msg)
39 if self.include_ids: 39 self.msgs += (msg.category, msg.module, msg.obj,
40 sigle = msg_id 40 str(msg.line), str(msg.column), escape(msg.msg))
41 else:
42 sigle = msg_id[0]
43 self.msgs += [sigle, module, obj, str(line), str(col_offset), escape(msg )]
44 41
45 def set_output(self, output=None): 42 def set_output(self, output=None):
46 """set output stream 43 """set output stream
47 44
48 messages buffered for old output is processed first""" 45 messages buffered for old output is processed first"""
49 if self.out and self.msgs: 46 if self.out and self.msgs:
50 self._display(Section()) 47 self._display(Section())
51 BaseReporter.set_output(self, output) 48 BaseReporter.set_output(self, output)
52 49
53 def _display(self, layout): 50 def _display(self, layout):
54 """launch layouts display 51 """launch layouts display
55 52
56 overridden from BaseReporter to add insert the messages section 53 overridden from BaseReporter to add insert the messages section
57 (in add_message, message is not displayed, just collected so it 54 (in add_message, message is not displayed, just collected so it
58 can be displayed in an html table) 55 can be displayed in an html table)
59 """ 56 """
60 if self.msgs: 57 if self.msgs:
61 # add stored messages to the layout 58 # add stored messages to the layout
62 msgs = ['type', 'module', 'object', 'line', 'col_offset', 'message'] 59 msgs = ['type', 'module', 'object', 'line', 'col_offset', 'message']
63 msgs += self.msgs 60 msgs += self.msgs
64 sect = Section('Messages') 61 sect = Section('Messages')
65 layout.append(sect) 62 layout.append(sect)
66 sect.append(Table(cols=6, children=msgs, rheaders=1)) 63 sect.append(Table(cols=6, children=msgs, rheaders=1))
67 self.msgs = [] 64 self.msgs = []
68 HTMLWriter().format(layout, self.out) 65 HTMLWriter().format(layout, self.out)
69 66
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