1

My Java constants class contains the following line:

public static final List<String> VALID_SUBMISSION_CONTEXT_TYPE_STRINGS = Stream.of(SubmissionContextType.values())
                                                                                    .map(Enum::name)
                                                                                    .collect(Collectors.toList());

My checkstyle configuration has a line length limit of 120 characters, and the above line is within this limit.

I also use lombok @NoArgsConstructor(access = AccessLevel.PRIVATE) on this constants class. The generated lombok code is:

public static final List<String> VALID_SUBMISSION_CONTEXT_TYPE_STRINGS = Stream.of(SubmissionContextType.values()).map(Enum::name).collect(Collectors.toList());

This exceeds 120 characters on the line and causes checkstyle to fail.

Is there a way to tell lombok to restrict the length of lines in the generated code, or to preserve the whitespaces from the source code?

user3024475
  • 13
  • 1
  • 3
  • https://stackoverflow.com/questions/4023185/how-to-disable-a-particular-checkstyle-rule-for-a-particular-line-of-code – Robert Apr 30 '18 at 20:50

2 Answers2

1

Unfortonetly propably it isn't possible.

I think in that case you should run checkstyle scan before lombok code is generated.

Kamil W
  • 2,230
  • 2
  • 21
  • 43
0

Auto generated code should be skipped by Checkstyle. See Automatically generated code fails CheckStyle standards (jHipster) for a complete answer.

rveach
  • 2,081
  • 15
  • 25