quality module

bzr revid: mra@tinyerp.com-20081231110545-5ph5aa0yndxwjttx
This commit is contained in:
mra (Open ERP) 2008-12-31 16:35:45 +05:30
parent c17b39b50c
commit c9a001510c
6 changed files with 16 additions and 17 deletions

View File

@ -70,6 +70,9 @@ class abstract_quality_check(object):
#This variable is use to make result of test should have more weight (Some tests are more critical than others)
self.ponderation = 0.0
#Specify test got an error on module
self.error = False
self.tests = []
self.list_folders = os.listdir(config['addons_path']+'/base_module_quality/')
for item in self.list_folders:
@ -138,7 +141,7 @@ class abstract_quality_check(object):
res_format['summary'] = data_list[0]
elif test=='terp':
res_format['summary'] = data_list[0]
res_format['detail'] = data_list[1]
res_format['detail'] = data_list[1]
return res_format
def add_quatation(self, x, y):

View File

@ -48,7 +48,6 @@ class quality_test(base_module_quality.abstract_quality_check):
result = {}
ok_count = 0
ex_count = 0
error = False
for obj in obj_list:
temp = []
try:
@ -91,8 +90,8 @@ This test checks if the module classes are raising exception when calling basic
The module has to be installed before running this test.\n\n """
header_list = ""
error = True
self.result = self.format_table(test='method', header=header_list, data_list=[summary,result,error])
self.error = True
self.result = self.format_table(test='method', header=header_list, data_list=[summary,result,self.error])
return None

View File

@ -54,7 +54,6 @@ class quality_test(base_module_quality.abstract_quality_check):
score = 0.0
detail = ""
detail = "\n===Pylint Test===\n"
error = False
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)
@ -89,8 +88,8 @@ This test checks if the module satisfies the current coding standard used by Ope
The module has to be installed before running this test.\n\n """
header_list = ""
error = True
self.result = self.format_table(test='pylint', data_list=[summary,detail,error])
self.error = True
self.result = self.format_table(test='pylint', data_list=[summary,detail,self.error])
return None

View File

@ -55,7 +55,6 @@ class quality_test(base_module_quality.abstract_quality_check):
obj_ids = self.get_ids(cr, uid, obj_list)
detail = ""
list1 = []
error = False
for obj in obj_ids:
obj_counter += 1
ids = obj_ids[obj]
@ -110,8 +109,8 @@ This test checks the speed of the module.
The module has to be installed before running this test.\n\n """
header_list = ""
error = True
self.result = self.format_table(test='speed', header=header_list, data_list=[summary,list1, error])
self.error = True
self.result = self.format_table(test='speed', header=header_list, data_list=[summary,list1,self.error])
return None
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -52,7 +52,6 @@ class quality_test(base_module_quality.abstract_quality_check):
feel_bad_factor = 0
detail = "\n===TERP Test===\n"
summary = "\n===TERP Test===:\n"
error = False
if '__terp__.py' not in list_files:
no_terp = True
@ -61,8 +60,8 @@ class quality_test(base_module_quality.abstract_quality_check):
summary += """
The module does not contain the __terp__.py file.\n\n """
header_list = ""
error = True
self.result = self.format_table(test='terp', data_list=[summary, detail, error])
self.error = True
self.result = self.format_table(test='terp', data_list=[summary, detail, self.error])
return None
terp_file = os.path.join(module_path,'__terp__.py')
@ -94,8 +93,7 @@ The module does not contain the __terp__.py file.\n\n """
summary += """
This test checks if the module satisfies the current coding standard for __terp__.py file used by OpenERP.
""" + "Score: " + str(self.score) + "/10\n"
"""
# else:
# summary += """
#The module has to be installed before running this test.\n\n """
@ -103,7 +101,7 @@ This test checks if the module satisfies the current coding standard for __terp_
# error = True
detail += "__terp__.py : "+ str(self.score) + "/10\n"
self.result = self.format_table(test='terp', data_list=[summary, detail, error])
self.result = self.format_table(test='terp', data_list=[summary, detail, self.error])
return None

View File

@ -77,7 +77,8 @@ class wiz_quality_check(osv.osv_memory):
val = test.quality_test()
val.run_test(cr, uid, str(module_path), str(module_data[0].state))
string_ret += val.result['summary'] #summary tab
string_ret += "Score: " + str(val.score) + "/10\n" #val.score = val.score * val.ponderation ???
if not val.error:
string_ret += "Score: " + str(val.score) + "/10\n" #val.score = val.score * val.ponderation ???
string_detail += val.result['detail'] # detail tab
score_sum += (val.add_quatation(val.score, 10) * val.ponderation)
ponderation_sum += val.ponderation