From 14ae40ae784b7df153bc416704aac4653d417db3 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Tue, 12 May 2020 16:20:14 -0500 Subject: [PATCH 1/2] remove ablity ignore files from json schema validation --- .../precommit/ValidateJsonAgainstSchemaTask.java | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/precommit/ValidateJsonAgainstSchemaTask.java b/buildSrc/src/main/java/org/elasticsearch/gradle/precommit/ValidateJsonAgainstSchemaTask.java index f683f365acf28..9c4b2cbeaaa3b 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/precommit/ValidateJsonAgainstSchemaTask.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/precommit/ValidateJsonAgainstSchemaTask.java @@ -59,7 +59,6 @@ public class ValidateJsonAgainstSchemaTask extends DefaultTask { private final ObjectMapper mapper = new ObjectMapper(); - private Set ignore = new HashSet<>(); private File jsonSchema; private FileCollection inputFiles; @@ -82,16 +81,6 @@ public void setJsonSchema(File jsonSchema) { this.jsonSchema = jsonSchema; } - @Input - @Optional - public Set getIgnore() { - return ignore; - } - - public void ignore(String... ignore) { - this.ignore.addAll(Arrays.asList(ignore)); - } - @OutputFile public File getReport() { return new File(getProject().getBuildDir(), "reports/validateJson.txt"); @@ -110,9 +99,7 @@ public void validate(InputChanges inputChanges) throws IOException { .filter(f -> f.getChangeType() != ChangeType.REMOVED) .forEach(fileChange -> { File file = fileChange.getFile(); - if (ignore.contains(file.getName())) { - getLogger().debug("Ignoring file [{}] due to configuration", file.getName()); - } else if (file.isDirectory() == false) { + if (file.isDirectory() == false) { // validate all files and hold on to errors for a complete report if there are failures getLogger().debug("Validating JSON [{}]", file.getName()); try { From d09fa10187ef431db396dc9843ea8a849c46e36f Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Tue, 12 May 2020 16:48:20 -0500 Subject: [PATCH 2/2] fix imports --- .../gradle/precommit/ValidateJsonAgainstSchemaTask.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/precommit/ValidateJsonAgainstSchemaTask.java b/buildSrc/src/main/java/org/elasticsearch/gradle/precommit/ValidateJsonAgainstSchemaTask.java index 9c4b2cbeaaa3b..673d6890d9f67 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/precommit/ValidateJsonAgainstSchemaTask.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/precommit/ValidateJsonAgainstSchemaTask.java @@ -29,10 +29,8 @@ import org.gradle.api.DefaultTask; import org.gradle.api.UncheckedIOException; import org.gradle.api.file.FileCollection; -import org.gradle.api.tasks.Input; import org.gradle.api.tasks.InputFile; import org.gradle.api.tasks.InputFiles; -import org.gradle.api.tasks.Optional; import org.gradle.api.tasks.OutputFile; import org.gradle.api.tasks.TaskAction; import org.gradle.work.ChangeType; @@ -44,9 +42,7 @@ import java.io.PrintWriter; import java.nio.file.Files; import java.nio.file.StandardOpenOption; -import java.util.Arrays; import java.util.Collection; -import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.Map;