SonarLint Eclipse:是否还会分析"src/test"中的源代码?

编程入门 行业动态 更新时间:2024-10-24 08:27:39
本文介绍了SonarLint Eclipse:是否还会分析"src/test"中的源代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在我公司中,我们目前正在以连接模式将 SonarLint Eclipse (版本3.1)与SonarJava(版本4.7.1)一起用于SonarQube服务器(版本5.6).

In my company, we are currently using SonarLint Eclipse (version 3.1) in connected mode to SonarQube server (version 5.6), with SonarJava (version 4.7.1).

我们想从SonarLint Eclipse中分析一些插件和一些测试插件:

We have some plugins and some test plugins that we want to analyze from SonarLint Eclipse :

1.如果源代码在"src/java" 中,则SonarLint效果很好,并且显示根据从中定义的规则检测到的一些问题SonarQube服务器的SonarQube配置文件.

1.If the source code is in "src/java", SonarLint works well and displays some issues detected according the rules defined from the SonarQube profile of our SonarQube server.

2.但是,如果源代码在"src/test/" 中,则SonarLint在"SonarLint On The Fly"视图中不会显示任何问题.在这种情况下,SonarLint日志显示:

2.But if the source code is in "src/test/", SonarLint does not display any issue in the view "SonarLint On The Fly". In this case, SonarLint logs show:

...src/test/..../MyClassTest.java 1 files indexed Execute Sensor: JavaSquidSensor Configured Java source version (sonar.java.source): 8 JavaClasspath initialization JavaClasspath initialization (done) | time=17ms JavaTestClasspath initialization JavaTestClasspath initialization (done) | time=15ms Java Main Files AST scan 0 source files to be analyzed Java Main Files AST scan (done) | time=0ms Java Test Files AST scan 1 source files to be analyzed 0/0 source files have been analyzed

SonatLint在Java主文件和Java测试文件之间的工作方式似乎有所不同.

SonatLint seems to work differently between Java Main Files and Java Test Files.

是否有一种配置SonarLint的方法,以便它在连接模式下对Java主文件和Java测试文件的工作方式相同?

Does there is a way to configure SonarLint in order that it works on the same way for Java Main Files and Java Test Files in connected mode?

推荐答案

在SonarLint for Eclipse中,您可以配置将哪些文件视为测试源.

In SonarLint for Eclipse, you can configure which files are considered to be test sources.

转到:

首选项-> SonarLint

Preferences -> SonarLint

并更改测试文件正则表达式".

And change the "Test file regular expressions".

更多推荐

SonarLint Eclipse:是否还会分析"src/test"中的源代码?

本文发布于:2023-11-06 01:28:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1562381.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:还会   源代码   Eclipse   SonarLint   test

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!