Java 如何在 Eclipse 中使用 SonarLint
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34939992/
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
How to use SonarLint in Eclipse
提问by Search Results Web results Pi
I was assigned to use SonarQube for code quality. But while I'm downloading it's plugin to Eclipse I understood it is deprecated and new one is SonarLint.
我被分配使用 SonarQube 来提高代码质量。但是当我将它的插件下载到 Eclipse 时,我知道它已被弃用,而新的插件是 SonarLint。
But as so far I couldn't find any good documentation to how to use SonarLint. How to check java project using that. I only got touch with Youtube videos. But sadly they are really really unclear to me.
但到目前为止,我找不到任何关于如何使用 SonarLint 的好文档。如何使用它检查java项目。我只接触过 Youtube 视频。但遗憾的是,他们对我来说真的很不清楚。
If can direct me to a good place to gain clear knowledge on this I'll be really grateful to you.
如果可以指导我到一个好地方来获得清晰的知识,我将非常感谢你。
采纳答案by Sumit Singh
You can install SonarLint from the Eclipse Marketplaceand read the official SonarLint documentation
您可以从Eclipse Marketplace安装 SonarLint并阅读官方 SonarLint 文档
回答by Naxos84
You can install SonarLint as described by Sumit Singh. Then you can link your project to a sonarqube server as described here
您可以按照 Sumit Singh 的描述安装 SonarLint。然后您可以按照此处所述将您的项目链接到声纳服务器
After that just make a change and save it. Sonarlint will automatically analyze the project for you. Cause analyzing is enabled by default (as far as i know)
之后只需进行更改并保存即可。Sonarlint 会自动为您分析项目。默认情况下启用原因分析(据我所知)
回答by ScarOnTheSky
If you want to analyze a complete project with the Sonar Lint plugin, you can trick the plugin by searching all Java files with a text editor and replacing "package" with " package". This will cause SVN or git changes. Open the "Sonar Lint Report" view and run the analysis on the "Current project". Afterwards, revert all your SVN changes. Do notrun the analysis again as the Sonar Lint Plugin only analyzes changed files.
如果您想使用 Sonar Lint 插件分析一个完整的项目,您可以通过使用文本编辑器搜索所有 Java 文件并将“包”替换为“包”来欺骗插件。这将导致 SVN 或 git 更改。打开“Sonar Lint Report”视图并对“Current project”运行分析。之后,还原所有 SVN 更改。千万不能再作为声纳皮棉插件只分析已更改的文件运行分析。
I found this helpful when I had no project on the Sonar server available.
当我在 Sonar 服务器上没有可用的项目时,我发现这很有帮助。