在某些情况下,寻找用于强制执行空行的Checkstyle规则:
关闭后的空行
if (something)
{
// not important
}
doSomethingElse();
返回前的空行
final var result = doSomething();
return result;
发布于 2022-05-25 16:22:23
最后,我添加了一个简单的RegexpMultiline
模块,这个模块现在应该可以工作,它可能不会捕捉到所有的情况:
<!-- Enforces blank lines after block-closing curly braces (with exceptions). -->
<module name="RegexpMultiline">
<property name="format" value="}\n(?![ \t]*(else|case|catch|finally|[})]|\*)|$)"/>
</module>
https://stackoverflow.com/questions/72370542
复制