简体   繁体   English

SonarLint 2.2.1 Eclipse 没有发现大多数问题(与在线示例不同)

[英]SonarLint 2.2.1 Eclipse not catching a majority of issues (unlike examples online)

I want to use the SonarLint plugin for Eclipse.我想为 Eclipse 使用 SonarLint 插件。 I installed it, but it doesn't seem to be catching everything it should.我安装了它,但它似乎没有捕捉到它应有的一切。 After installing it, I tried to write code that should trigger SonarLint issues.安装后,我尝试编写应该触发 SonarLint 问题的代码。 For example, the picture on the site http://www.sonarlint.org/eclipse/ , indicates that SonarLint should complain when I use == to compare floats because "Equality Tests should not be made with floating point numbers".例如,网站http://www.sonarlint.org/eclipse/上的图片表明,当我使用 == 比较浮点数时,SonarLint 应该抱怨,因为“不应使用浮点数进行平等测试”。 However, on my side, I do not get this message.但是,在我这边,我没有收到此消息。 Normally I would think that SonarLint wasn't installed correctly, but it does complain about the class, saying to "Add some tests to this class."通常我会认为 SonarLint 没有正确安装,但它确实抱怨这个类,说“向这个类添加一些测试”。 so it seems to exist.所以它似乎存在。 This is the only message the SonarLint gives me.这是 SonarLint 给我的唯一信息。

Here is a picture of what my Eclipse looks like.这是我的 Eclipse 外观的图片。 I have included multiple issues that should trigger a SonarLint message but almost all of them do not.我已经包含了多个应该触发 SonarLint 消息的问题,但几乎所有问题都没有。 Is there some setting or issue that needs to be changed that I haven't set yet?是否有一些我尚未设置的设置或问题需要更改?

Picture of my Eclipse我的日食图片

I have Eclipse Neon running Java 8 and I installed SonarLint version 2.2.我有运行 Java 8 的 Eclipse Neon,我安装了 SonarLint 2.2 版。 I am planning on using SonarLint in the "Standalone" mode rather than the "Connected" mode which I believe means that I do not need to set up anything after installing the plugin on Eclipse.我计划在“独立”模式而不是“连接”模式下使用 SonarLint,我相信这意味着在 Eclipse 上安装插件后我不需要设置任何东西。

Thanks in advance for your help在此先感谢您的帮助

Figured it out.弄清楚了。 For some reason, because I named my Java Project "Test", I think it assumed that the project was filled with Unit Tests based on JUnit class naming conventions.出于某种原因,因为我将我的 Java 项目命名为“Test”,我认为它假定该项目充满了基于 JUnit 类命名约定的单元测试。 When I made a project with a different name, SonarLint worked as expected.当我用不同的名称制作一个项目时,SonarLint 会按预期工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM