Skip to content

Add configuration annotation #123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: 2.5.0dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies {
version = '2.4.0dev'

nextflowPlugin {
nextflowVersion = '24.10.0'
nextflowVersion = '25.02.1-edge'

provider = 'nextflow'
className = 'nextflow.validation.ValidationPlugin'
Expand Down
35 changes: 34 additions & 1 deletion src/main/groovy/nextflow/validation/config/HelpConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,56 @@ package nextflow.validation.config
import groovy.util.logging.Slf4j

import static nextflow.validation.utils.Colors.removeColors

import nextflow.config.schema.ConfigOption
import nextflow.config.schema.ConfigScope
import nextflow.config.schema.ScopeName
import nextflow.script.dsl.Description

/**
* This class allows to model a specific configuration, extracting values from a map and converting
* This class is used to read, parse and validate the `validation.help` config block.
*
* @author : nvnieuwk <[email protected]>
*
*/

@Slf4j
@ScopeName('validation.help')
@Description('''
The `validation.help` scope allows you to configure the help message produced by the `nf-schema` plugin.
''')
class HelpConfig {

@ConfigOption
@Description('Enable the help message.')
final public Boolean enabled = false

@ConfigOption
@Description('Show hidden parameters in the help message.')
final public Boolean showHidden = false

@ConfigOption
@Description('The parameter to use to show hidden parameters in the help message.')
final public String showHiddenParameter = "showHidden"

@ConfigOption
@Description('The parameter to use to show the short help message.')
final public String shortParameter = "help"

@ConfigOption
@Description('The parameter to use to show the full help message.')
final public String fullParameter = "helpFull"

@ConfigOption
@Description('The text to show before the help message.')
final public String beforeText = ""

@ConfigOption
@Description('The text to show after the help message.')
final public String afterText = ""

@ConfigOption
@Description('An example command of how to run the pipeline.')
final public String command = ""

HelpConfig(Map map, Map params, Boolean monochromeLogs, Boolean showHiddenParams) {
Expand Down
13 changes: 13 additions & 0 deletions src/main/groovy/nextflow/validation/config/SummaryConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import groovy.util.logging.Slf4j

import static nextflow.validation.utils.Colors.removeColors

import nextflow.config.schema.ConfigOption
import nextflow.config.schema.ConfigScope
import nextflow.config.schema.ScopeName
import nextflow.script.dsl.Description

/**
* This class allows to model a specific configuration, extracting values from a map and converting
*
Expand All @@ -13,9 +18,17 @@ import static nextflow.validation.utils.Colors.removeColors

@Slf4j
class SummaryConfig {

@ConfigOption
@Description('The text to show before the summary message.')
final public String beforeText = ""

@ConfigOption
@Description('The text to show after the summary message.')
final public String afterText = ""

@ConfigOption
@Description('A list of parameters to hide in the summary message.')
final public Set<String> hideParams = []

SummaryConfig(Map map, Boolean monochromeLogs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,55 @@ import groovy.util.logging.Slf4j

import nextflow.validation.exceptions.SchemaValidationException

import nextflow.config.schema.ConfigOption
import nextflow.config.schema.ConfigScope
import nextflow.config.schema.ScopeName
import nextflow.script.dsl.Description

/**
* This class allows model an specific configuration, extracting values from a map and converting
* This class is used to read, parse and validate the `validation` config block.
*
* @author : nvnieuwk <[email protected]>
*
*/

@Slf4j
@ScopeName('validation')
@Description('''
The `validation` scope allows you to configure the `nf-schema` plugin.
''')
class ValidationConfig {

@ConfigOption
@Description('Toggle lenient mode. In lenient mode, the validation of types will be more lenient (e.g. an integer will pass as a string type).')
final public Boolean lenientMode = false

@ConfigOption
@Description('Toggle monochrome logs. In monochrome mode, the logs will not be colored.')
final public Boolean monochromeLogs = false

@ConfigOption
@Description('Fail if unrecognised parameters are found in the config file. A warning will be given by default.')
final public Boolean failUnrecognisedParams = false

@ConfigOption
@Description('Fail if unrecognised headers are found in the samplesheets. A warning will be given by default.')
final public Boolean failUnrecognisedHeaders = false

@ConfigOption
@Description('Show hidden parameters in the help message. This is deprecated, please use `validation.help.showHidden` or the `--showHidden` parameter instead.')
final public Boolean showHiddenParams = false

@ConfigOption
@Description('Maximum size of the value shown in the error message. If the value is larger than this threshold, it will be truncated. Set to -1 to disable truncation.')
final public Integer maxErrValSize = 150

@ConfigOption
@Description('The JSON schema file to use for parameter validation.')
final public String parametersSchema = "nextflow_schema.json"

@ConfigOption
@Description('A list of parameters to ignore during validation.')
final public Set<String> ignoreParams = ["nf_test_output"] // Always ignore the `--nf_test_output` parameter to avoid warnings when running with nf-test

final public HelpConfig help
Expand Down
Loading