From 53565bcf3b257460228f318381bf008d2c7118f8 Mon Sep 17 00:00:00 2001 From: Ben Sherman Date: Tue, 25 Feb 2025 09:38:37 -0600 Subject: [PATCH] Rename NXF_ENABLE_STRICT_SYNTAX -> NXF_SYNTAX_PARSER(=v2) Signed-off-by: Ben Sherman --- docs/reference/env-vars.md | 10 +++++----- docs/updating-syntax.md | 2 +- .../nextflow/config/ConfigParserFactory.groovy | 15 +++++++++------ validation/test.sh | 2 +- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/docs/reference/env-vars.md b/docs/reference/env-vars.md index d81c8326af..480a725470 100644 --- a/docs/reference/env-vars.md +++ b/docs/reference/env-vars.md @@ -94,11 +94,6 @@ The following environment variables control the configuration of the Nextflow ru ::: : Enable Nextflow *strict* execution mode (default: `false`) -`NXF_ENABLE_STRICT_SYNTAX` -: :::{versionadded} 25.02.0-edge - ::: -: Enable the {ref}`strict syntax ` for Nextflow config files. - `NXF_ENABLE_VIRTUAL_THREADS` : :::{versionadded} 23.05.0-edge ::: @@ -187,6 +182,11 @@ The following environment variables control the configuration of the Nextflow ru ::: : Enable the use of Spack recipes defined by using the {ref}`process-spack` directive. (default: `false`). +`NXF_SYNTAX_PARSER` +: :::{versionadded} 25.02.0-edge + ::: +: Set to `'v2'` to use the {ref}`strict syntax ` for Nextflow config files (default: `'v1'`). + `NXF_TEMP` : Directory where temporary files are stored diff --git a/docs/updating-syntax.md b/docs/updating-syntax.md index 7cc7ab117d..10b48e8033 100644 --- a/docs/updating-syntax.md +++ b/docs/updating-syntax.md @@ -492,7 +492,7 @@ The process `shell` section is deprecated. Use the `script` block instead. The V ### Configuration syntax :::{versionadded} 25.02.0-edge -The strict config syntax can be enabled in Nextflow by setting `NXF_ENABLE_STRICT_SYNTAX=true`. +The strict config syntax can be enabled in Nextflow by setting `NXF_SYNTAX_PARSER=v2`. ::: See {ref}`Configuration ` for a comprehensive description of the configuration language. diff --git a/modules/nextflow/src/main/groovy/nextflow/config/ConfigParserFactory.groovy b/modules/nextflow/src/main/groovy/nextflow/config/ConfigParserFactory.groovy index 45e340d14f..d61200e7d3 100644 --- a/modules/nextflow/src/main/groovy/nextflow/config/ConfigParserFactory.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/config/ConfigParserFactory.groovy @@ -33,12 +33,15 @@ import nextflow.config.parser.v2.ConfigParserV2 class ConfigParserFactory { static ConfigParser create() { - final strict = SysEnv.get('NXF_ENABLE_STRICT_SYNTAX')=='true' - if( strict ) - log.debug "Using strict config parser" - return strict - ? new ConfigParserV2() - : new ConfigParserV1() + final parser = SysEnv.get('NXF_SYNTAX_PARSER', 'v1') + if( parser == 'v1' ) { + return new ConfigParserV1() + } + if( parser == 'v2' ) { + log.debug "Using config parser v2" + return new ConfigParserV2() + } + throw new IllegalStateException("Invalid NXF_SYNTAX_PARSER setting -- should be either 'v1' or 'v2'") } } diff --git a/validation/test.sh b/validation/test.sh index a273101218..364582b8e8 100755 --- a/validation/test.sh +++ b/validation/test.sh @@ -56,7 +56,7 @@ fi # Integration tests (strict syntax) # if [[ $TEST_MODE == 'test_strict' ]]; then - export NXF_ENABLE_STRICT_SYNTAX=true + export NXF_SYNTAX_PARSER=v2 test_integration fi