From the Checkstyle documentation:
The calculation of the length of a line takes into account the number of expanded spaces for a tab character ('\t'). The default number of spaces is 8. To specify a different number of spaces, the user can set TreeWalker property tabWidth which applies to all Checks, including LineLength; or can set property tabWidth for LineLength alone.
http://checkstyle.sourceforge.net/config_sizes.html#LineLength
To do this in Eclipse:
- Open Window->Preferences from the Menu.
- Select Checkstyle.
- Type
TreeWalker
into the search box under Known modules. - Select TreeWalker on the list on the right.
- Click Open.
- Change the tabWidth to 4.
- Click OK, and OK again.