An example SonarQube plugin compatible with SonarQube Server 10.x.
Sonar's Clean Code solutions help developers deliver high-quality, efficient code standards that benefit the entire team or organization.
Todo...
To build the plugin JAR file, call:
The JAR will be deployed to target/sonar-example-plugin-VERSION.jar
. Copy this to your SonarQube Server's extensions/plugins/
directory, and restart the server.
This plugin registers 4 extension pages in the SonarQube Server web app. These pages demonstrate how to extend SonarQube Server's UI with new pages and interfaces.
npm install
to install your dependencies.npm start
to start a proxy server on port 3000 to debug your JS code.http://localhost:3000
in your browser, and use SonarQube Server as you normally would.PORT
environment variable. Example: You can control to which SonarQube instance you proxy by setting the PROXY_URL
environment variable to any valid URL (defaults to http://localhost:9000
). Example:
PROXY_URL=https://sonarqube.example.com npm start
npm test
to start watching your files for changes, and run tests accordingly.npm run build
to build your front-end code.This example plugin uses Webpack for building the final JavaScript. Whatever build system you choose to use, the final result MUST adhere to the following rules:
page_id
of the registered page (see src/main/java/org/sonarsource/plugins/example/web/MyPluginPageDefinition.java
and compare with the entry points in conf/webpack/webpack.config.js
).static/
folder.The building process should be included in your full packaging process. In this example plugin, mvn package
will call npm run build
prior to finalizing the JAR package.
This project uses Jest for testing. Running npm test
will run Jest in --watch
mode. You can find the configuration for Jest in package.json
.
It is recommended you check out the sources in src/main/js/
directly. The code is well-commented and provides real-world examples of how to interact with SonarQube Server.
The pages are registered in src/main/java/org/sonarsource/plugins/example/web/MyPluginPageDefinition.java
, and their respective front-end source code is located in src/main/js/
. These examples use different stacks to demonstrate different possibilities:
src/main/js/portfolio_page/
src/main/js/admin_page/
src/main/js/project_page/
src/main/js/global_page/
There are several helper APIs exposed by SonarQube Server, like functions to make authenticated API requests.
You can find the full list of exposed helpers here.
The included pages contain several examples:
API calls (window.SonarRequest
)
Check src/main/js/common/api.js
for some examples.
Localization (window.t()
and window.tp()
)
Localizable UI strings are defined in src/main/resources/org/sonar/l10n/example/
. They are loaded at startup time and can used by the global t()
and tp()
functions. See src/main/js/admin_page/components/InstanceStatisticsApp.js
and src/main/js/portfolio_page/components/VersionsMeasuresHistoryApp.js
for some examples.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4