Java Intellij IDEA 检查样式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26955766/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 03:34:36  来源:igfitidea点击:

Intellij IDEA checkstyle

javaintellij-ideacheckstyle

提问by Maxim Gotovchits

I've got a problem trying to import my check-style to IDEA 14. That's what I do:

我在尝试将我的检查样式导入 IDEA 14 时遇到问题。这就是我所做的:

  1. File -> Settings -> Inspections -> Import
  2. There I choose my checkstyle.xml and then I don't know why but TempProfile is created.
  3. Hmm, ok, looks like this TempProfile can check my code using my checkstyle.xml but it doesn't!
  1. 文件 -> 设置 -> 检查 -> 导入
  2. 在那里我选择了我的 checkstyle.xml,然后我不知道为什么但是创建了 TempProfile。
  3. 嗯,好的,看起来这个 TempProfile 可以使用我的 checkstyle.xml 检查我的代码,但它没有!

采纳答案by barfuin

Go to the Checkstyle configuration page via File → Settings, then typing checkstyleinto the search box:

通过 File → Settings 进入 Checkstyle 配置页面,然后checkstyle在搜索框中输入:

IntelliJ config editor

IntelliJ 配置编辑器

Press the plusicon to add your checkstyle.xml. Activate your checkstyle.xml by clicking the checkbox in the column labeled Active.

加号图标添加您的 checkstyle.xml。通过单击标记为Active的列中的复选框激活 checkstyle.xml 。

That's it!
If you want real-time scans, you can go to the Inspections dialog and activate the real-time scan:

就是这样!
如果您想要实时扫描,您可以转到“检查”对话框并激活实时扫描:

IntelliJ Inspections Dialog

IntelliJ 检查对话框