diff --git a/plugins/nf-schema/src/main/nextflow/validation/JsonSchemaValidator.groovy b/plugins/nf-schema/src/main/nextflow/validation/JsonSchemaValidator.groovy index dbcd85a..8ced3d7 100644 --- a/plugins/nf-schema/src/main/nextflow/validation/JsonSchemaValidator.groovy +++ b/plugins/nf-schema/src/main/nextflow/validation/JsonSchemaValidator.groovy @@ -22,9 +22,9 @@ import java.util.regex.Matcher @CompileStatic public class JsonSchemaValidator { - private static ValidatorFactory validator - private static Pattern uriPattern = Pattern.compile('^#/(\\d*)?/?(.*)$') - private static ValidationConfig config + private ValidatorFactory validator + private Pattern uriPattern = Pattern.compile('^#/(\\d*)?/?(.*)$') + private ValidationConfig config JsonSchemaValidator(ValidationConfig config) { this.validator = new ValidatorFactory() @@ -34,7 +34,7 @@ public class JsonSchemaValidator { this.config = config } - private static List validateObject(JsonNode input, String validationType, Object rawJson, String schemaString) { + private List validateObject(JsonNode input, String validationType, Object rawJson, String schemaString) { def JSONObject schema = new JSONObject(schemaString) def String draft = Utils.getValueFromJson("#/\$schema", schema) if(draft != "https://json-schema.org/draft/2020-12/schema") { @@ -104,12 +104,12 @@ public class JsonSchemaValidator { return errors } - public static List validate(JSONArray input, String schemaString) { + public List validate(JSONArray input, String schemaString) { def JsonNode jsonInput = new OrgJsonNode.Factory().wrap(input) return this.validateObject(jsonInput, "field", input, schemaString) } - public static List validate(JSONObject input, String schemaString) { + public List validate(JSONObject input, String schemaString) { def JsonNode jsonInput = new OrgJsonNode.Factory().wrap(input) return this.validateObject(jsonInput, "parameter", input, schemaString) } diff --git a/plugins/nf-schema/src/main/nextflow/validation/SamplesheetConverter.groovy b/plugins/nf-schema/src/main/nextflow/validation/SamplesheetConverter.groovy index 6c94bcb..010a14d 100644 --- a/plugins/nf-schema/src/main/nextflow/validation/SamplesheetConverter.groovy +++ b/plugins/nf-schema/src/main/nextflow/validation/SamplesheetConverter.groovy @@ -19,38 +19,38 @@ import nextflow.Nextflow @CompileStatic class SamplesheetConverter { - private static ValidationConfig config + private ValidationConfig config SamplesheetConverter(ValidationConfig config) { this.config = config } - private static List rows = [] - private static Map meta = [:] + private List rows = [] + private Map meta = [:] - private static Map getMeta() { + private Map getMeta() { this.meta } - private static Map resetMeta() { + private Map resetMeta() { this.meta = [:] } - private static addMeta(Map newEntries) { + private addMeta(Map newEntries) { this.meta = this.meta + newEntries } - private static Boolean isMeta() { + private Boolean isMeta() { this.meta.size() > 0 } - private static List unrecognisedHeaders = [] + private List unrecognisedHeaders = [] - private static addUnrecognisedHeader (String header) { + private addUnrecognisedHeader (String header) { this.unrecognisedHeaders.add(header) } - private static logUnrecognisedHeaders(String fileName) { + private logUnrecognisedHeaders(String fileName) { def Set unrecognisedHeaders = this.unrecognisedHeaders as Set if(unrecognisedHeaders.size() > 0) { def String processedHeaders = unrecognisedHeaders.collect { "\t- ${it}" }.join("\n") @@ -66,7 +66,7 @@ class SamplesheetConverter { /* Convert the samplesheet to a list of entries based on a schema */ - public static List validateAndConvertToList( + public List validateAndConvertToList( Path samplesheetFile, Path schemaFile, Map options @@ -124,7 +124,7 @@ class SamplesheetConverter { This function processes an input value based on a schema. The output will be created for addition to the output channel. */ - private static Object formatEntry(Object input, LinkedHashMap schema, String headerPrefix = "") { + private Object formatEntry(Object input, LinkedHashMap schema, String headerPrefix = "") { // Add default values for missing entries input = input != null ? input : schema.containsKey("default") ? schema.default : [] @@ -172,15 +172,15 @@ class SamplesheetConverter { } - private static List validPathFormats = ["file-path", "path", "directory-path", "file-path-pattern"] - private static List schemaOptions = ["anyOf", "oneOf", "allOf"] + private List validPathFormats = ["file-path", "path", "directory-path", "file-path-pattern"] + private List schemaOptions = ["anyOf", "oneOf", "allOf"] /* This function processes a value that's not a map or list and casts it to a file type if necessary. When there is uncertainty if the value should be a path, some simple logic is applied that tries to guess if it should be a file type */ - private static Object processValue(Object value, Map schemaEntry) { + private Object processValue(Object value, Map schemaEntry) { if(!(value instanceof String)) { return value } @@ -234,7 +234,7 @@ class SamplesheetConverter { This function processes an input value based on a schema. The output will be created for addition to the meta map. */ - private static Object processMeta(Object input, LinkedHashMap schema, String headerPrefix) { + private Object processMeta(Object input, LinkedHashMap schema, String headerPrefix) { // Add default values for missing entries input = input != null ? input : schema.containsKey("default") ? schema.default : [] diff --git a/plugins/nf-schema/src/main/nextflow/validation/SchemaValidator.groovy b/plugins/nf-schema/src/main/nextflow/validation/SchemaValidator.groovy index 5604e48..fd8e030 100644 --- a/plugins/nf-schema/src/main/nextflow/validation/SchemaValidator.groovy +++ b/plugins/nf-schema/src/main/nextflow/validation/SchemaValidator.groovy @@ -40,7 +40,7 @@ import org.yaml.snakeyaml.Yaml @CompileStatic class SchemaValidator extends PluginExtensionPoint { - static final List NF_OPTIONS = [ + final List NF_OPTIONS = [ // Options for base `nextflow` command 'bg', 'c', @@ -556,7 +556,7 @@ Please contact the pipeline maintainer(s) if you see this warning as a user. // // Clean and check parameters relative to Nextflow native classes // - private static Map cleanParameters(Map params) { + private Map cleanParameters(Map params) { def Map new_params = (Map) params.getClass().newInstance(params) for (p in params) { // remove anything evaluating to false