annotate bitten/report/lint.py @ 695:67b1f4577359

Reverse-merging [772] to re-create history for 4 files deleted in [770].
author osimons
date Thu, 17 Sep 2009 22:18:40 +0000
parents a174f33676cc
children a51af1f06e46
rev   line source
548
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
1 # -*- coding: utf-8 -*-
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
2 #
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
3 # Copyright (C) 2007 Jeffrey Kyllo <jkyllo-eatlint@echospiral.com>
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
4 #
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
5 # Based on code from the Bitten project:
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
6 # Copyright (C) 2005-2007 Christopher Lenz <cmlenz@gmx.de>
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
7 # Copyright (C) 2007 Edgewall Software
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
8 # All rights reserved.
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
9 #
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
10 # This software is licensed as described in the file COPYING, which
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
11 # you should have received as part of this distribution. The terms
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
12 # are also available at http://echospiral.com/trac/eatlint/wiki/License.
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
13
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
14 __docformat__ = 'restructuredtext en'
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
15
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
16 from trac.core import *
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
17 from bitten.api import IReportChartGenerator, IReportSummarizer
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
18
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
19
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
20 class PyLintChartGenerator(Component):
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
21 implements(IReportChartGenerator)
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
22
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
23 # IReportChartGenerator methods
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
24
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
25 def get_supported_categories(self):
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
26 return ['lint']
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
27
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
28 def generate_chart_data(self, req, config, category):
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
29 assert category == 'lint'
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
30
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
31 db = self.env.get_db_cnx()
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
32 cursor = db.cursor()
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
33
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
34 #self.log.debug('config.name=\'%s\'' % (config.name,))
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
35 query = """
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
36 select build.rev,
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
37 (select count(*) from bitten_report_item as item
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
38 where item.report = report.id and item.name='category' and item.value='convention'),
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
39 (select count(*) from bitten_report_item as item
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
40 where item.report = report.id and item.name='category' and item.value='error'),
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
41 (select count(*) from bitten_report_item as item
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
42 where item.report = report.id and item.name='category' and item.value='refactor'),
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
43 (select count(*) from bitten_report_item as item
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
44 where item.report = report.id and item.name='category' and item.value='warning')
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
45 from bitten_report as report
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
46 left outer join bitten_build as build ON (report.build=build.id)
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
47 where build.config='%s' and report.category='lint'
691
4e2dd03835de Adding `report.id` to the `group by` to fix for postgresql - see #451
dfraser
parents: 548
diff changeset
48 group by build.rev_time, build.rev, build.platform, report.id
548
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
49 order by build.rev_time;""" % (config.name,)
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
50
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
51 #self.log.debug('sql=\'%s\'' % (query,))
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
52 cursor.execute(query)
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
53
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
54 lint = []
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
55 prev_rev = None
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
56 prev_counts = None
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
57
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
58 for rev, conv, err, ref, warn in cursor:
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
59 total = conv + err + ref + warn
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
60 curr_counts = [rev, total, conv, err, ref, warn]
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
61 if rev != prev_rev:
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
62 lint.append(curr_counts)
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
63 else:
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
64 # cunningly / dubiously set rev = max(rev, rev) along with the counts
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
65 lint[-1] = [max(prev, curr) for prev, curr in zip(curr_counts, lint[-1])]
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
66 # recalculate total
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
67 lint[-1][1] = sum(lint[-1][2:])
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
68 prev_rev = rev
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
69
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
70 data = {'title': 'Lint Problems by Type',
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
71 'data': [
695
67b1f4577359 Reverse-merging [772] to re-create history for 4 files deleted in [770].
osimons
parents: 694
diff changeset
72 {'label': 'Total Problems', 'data': [[item[0], item[1]] for item in lint]},
67b1f4577359 Reverse-merging [772] to re-create history for 4 files deleted in [770].
osimons
parents: 694
diff changeset
73 {'label': 'Convention', 'data': [[item[0], item[2]] for item in lint]},
67b1f4577359 Reverse-merging [772] to re-create history for 4 files deleted in [770].
osimons
parents: 694
diff changeset
74 {'label': 'Error', 'data': [[item[0], item[3]] for item in lint]},
67b1f4577359 Reverse-merging [772] to re-create history for 4 files deleted in [770].
osimons
parents: 694
diff changeset
75 {'label': 'Refactor', 'data': [[item[0], item[4]] for item in lint]},
67b1f4577359 Reverse-merging [772] to re-create history for 4 files deleted in [770].
osimons
parents: 694
diff changeset
76 {'label': 'Warning', 'data': [[item[0], item[5]] for item in lint]},
67b1f4577359 Reverse-merging [772] to re-create history for 4 files deleted in [770].
osimons
parents: 694
diff changeset
77 ],
67b1f4577359 Reverse-merging [772] to re-create history for 4 files deleted in [770].
osimons
parents: 694
diff changeset
78 'options': [
67b1f4577359 Reverse-merging [772] to re-create history for 4 files deleted in [770].
osimons
parents: 694
diff changeset
79 {'xaxis': {'ticks': [[item[0], '[%s]' % item[0]] for item in lint]}},
67b1f4577359 Reverse-merging [772] to re-create history for 4 files deleted in [770].
osimons
parents: 694
diff changeset
80 ],
67b1f4577359 Reverse-merging [772] to re-create history for 4 files deleted in [770].
osimons
parents: 694
diff changeset
81 }
548
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
82
695
67b1f4577359 Reverse-merging [772] to re-create history for 4 files deleted in [770].
osimons
parents: 694
diff changeset
83 return 'json.txt', {"json": data}
548
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
84
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
85
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
86 class PyLintSummarizer(Component):
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
87 implements(IReportSummarizer)
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
88
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
89 # IReportSummarizer methods
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
90
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
91 def get_supported_categories(self):
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
92 return ['lint']
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
93
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
94 def render_summary(self, req, config, build, step, category):
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
95 assert category == 'lint'
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
96
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
97 db = self.env.get_db_cnx()
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
98 cursor = db.cursor()
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
99 cursor.execute("""
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
100 SELECT item_type.value AS type, item_file.value AS file,
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
101 item_line.value as line, item_category.value as category,
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
102 report.category as report_category
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
103 FROM bitten_report AS report
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
104 LEFT OUTER JOIN bitten_report_item AS item_type
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
105 ON (item_type.report=report.id AND item_type.name='type')
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
106 LEFT OUTER JOIN bitten_report_item AS item_file
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
107 ON (item_file.report=report.id AND
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
108 item_file.item=item_type.item AND
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
109 item_file.name='file')
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
110 LEFT OUTER JOIN bitten_report_item AS item_line
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
111 ON (item_line.report=report.id AND
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
112 item_line.item=item_type.item AND
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
113 item_line.name='lines')
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
114 LEFT OUTER JOIN bitten_report_item AS item_category
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
115 ON (item_category.report=report.id AND
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
116 item_category.item=item_type.item AND
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
117 item_category.name='category')
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
118 WHERE report_category='lint' AND build=%s AND step=%s
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
119 ORDER BY item_type.value""", (build.id, step.name))
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
120
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
121 file_data = {}
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
122
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
123 type_total = {}
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
124 category_total = {}
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
125 line_total = 0
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
126 file_total = 0
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
127 seen_files = {}
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
128
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
129 for type, file, line, category, report_category in cursor:
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
130 if not file_data.has_key(file):
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
131 file_data[file] = {'file': file, 'type': {}, 'lines': 0, 'category': {}}
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
132
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
133 d = file_data[file]
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
134 #d = {'type': type, 'line': line, 'category': category}
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
135 if not d['type'].has_key(type):
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
136 d['type'][type] = 0
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
137 d['type'][type] += 1
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
138
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
139 d['lines'] += 1
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
140 line_total += 1
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
141
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
142 if not d['category'].has_key(category):
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
143 d['category'][category] = 0
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
144 d['category'][category] += 1
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
145
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
146 if file:
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
147 d['href'] = req.href.browser(config.path, file)
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
148
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
149 if not type_total.has_key(type):
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
150 type_total[type] = 0
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
151 type_total[type] += 1
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
152
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
153 if not category_total.has_key(category):
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
154 category_total[category] = 0
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
155 category_total[category] += 1
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
156
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
157 if not seen_files.has_key(file):
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
158 seen_files[file] = 0
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
159 file_total += 1
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
160
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
161 data = []
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
162 for d in file_data.values():
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
163 d['catnames'] = d['category'].keys()
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
164 data.append(d)
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
165
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
166 template_data = {}
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
167 template_data['data'] = data
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
168 template_data['totals'] = {'type': type_total, 'category': category_total, 'files': file_total, 'lines': line_total}
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
169
e42f5644ea91 Added files from the bitten-lint commit that I forgot to add (see #379, which should really work now)
dfraser
parents:
diff changeset
170 return 'bitten_summary_lint.html', template_data
Copyright (C) 2012-2017 Edgewall Software