diff --git a/plugin/src/main/java/org/ec4j/maven/AbstractEditorConfigMojo.java b/plugin/src/main/java/org/ec4j/maven/AbstractEditorConfigMojo.java index b72b554..0bc86f8 100644 --- a/plugin/src/main/java/org/ec4j/maven/AbstractEditorConfigMojo.java +++ b/plugin/src/main/java/org/ec4j/maven/AbstractEditorConfigMojo.java @@ -264,16 +264,18 @@ public void execute() throws MojoExecutionException, MojoFailureException { } final Resource resource = new Resource(absFile, file, useEncoding); final List filteredLinters = linterRegistry.filter(file); - ViolationHandler.ReturnState state = ViolationHandler.ReturnState.RECHECK; - while (state != ViolationHandler.ReturnState.FINISHED) { - for (Linter linter : filteredLinters) { - if (log.isTraceEnabled()) { - log.trace("Processing file '{}' using linter {}", file, linter.getClass().getName()); + if (!filteredLinters.isEmpty()) { + ViolationHandler.ReturnState state = ViolationHandler.ReturnState.RECHECK; + while (state != ViolationHandler.ReturnState.FINISHED) { + for (Linter linter : filteredLinters) { + if (log.isTraceEnabled()) { + log.trace("Processing file '{}' using linter {}", file, linter.getClass().getName()); + } + handler.startFile(resource); + linter.process(resource, editorConfigProperties, handler); } - handler.startFile(resource); - linter.process(resource, editorConfigProperties, handler); + state = handler.endFile(); } - state = handler.endFile(); } } } diff --git a/plugin/src/main/java/org/ec4j/maven/LinterConfig.java b/plugin/src/main/java/org/ec4j/maven/LinterConfig.java index 15b4837..359a17c 100644 --- a/plugin/src/main/java/org/ec4j/maven/LinterConfig.java +++ b/plugin/src/main/java/org/ec4j/maven/LinterConfig.java @@ -33,6 +33,14 @@ public class LinterConfig { private String[] includes; private boolean useDefaultIncludesAndExcludes = true; + public LinterConfig() { + } + + public LinterConfig(String id, boolean enabled) { + this.id = id; + this.enabled = enabled; + } + public String getClassName() { return className.indexOf('.') < 0 ? TextLinter.class.getPackage().getName() + "." + className + "Linter" : className; diff --git a/pom.xml b/pom.xml index b34e0ac..931ee1e 100644 --- a/pom.xml +++ b/pom.xml @@ -84,7 +84,7 @@ 3.0-alpha-2 3.15.2 3.4.2 - 1.1.1 + 1.2.0 2.2.2 2.0.17 diff --git a/test/src/test/java/org/ec4j/maven/EditorConfigMojosTest.java b/test/src/test/java/org/ec4j/maven/EditorConfigMojosTest.java index 3c1e159..a97c154 100644 --- a/test/src/test/java/org/ec4j/maven/EditorConfigMojosTest.java +++ b/test/src/test/java/org/ec4j/maven/EditorConfigMojosTest.java @@ -91,6 +91,22 @@ public void check() throws Exception { ; } + @Test + public void allLintersDisabled() throws Exception { + + final Verifier mavenExec = new Verifier<>( + "defaults", + EditorConfigFormatMojo.class, + Arrays.asList("log.txt")); + + mavenExec.mojo.linters = Arrays.asList(new LinterConfig("org.ec4j.linters.TextLinter", false), + new LinterConfig("org.ec4j.linters.XmlLinter", false)); + + mavenExec // + .execute() // + .assertErrorFreeLog(); + } + @Test public void encoding() throws Exception { final Verifier mavenExec = new Verifier(