I used the following settings for ktlint which allowed auto-formatting for all files during a local maven build but never triggered a pipeline failure if formatting was incorrect:
<plugin>
<groupId>com.github.gantsign.maven</groupId>
<artifactId>ktlint-maven-plugin</artifactId>
<version>1.6.1</version>
<executions>
<execution>
<id>format-and-check</id>
<goals>
<goal>format</goal>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
For ktlint to trigger a pipeline failure if formatting is incorrect I changed the settings to
<execution>
<id>verify-code-style</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
Which does trigger a failure instantly.
But - now I cannot do a local maven build and make use of auto-formatting. Instead it instantly triggers a failure, requiring manual action for example Needless blank line(s)
in class X on line Y.
I would like to have the best of both worlds - trigger a failure in the pipeline and make use of auto-formatting locally. Is there any way to achieve this?