Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the method of displaying the badge of a SonarQube private project

2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

The main content of this article is to explain "what is the method of displaying the badge of SonarQube private projects". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "what is the method of displaying the badge of a SonarQube private project?"

Introduction to SonarQube Architectur

Let's first take a brief look at the operation mechanism of sonar. As shown in the figure, running SonarQube app actually runs four processes at the same time. The app process is responsible for scheduling the other three processes as a whole. When there is a plug-in installation that needs to be reloaded, app can issue instructions to restart. Here is a detailed description:

App Process: a process operated by the user, which is facade and is turned on or off by the user. At the same time, it is also the scheduler of the other three processes. When app is enabled, Es, web, ce and other processes will be started automatically.

Es Process:ElasticSearch process, Sonar will Es's distribution package built into Sonar, as an exclusive search engine to use, issue, code and other data will be managed by es.

Web Process:web page, process of api

Ce Process:ce is called Compute Engine. Analysis and calculation engine is the core of sonar

Analyze the generation of badges

Below is a link to get the bugs badge. Let's start with this link and take an in-depth analysis of how the badge is generated inside the sonar service. Before the analysis, it is explained that sonar does not use any web framework such as spring mvc, but is a set of mvc framework encapsulated by itself, and mybatis is used for database query.

Https://qa-sonar.dev.com/api/project_badges/measure?project=server_services_developer_AXaIXEx52AMDJFWZUd_4&metric=bugs

Find the web entry file ProjectBadgesService.java of the badge according to the / api/project_badges of the badge resource, and you can see the input parameters supported by the interface. Find the MeasureAction.java through the action module name measure. The main logic for generating the badge is in this, and the directory structure of the module is as follows:

From here, we know that the svg picture obtained through the badge link is a real-time picture generated by checking out the data in real time through project_Id. Static image resources are not generated for every scan. The logic that private projects cannot generate code is also found in this module.

Implementation plan

1. Change the community code to remove private restrictions

This is the simplest, but there are more restrictions. Changed the code needs to release its own version, the function can not be synchronized with the community. And if you pay for it, it won't work either.

2. Create a new project and generate your own svg

Try to get all the metadata information about sonar, and then generate your own svg badge, trying to be consistent with sonar's own style and usage in url design. The style of the generated badge is also consistent.

At this point, I believe you have a deeper understanding of "SonarQube private project badge display method". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report