如何使用Intellij Idea解决所有检查样式问题? [英] How fix all check style issues with Intellij Idea?
问题描述
我有一个用于maven checkstyle插件的xml配置文件.我已经安装了Intellij Idea插件,并查看所有违反checkstyle的行为.有没有一种方法可以自动修复大多数问题?例如自动格式设置?有没有一种方法可以将Intellij Idea设置为从Checktyle配置文件自动格式化?
I have an xml configuration file for maven checkstyle plugin. I have installed Intellij Idea plugin and see all checkstyle violation. Is there a way to fix most of them automatically? For example auto formatting setting? Is there a way to setup Intellij Idea to autoformat from checktyle config file?
推荐答案
现在有一个选项.
从4.24.0版本开始的checkstyle-IDEA具有导入checkstyle配置的功能.
checkstyle-IDEA since 4.24.0 features import of checkstyle config.
请安装CheckStyle-IDEA插件 ( http://plugins.jetbrains.com/plugin/1065?pr=idea),可以找到 通过插件存储库(Settings | Plugins |浏览存储库).去 设置|编辑器|代码样式,选择要导入的代码样式 将CheckStyle配置为.单击管理... |导入..,选择 "CheckStyle配置",然后选择一个对应的CheckStyle 配置文件.单击确定.最后,您会看到一条消息 "CheckStyle配置设置已导入到...方案".
Please install CheckStyle-IDEA plugin (http://plugins.jetbrains.com/plugin/1065?pr=idea), it can be found via plug-in repository (Settings|Plugins|Browse repositories). Go to Settings|Editor|Code Style, choose a code style you want to import CheckStyle configuration to. Click Manage...|Import.., choose "CheckStyle Configuration" and select a corresponding CheckStyle configuration file. Click OK. At the end you will see a message "CheckStyle configuration settings were imported to ... scheme".
如果遇到任何问题,则可以为 CheckStyle插件在这里: https://github.com/jshiell/checkstyle-idea/issues .这个问题是 实际上是 https://github.com/jshiell/checkstyle-idea/issues/126
If you encounter any problems, you can create a new issue for the CheckStyle plug-in here: https://github.com/jshiell/checkstyle-idea/issues. This issue is actually a duplicate of https://github.com/jshiell/checkstyle-idea/issues/126.
该功能可用的CheckStyle插件版本为4.24.0
CheckStyle plug-in version where the feature is available is 4.24.0
从 https://youtrack.jetbrains.com/issue/复制IDEA-61520#comment = 27-1292600 .从此处
这篇关于如何使用Intellij Idea解决所有检查样式问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!