個人的には、checkstyle 自体が提供しているルールが、spece によるインデントフォーマットをとっているので、ぜひともそれを適用したい。しかし、歴史的な事情などによりタブによるインデントを強制させたいときがあった。
残念ながら checkstyle 自体はそういうルールは提供していないので、hibernate が使っている checkstyle ルールを使う。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.1//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="Checker">
<module name="TreeWalker">
<!-- indent rule: via https://github.com/hibernate/hibernate-orm/blob/master/shared/config/checkstyle/checkstyle.xml#L35 -->
<module name="RegexpSinglelineJava">
<property name="ignoreComments" value="true" />
<property name="format" value="^\t* +\t*\S" />
<property name="message" value="Line has leading space characters; indentation should be performed with tabs only." />
</module>
</module>
</module>