[Epydoc-commits] SF.net SVN: epydoc: [1356] trunk/epydoc/src/epydoc/docstringparser.py
Brought to you by:
edloper
From: <ed...@us...> - 2006-09-06 19:26:01
|
Revision: 1356 http://svn.sourceforge.net/epydoc/?rev=1356&view=rev Author: edloper Date: 2006-09-06 12:25:54 -0700 (Wed, 06 Sep 2006) Log Message: ----------- - Fixed SF bug [ 1553539 ] Unknown parameter warnings do not occur -- Generate a warning if @param or @type contains an unknown parameter. Modified Paths: -------------- trunk/epydoc/src/epydoc/docstringparser.py Modified: trunk/epydoc/src/epydoc/docstringparser.py =================================================================== --- trunk/epydoc/src/epydoc/docstringparser.py 2006-09-06 19:12:18 UTC (rev 1355) +++ trunk/epydoc/src/epydoc/docstringparser.py 2006-09-06 19:25:54 UTC (rev 1356) @@ -331,6 +331,7 @@ BAD_CONTEXT = 'Invalid context for %r' REDEFINED = 'Redefinition of %s' UNKNOWN_TAG = 'Unknown field tag %r' +BAD_PARAM = '@%s for unknown parameter %s' ###################################################################### #{ Field Processing @@ -517,6 +518,10 @@ if arg in api_doc.arg_types: raise ValueError(REDEFINED % ('type for '+arg)) api_doc.arg_types[arg] = descr + # Check to make sure that the documented parameter(s) are + # actually part of the function signature. + if arg not in api_doc.all_args(): + raise ValueError(BAD_PARAM % (tag, '"%s"' % arg)) else: raise ValueError(BAD_CONTEXT % arg) @@ -578,6 +583,11 @@ _check(api_doc, tag, arg, context=RoutineDoc, expect_arg=True) idents = re.split('[:;, ] *', arg) api_doc.arg_descrs.append( (idents, descr) ) + # Check to make sure that the documented parameter(s) are + # actually part of the function signature. + bad_params = ['"%s"' % i for i in idents if i not in api_doc.all_args()] + if bad_params: + raise ValueError(BAD_PARAM % (tag, ', '.join(bad_params))) def process_kwarg_field(api_doc, docindex, tag, arg, descr): # [xx] these should -not- be checked if they exist.. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |