Java 检查样式缩进违规 - 'public' 的缩进级别不正确 4,预期级别应为 8
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31831321/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Check Style Indentation violation - 'public' have incorrect indentation level 4, expected level should be 8
提问by Srikanth A
I am getting an checkstyle sonar violation on indendation rule (com.puppycrawl.tools.checkstyle.checks.indentation)
我在缩进规则 (com.puppycrawl.tools.checkstyle.checks.indentation) 上收到 checkstyle 声纳违规
'public' have incorrect indentation level 4, expected level should be 8.
'public' 缩进级别 4 不正确,预期级别应为 8。
at this line
在这一行
public Response getItem(@PathParam(CODE) final ProgramCode programCode,
In Intelliji, Kindly suggest on how to change the indentation level to 8
在 Intelliji 中,请建议如何将缩进级别更改为 8
采纳答案by Trisha
Open up preferences (cmd + , on the Mac, ctrl + alt + s on Windows), and go to Editor -> Code Style -> Java. On the tabs and indents spaces you can set the indents to 8.
打开首选项(在 Mac 上为 cmd + ,在 Windows 上为 ctrl + alt + s),然后转到编辑器 -> 代码样式 -> Java。在制表符和缩进空间上,您可以将缩进设置为 8。
回答by Vinod
The error is related to indentation; that is:
错误与缩进有关;那是:
If U have applied some checkstyle then you may not follow its rule simply click Ctrl + Shift + F (Auto Format).
如果您应用了一些检查样式,那么您可能不遵循其规则,只需单击 Ctrl + Shift + F(自动格式)。