@@ -24,6 +24,23 @@ def lint_inputs(tool_xml, lint_ctx):
2424 if param_type == "data" :
2525 if "format" not in param_attrib :
2626 lint_ctx .warn ("Param input [%s] with no format specified - 'data' format will be assumed." , param_name )
27+
28+ if param_type == "select" :
29+ select_name = param .get ("name" , None ) or param .get ("argument" , None )
30+ dynamic_options = param .get ("dynamic_options" , None )
31+ if dynamic_options is None :
32+ dynamic_options = param .find ("options" )
33+
34+ select_options = _find_with_attribute (param , 'option' , 'value' )
35+ if any (['value' not in option .attrib for option in select_options ]):
36+ lint_ctx .error ("Option without value" )
37+
38+ select_option_ids = [option .attrib .get ('value' , None ) for option in select_options ]
39+
40+ if dynamic_options is None and len (select_options ) == 0 :
41+ message = "No options defined for select [%s]" % select_name
42+ lint_ctx .warn (message )
43+
2744 # TODO: Validate type, much more...
2845
2946 conditional_selects = tool_xml .findall ("./inputs//conditional" )
@@ -37,9 +54,6 @@ def lint_inputs(tool_xml, lint_ctx):
3754
3855 for select in selects :
3956 select_options = select .findall (select , 'option' , 'value' )
40- if any (['value' not in option .attrib for option in select_options ]):
41- lint_ctx .error ("Option without value" )
42-
4357 select_option_ids = [option .attrib .get ('value' , None ) for option in select_options ]
4458
4559 for boolean in booleans :
@@ -89,9 +103,9 @@ def lint_repeats(tool_xml, lint_ctx):
89103def _find_with_attribute (element , tag , attribute , test_value = None ):
90104 rval = []
91105 for el in (element .findall ('./%s' % tag ) or []):
92- if attribute not in el .attribute :
106+ if attribute not in el .attrib :
93107 continue
94- value = el .attribute [attribute ]
108+ value = el .attrib [attribute ]
95109 if test_value is not None :
96110 if value == test_value :
97111 rval .append (el )
0 commit comments