File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
main/groovy/nextflow/config
test/groovy/nextflow/config Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ class ConfigValidator {
78
78
void validate (ConfigObject config ) {
79
79
final flatConfig = config. flatten()
80
80
for ( String key : flatConfig. keySet() ) {
81
- final names = key. tokenize(' .' )
81
+ final names = key. tokenize(' .' ). findAll { name -> ! isSelector(name) }
82
82
if ( names. first() == ' profiles' ) {
83
83
if ( ! names. isEmpty() ) names. remove(0 )
84
84
if ( ! names. isEmpty() ) names. remove(0 )
@@ -100,6 +100,15 @@ class ConfigValidator {
100
100
}
101
101
}
102
102
103
+ /**
104
+ * Determine whether a scope name is a process selector.
105
+ *
106
+ * @param name
107
+ */
108
+ private boolean isSelector (String name ) {
109
+ return name. startsWith(' withLabel:' ) || name. startsWith(' withName:' )
110
+ }
111
+
103
112
/**
104
113
* Determine whether a config option is defined in the schema.
105
114
*
Original file line number Diff line number Diff line change @@ -64,4 +64,23 @@ class ConfigValidatorTest extends Specification {
64
64
! capture. toString(). contains(' the following environment variable in the config will be ignored: \' NXF_DEBUG\' ' )
65
65
}
66
66
67
+ def ' should ignore process selectors' () {
68
+ given :
69
+ def config = new ConfigMap ([
70
+ process : [
71
+ ' withLabel:foobar' : [
72
+ cpus : 2
73
+ ],
74
+ ' withName:foobar' : [
75
+ cpus : 2
76
+ ]
77
+ ]
78
+ ])
79
+
80
+ when :
81
+ new ConfigValidator (). validate(config)
82
+ then :
83
+ ! capture. toString(). contains(' Unrecognized config option' )
84
+ }
85
+
67
86
}
You can’t perform that action at this time.
0 commit comments