Bartosz Radaczyński
Bartosz Radaczyński

Reputation: 18564

Eclipse formatter vs Checkstyle inconsistency

we are using an eclipse formatting profile, that states that line width is 125 characters and that the method parameters should be wrapped when necessary. Now this line does not get broken in two:

    public FeaturePart(final Long fooBarBarBarBar, final String foo, final int sequenceNumber, final boolean fooBarBarBazBar) {

Note that the characters beyond 125th are non-letters. Checkstyle with the same line-width setting (125 characters) complains about the length of this line.

Is there a way to make the eclipse autoformatter and checkstyle line-width check consistent at this point? I have tried to find any settings that might help in both checkstyle and formatter but failed.

Upvotes: 4

Views: 1281

Answers (1)

Oliver
Oliver

Reputation: 639

The short answer is no. The Eclipse formatter and Checkstyle are different tools that are configured differently. Hence their behavior will differ.

I personally find that the Eclipse formatter is at times unwieldy in its behaviour. Luckily in Eclipse 3.6 you can turn off the formatter for sections of code. See this answer for how.

Upvotes: 2

Related Questions