Search code examples
javamavencheckstylemaven-checkstyle-plugin

How to add exactly one tab before method in googles checkstyle.xml


so I want maven checkstyle plugin build to fail when one method is more than one tab in (4 spaces) simple example is

class test {
    public void test1 () {} //4 spaces in so thats ok
     public void test2 () {} //5 spaces in i want maven build to fail
}

I can't find someone that has a solution to this problem so I need help


Solution

  • Solved add under TreeWalker this

    <module name="Indentation">
            <property name="basicOffset" value="4"/>
            <property name="braceAdjustment" value="0"/>
            <property name="caseIndent" value="4"/>
            <property name="throwsIndent" value="8"/>
            <property name="lineWrappingIndentation" value="8"/>
            <property name="arrayInitIndent" value="4"/>
        </module>
    

    that's how I fixed my problem