Commit 9b38dca8 authored by Jérome Perrin's avatar Jérome Perrin

include Components checkConsistency in coding style

Components also have some extra checks in checkConsistency, we should
include this in coding style test.

See merge request nexedi/erp5!1324
parents b9097101 b5f4194d
......@@ -32,7 +32,7 @@
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
<value> <string>erp5_certificate_authority</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
......
......@@ -66,9 +66,17 @@ def checkPythonScript(script_instance, script_path):
def checkComponent(component_instance):
"""Check a component, adding messages to global `line_list`
"""
component_relative_url = component_instance.getRelativeUrl()
for consistency_message in component_instance.checkConsistency():
line_list.append(
Message(
location=component_relative_url,
message=consistency_message.getMessage().translate(),
edit_url=component_relative_url,
jio_key=component_relative_url,),)
for annotation in json.loads(portal.ERP5Site_checkPythonSourceCodeAsJSON(
{'code': unicode(component_instance.getTextContent(), 'utf8')}))['annotations']:
annotation['component_path'] = component_instance.getRelativeUrl()
annotation['component_path'] = component_relative_url
line_list.append(
Message(
location="{component_path}:{row}:{column}".format(**annotation),
......
......@@ -62,6 +62,7 @@ class BuilderTool(BaseTool):
security = ClassSecurityInfo()
title = 'Builders'
meta_type = 'ERP5 Builder Tool'
security.declareProtected(Permissions.AccessContentsInformation,
'getBuilderValueList')
......
......@@ -59,6 +59,11 @@ class ToolComponent(DocumentComponent):
if not error_list:
expected_meta_type = 'ERP5 ' + ''.join([(c if c.islower() else ' ' + c)
for c in self.getReference()]).strip()
# XXX Handle a few exceptions, following the same rules as in
# ERP5Site_checkNamingConventions
expected_meta_type = expected_meta_type\
.replace(' S M S ', ' SMS ')\
.replace(' O Auth ', ' OAuth ')
if re.search(r'^\s*meta_type\s*=\s*[\'"]%s[\'"]\s*$' % expected_meta_type,
self.getTextContent(), re.MULTILINE) is None:
error_list.append(ConsistencyMessage(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment