Nir Soffer has posted comments on this change.

Change subject: check the syntaxs of optional parameters in json schema
......................................................................


Patch Set 2:

(5 comments)

....................................................
Commit Message
Line 3: AuthorDate: 2012-12-28 00:27:20 +0800
Line 4: Commit:     ShaoHe Feng <[email protected]>
Line 5: CommitDate: 2012-12-28 14:30:30 +0800
Line 6: 
Line 7: check the syntaxs of optional parameters in json schema
Detect optional parameter syntax errors in JSON schema
Line 8: 
Line 9: There are so many syntaxs error of optional parameters define in
Line 10: json schema
Line 11: This patch can both check the descrption errors of optional parameters


Line 8: 
Line 9: There are so many syntaxs error of optional parameters define in
Line 10: json schema
Line 11: This patch can both check the descrption errors of optional parameters
Line 12: missing #optional and the define error of optional parameters missing *
There are too many syntax errors using optional parameters in JSON schema. This 
patch detects these errors.
Line 13: 
Line 14: Change-Id: I94f92459ee8787780a54a510b6f8cc074fb2a235


....................................................
File vdsm_api/process-schema.py
Line 23: import re
Line 24: import vdsmapi
Line 25: try:
Line 26:     from collections import OrderedDict
Line 27:     OrderedDict  # make pyflakes happy
Can we fix pyflakes instead? This type of code make me sad :-)
Line 28: except ImportError:
Line 29:     from ordereddict import OrderedDict
Line 30: 
Line 31: html_escape_table = {


Line 151:                 # check optional parameters
Line 152:                 if desc.startswith('#optional'):
Line 153:                     assert ('*' + name in symbol['data'].keys()), \
Line 154:                         ('Define of %s optional parameter 
error:\n\t%s should '
Line 155:                          'start with *' % (symbol['name'], name))
Since we raise ValueError bellow - why not raise it here also?
Line 156:                 if isinstance(symbol['data'], OrderedDict):
Line 157:                     if '*' + name in symbol['data'].keys():
Line 158:                         assert desc.startswith('#optional'), \
Line 159:                             ('Description of %s optional parameter 
error:\n\t'


Line 158:                         assert desc.startswith('#optional'), \
Line 159:                             ('Description of %s optional parameter 
error:\n\t'
Line 160:                              'The description of optional parameter 
"%s" '
Line 161:                              'should start with "#optional"' %
Line 162:                              (symbol['name'], name))
ValueError?
Line 163:             else:
Line 164:                 # Just append it to the last one we added
Line 165:                 symbol[mode][last_arg] += ' ' + line
Line 166:         elif mode == 'info_return':


-- 
To view, visit http://gerrit.ovirt.org/10446
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I94f92459ee8787780a54a510b6f8cc074fb2a235
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: ShaoHe Feng <[email protected]>
Gerrit-Reviewer: Adam Litke <[email protected]>
Gerrit-Reviewer: Better Saggi <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Itamar Heim <[email protected]>
Gerrit-Reviewer: Nir Soffer <[email protected]>
Gerrit-Reviewer: Saggi Mizrahi <[email protected]>
Gerrit-Reviewer: ShaoHe Feng <[email protected]>
Gerrit-Reviewer: Zhou Zheng Sheng <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to