Skip to content

Commit

Permalink
Merge pull request #1639 from jmchilton/lint_test_params
Browse files Browse the repository at this point in the history
Lint optional handling on conditional test parameters.
  • Loading branch information
martenson committed Feb 1, 2016
2 parents c8d05e2 + 0627116 commit f3b7dd5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/galaxy/tools/linters/inputs.py
Expand Up @@ -51,16 +51,22 @@ def lint_inputs(tool_xml, lint_ctx):
lint_ctx.warn("Conditional without <param type=\"select\" /> or <param type=\"boolean\" />")
continue

test_param_optional = False
for select in selects:
test_param_optional = test_param_optional or (select.attrib.get('optional', None) is not None)
select_options = _find_with_attribute(select, 'option', 'value')
select_option_ids = [option.attrib.get('value', None) for option in select_options]

for boolean in booleans:
test_param_optional = test_param_optional or (boolean.attrib.get('optional', None) is not None)
select_option_ids = [
boolean.attrib.get('truevalue', 'true'),
boolean.attrib.get('falsevalue', 'false')
]

if test_param_optional:
lint_ctx.warn("Conditional test parameter declares an invalid optional attribute.")

whens = conditional.findall('./when')
if any(['value' not in when.attrib for when in whens]):
lint_ctx.error("When without value")
Expand Down

0 comments on commit f3b7dd5

Please sign in to comment.