4

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.

apaderno
  • 28,547
  • 16
  • 75
  • 90
Bartosz Radaczyński
  • 18,396
  • 14
  • 54
  • 61
  • 2
    The incompatibility here stems from Eclipse's formatter not giving its `line length` rule the highest priority above over rules, especially here the `line wrapping` rules. So the formatter will leave some lines longer than the max line length, and of course Checkstyle will flag that up. – Adam Jul 03 '15 at 17:31

1 Answers1

2

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.

Community
  • 1
  • 1
Oliver
  • 639
  • 5
  • 9