Skip to content

Commit

Permalink
Coding Standards check for action function docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Apr 24, 2013
1 parent 9c9e2dd commit c4e0d5f
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions ckan/tests/test_coding_standards.py
Expand Up @@ -900,6 +900,27 @@ class TestActionAuth(object):
'update: package_change_state',
'update: revision_change_state',
]


ACTION_NO_DOC_STR_BLACKLIST= [
'create: group_create_rest',
'create: group_member_create',
'create: organization_member_create',
'create: package_create_rest',
'create: package_relationship_create_rest',
'delete: group_member_delete',
'delete: organization_member_delete',
'delete: package_relationship_delete_rest',
'get: get_site_user',
'get: group_show_rest',
'get: member_roles_list',
'get: package_show_rest',
'get: tag_show_rest',
'update: group_update_rest',
'update: package_relationship_update_rest',
'update: package_update_rest',
]

done = False

@classmethod
Expand Down Expand Up @@ -970,3 +991,12 @@ def test_fn_signatures(self):
assert not errors, 'These action functions have the wrong function' + \
' signature, should be (context, data_dict)\n%s' \
% '\n'.join(sorted(errors))

def test_fn_docstrings(self):
errors = []
for name, fn in self.actions.iteritems():
if not getattr(fn, '__doc__', None):
if name not in self.ACTION_NO_DOC_STR_BLACKLIST:
errors.append(name)
assert not errors, 'These action functions need docstrings\n%s' \
% '\n'.join(sorted(errors))

0 comments on commit c4e0d5f

Please sign in to comment.