首页 > 解决方案 > 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

创意偏好

在此处输入图像描述

如果阻塞

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]

标签: idecheckstyle

解决方案


在想法中,我打开选项“在第一列评论”
CheckStyle 引发错误如何解决

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

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


推荐阅读