bzr revid: fp@tinyerp.com-20090109063445-obhlkpo7dtgvnulj
This commit is contained in:
Fabien Pinckaers 2009-01-09 07:34:45 +01:00
commit 8dea11ef5a
5 changed files with 20 additions and 15 deletions

View File

@ -45,7 +45,7 @@
<field name="state" readonly="1"/>
</page>
<page string="Detail">
<field name="detail" widget="text_wiki" nolabel="1" colspan="4" readonly="1"/>
<field name="detail" widget="html_tag" nolabel="1" colspan="4" readonly="1"/>
</page>
</notebook>
</form>

View File

@ -20,9 +20,7 @@
#
##############################################################################
import os
from tools import config
from tools.translate import _
from base_module_quality import base_module_quality
import pooler

View File

@ -23,6 +23,7 @@
import os
from tools import config
from tools.translate import _
from base_module_quality import base_module_quality
@ -35,6 +36,8 @@ class quality_test(base_module_quality.abstract_quality_check):
self.note = _("""This test uses Pylint and checks if the module satisfies the coding standard of Python. See http://www.logilab.org/project/name/pylint for further info.\n """)
self.bool_installed_only = False
self.ponderation = 1.0
self.result = ""
self.result_details = ""
return None
def run_test(self, cr, uid, module_path):
@ -49,7 +52,11 @@ class quality_test(base_module_quality.abstract_quality_check):
n = 0
score = 0.0
dict = {}
self.result_details += '<nowiki>'
self.result_details += '''<html>
<head>
<link rel="stylesheet" type="text/css" href="/tg_widgets/openerp/css/wiki.css" media="all">
</head>
<body>'''
for file in list_files:
if file.split('.')[-1] == 'py' and not file.endswith('__init__.py') and not file.endswith('__terp__.py'):
file_path = os.path.join(module_path, file)
@ -73,15 +80,15 @@ class quality_test(base_module_quality.abstract_quality_check):
score += 0
#self.result += file + ": "+_("Unable to parse the result. Check the details.")+"\n"
dict[file] = [file, _("Unable to parse the result. Check the details.")]
self.result_details += res
self.result_details += '</nowiki>'
self.result_details += res.replace('''<div''', '''<div class="wikiwidget readonlyfield"''')
self.result_details += '</body></html>'
average_score = n and score / n or score
self.score = (max(average_score,0)) / 10
self.result = self.get_result(dict)
return None
def get_result(self, dict):
header = ('{| border="1" cellspacing="0" cellpadding="5" align="left" \n! %-40s \n! %-10s \n', [_('File Name'), _('Result (/10)'),])
header = ('{| border="1" cellspacing="0" cellpadding="5" align="left" \n! %-40s \n! %-10s \n', [_('File Name'), _('Result (/10)')])
if not self.error:
return self.format_table(header, data_list=dict)
return ""

View File

@ -62,7 +62,7 @@ disable-msg=C0103,F0401,E0611,R0903,W0232,W0102,E1002,R0913,R0904
# set the output format. Available formats are text, parseable, colorized and
# html
output-format=text
output-format=html
# Include message's id in output
include-ids=yes

View File

@ -24,6 +24,7 @@ import netsvc
from osv import fields, osv
import os
from tools import config
from tools.translate import _
import pooler
import time
@ -54,11 +55,11 @@ This test checks the speed of the module. Note that at least 5 demo data is need
result_dict = {}
result_dict2 = {}
self.result_details += _("O(1) means that the number of SQL requests to read the object does not depand on the number of objects we are reading. This feature is hardly wished.\n")
for obj in obj_ids:
for obj, ids in obj_ids.items():
obj_counter += 1
ids = obj_ids[obj]
ids = ids[:100]
size = len(ids)
list2 = []
if size:
list = []
@ -80,6 +81,7 @@ This test checks the speed of the module. Note that at least 5 demo data is need
if size < 5:
list = [obj, size, code_base_complexity, code_half_complexity, code_size_complexity, _("Warning! Not enough demo data")]
list2 = [obj, _("No enough data")]
else:
if code_size_complexity <= (code_base_complexity + size):
complexity = _("O(1)")
@ -93,18 +95,16 @@ This test checks the speed of the module. Note that at least 5 demo data is need
else:
list = [obj, size, "", "", "", _("Warning! Object has no demo data")]
list2 = [obj, _("No demo data")]
list2 = [obj, _("No data")]
result_dict[obj] = list
result_dict2[obj] = list2
self.score = obj_counter and score / obj_counter or 0.0
self.result_details += self.get_result_details(result_dict)
self.result += self.get_result(result_dict2)
return None
def get_result(self, dict):
header = ('{| border="1" cellspacing="0" cellpadding="5" align="left" \n! %-40s \n! %-10s \n', [_('Object Name'), _('Result'),])
header = ('{| border="1" cellspacing="0" cellpadding="5" align="left" \n! %-40s \n! %-10s', [_('Object Name'), _('Result')])
if not self.error:
return self.format_table(header, data_list=dict)
return ""