se.vandmo.textchecker.maven.fixers.ChangeIndentationToEven Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of text-checker-maven-plugin Show documentation
Show all versions of text-checker-maven-plugin Show documentation
Maven plugin that checks that text files adheres to certain rules.
package se.vandmo.textchecker.maven.fixers;
import static se.vandmo.textchecker.maven.rules.IndentationIsEven.isOk;
import se.vandmo.textchecker.maven.Content;
import se.vandmo.textchecker.maven.ContentType;
import se.vandmo.textchecker.maven.Fixer;
public final class ChangeIndentationToEven implements Fixer {
@Override
public void fix(Content content) {
content.modifyLines((line) -> {
return possiblyFixLine(content.type(), line);
});
}
private String possiblyFixLine(ContentType contentType, String line) {
if (isOk(line, contentType)) {
return line;
}
return fixLine(line);
}
private String fixLine(String line) {
return " " + line;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy