Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
genotoul-bioinfo
jflow
Commits
6a8e0244
Commit
6a8e0244
authored
Feb 10, 2017
by
Floreal Cabanettes
Browse files
Add AtLeastOneAmong rule
parent
adb28111
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/jflow/rules.py
View file @
6a8e0244
...
...
@@ -244,3 +244,20 @@ class ForbiddenChars(ValueRule):
for
value
in
self
.
values_arg
:
if
value
in
self
.
parameter_value
:
self
.
error
(
"Character not allowed:
\"
"
+
value
+
"
\"
"
)
class
AtLeastOneAmong
(
LinkRule
):
"""
At least one parameter among the list must be set
"""
def
check
(
self
):
if
self
.
parameter_value
is
None
:
has_one
=
False
for
grp_param
in
self
.
targets_args
:
if
not
getattr
(
self
.
wf_instance
,
grp_param
).
is_None
:
has_one
=
True
break
if
not
has_one
:
all_required
=
[
self
.
parameter_name
]
+
self
.
targets_args
self
.
error
(
"Please give at least one of these options:
\n\t
--"
+
"
\n\t
--"
.
join
(
all_required
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment