CheckStyle注释

时间:2019-06-27 13:28:16

标签: ide checkstyle

在“创意”中,我将选项“在第一列评论”

CheckStyle引发错误 解决方法

 Comment has incorrect indentation level 0, expected is 10, indentation should be the same level as line 139. [CommentsIndentation]

编辑28.06.2019

checkstyle.xml

想法偏好

enter image description here

如果阻止

148:            CompletableFuture.allOf(terminateEnvironmentResponseCompletableFuture, checkInvoicePaidResponseCompletableFuture,
149:                inactiveUserResponseCompletableFuture).whenComplete((v, th) -> {
151:              if (th != null) {
152:                log.error(th.getMessage(), th);
153:              }
154:              finishDelete(userDto);
155:            });

错误:

....java:150: 'if' has incorrect indentation level 14, expected level should be 18. [Indentation]
....java:151: 'if' child has incorrect indentation level 16, expected level should be 20. [Indentation]
....java:152: 'if rcurly' has incorrect indentation level 14, expected level should be 18. [Indentation]
....java:153: 'block' child has incorrect indentation level 14, expected level should be 18. [Indentation]
....java:154: 'block rcurly' has in*correct indentation level 12, expected level should be 16. [Indentation]

评论

108:          .withIdentity("ServicesTrigger", "TriggerGroup")
109://           is fired every day at 3:00 am
110:          .withSchedule(cronSchedule("0 0 3 * * ?"))
111://          .withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(12).repeatForever())
112:          .forJob(_servicesJob)
113:          .build();
114:      _scheduler.scheduleJob(_servicesJob, serviceTrigger);

错误:

....java:110: Comment has incorrect indentation level 0, expected is 10, indentation should be the same level as line 111. [CommentsIndentation]
....java:112: Comment has incorrect indentation level 0, expected is 10, indentation should be the same level as line 113. [CommentsIndentation]

1 个答案:

答案 0 :(得分:1)

  

在“创意”中,我将选项“第一栏中的评论”
  CheckStyle引发错误如何解决

CommentsIndentation当前不支持第一列中的必需注释。默认行为是注释必须与周围的代码缩进相同。

如果您想查看CommentsIndentation中的这种行为,则需要在github上的checkstyle中创建一个问题。现在,我建议禁用该检查。从配置中删除它或将其注释掉。