简体   繁体   English

Sonar Qube的项目隔离

[英]Project segregation in Sonar Qube

I have a projects structure like as shown below. 我有一个如下所示的项目结构。

在此输入图像描述

Cloud projects folder are having four type projects ( eco-projects, evn-projects, met-projects, svn-projects ) 云项目文件夹有四个类型的项目( 生态项目,evn项目,元项目,svn项目

Each type of projects contains again four different projects, like for example in eco-projects we have eco-1-projects, eco-2-projects, eco-3-projects,eco-4-projects . 每种类型的项目都包含四个不同的项目,例如生态项目,我们有生态1项目,生态2项目,生态3项目,生态4项目

I have integrated this in Sonar Qube which I got only one Project as Cloud projects like as shown below, when shows all the combined projects source code. 我已经在Sonar Qube中集成了这个,当我显示所有组合项目的源代码时,我只有一个Project作为Cloud项目 ,如下所示。

在此输入图像描述

Can we have a hierarchy like visualization in Sonar Qube, like for example lets say when I click the Cloud Projects in Sonar Dashbaord, It will navigate to another four project such as eco-projects, evn-projects, met-projects, svn-projects and now lets say when I click eco-projects it will show me eco-1-projects, eco-2-projects, eco-3-projects,eco-4-projects and now when I click eco-1-projects it will show its source code related dashboard and coverages 我们可以在Sonar Qube中拥有像可视化这样的层次结构,例如,当我点击Sonar Dashbaord中的Cloud Projects时,它将导航到另外四个项目,例如生态项目,evn项目,元项目,svn项目现在让我们说当我点击生态项目时 ,它将向我展示生态1项目,生态2项目,生态3项目,生态4项目 ,现在当我点击eco-1项目时 ,它将显示其源代码相关的仪表板和覆盖范围

My sonar-project.properties is given below 我的sonar-project.properties如下

# Required metadata
sonar.projectKey=cloud-projects
sonar.projectName=Cloud Projects
sonar.projectVersion=1.0
# Language
sonar.language=java

# Encoding of the source files
sonar.sourceEncoding=UTF-8

sonar.modules=eco-projects, evn-projects, met-projects, svn-projects

eco-projects.sonar.projectName=eco-projects
eco-projects.sonar.language=java
eco-projects.sonar.modules=eco-1-projects, eco-2-projects, eco-3-projects,eco-4-projects

eco-projects.eco-1-projects.sonar.projectName=eco-1-projects
eco-projects.eco-1-projects.sonar.sources=docroot/WEB-INF/src
eco-projects.eco-1-projects.sonar.language=java

eco-projects.eco-2-projects.sonar.projectName=eco-2-projects
eco-projects.eco-2-projects.sonar.sources=docroot/WEB-INF/src
eco-projects.eco-2-projects.sonar.language=java

eco-projects.eco-3-projects.sonar.projectName=eco-3-projects
eco-projects.eco-3-projects.sonar.sources=docroot/WEB-INF/src
eco-projects.eco-3-projects.sonar.language=java

eco-projects.eco-4-projects.sonar.projectName=eco-4-projects
eco-projects.eco-4-projects.sonar.sources=docroot/WEB-INF/src
eco-projects.eco-4-projects.sonar.language=java
:
:
:

Can anyone please tell me some solution for this 任何人都可以告诉我一些解决方案

AFAIK Sonar doesn't support something like this. AFAIK Sonar不支持这样的事情。 It only supports projects, modules and files. 它只支持项目,模块和文件。 This means that you've added (at least?) 1 extra layer Sonar can't work with. 这意味着你已经添加了(至少?)1个Sonar无法使用的额外层。

Perhaps you can skip the top 'cloud-projects' level and create a sonar.properties file for each project type? 也许您可以跳过顶级的“云项目”级别并为每个项目类型创建一个sonar.properties文件? If we take eco-projects as an example, you need to create a sonar.properties file for that and define eco-1-projects, eco-2-projects, etc. as modules. 如果我们以生态项目为例,您需要为此创建一个sonar.properties文件,并将eco-1-projects,eco-2-projects等定义为模块。 This means that eco-projects is visible in the Sonar dashboard and if you click on it and go to 'code' you'll see all modules. 这意味着生态项目在Sonar仪表板中可见,如果您点击它并转到“代码”,您将看到所有模块。 Click on a module to see the files (assuming that is the file level in your case). 单击模块以查看文件(假设这是您的文件级别)。

BTW you can also use Sonar Dashboards as an extra layer, for example by adding all eco-projects in 1 dashboard. 顺便说一下,您还可以使用Sonar Dashboards作为额外的图层,例如在1个仪表板中添加所有生态项目。

In SonarQube's menu you have : "Issues", "Measures", "Code" and "Dashboard". 在SonarQube的菜单中,您有:“问题”,“度量”,“代码”和“仪表板”。

"Code" is the one you want. “代码”是你想要的。 There, you will find a breakdown by "component" (= one for each of your subprojects). 在那里,您将找到按“组件”划分的细分(=每个子项目一个)。 Each line starts with a small icon (a box with an arrow going out of it, with a tooltip saying : "Open component's page"). 每一行都以一个小图标(一个带箭头的方框)开头,工具提示说:“打开组件的页面”。 This will restrict SQ's scope to this specific component. 这将限制SQ的范围到此特定组件。

Try it out here for example : https://sonarqube.com/code?id=org.apache.hbase%3Ahbase 试试这里,例如: https//sonarqube.com/code?id = org.apache.hbase%3Ahbase

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

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