-
Notifications
You must be signed in to change notification settings - Fork 87
Adding sonarqube integration for ZAP. Just add your token to sonar-project.properties and run 'npm run sonar' #1620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
brdandu
commented
Jul 10, 2025
- JIRA: ZAPP-1644
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @brdandu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request integrates SonarQube into the project's development workflow. It provides the necessary tooling and configuration to perform static code analysis, helping to identify and address code quality issues proactively. The changes simplify the process of running SonarQube scans for developers.
Highlights
- SonarQube Integration: This PR introduces SonarQube integration into the project, enabling static code analysis for improved code quality and maintainability.
- New npm Script: A new
npm run sonar
script has been added topackage.json
, allowing developers to easily trigger SonarQube scans from the command line. - SonarQube Configuration: A
sonar-project.properties
file is included, pre-configured with the SonarQube host URL, project name, source directories, and updated paths for both Jest and Cypress code coverage reports.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request adds SonarQube integration by including the sonar-scanner
dependency, an npm script to run it, and a sonar-project.properties
configuration file.
My review focuses on two key areas:
- Dependency Management: The
sonar-scanner
package should be a development dependency, not a production one. - Security: The SonarQube token should not be managed in a version-controlled file to prevent accidental exposure of secrets.
I've provided specific suggestions to address these points. Otherwise, the changes look good and achieve the goal of integrating SonarQube.
sonar.javascript.lcov.reportPaths=test/jest/coverage/lcov.info | ||
sonar.javascript.lcov.reportPaths=jest-coverage/lcov.info,cypress-coverage/lcov.info | ||
sonar.host.url=https://sonarqube.silabs.net | ||
sonar.token=put your token here which can be created from the above url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For security reasons, tokens or placeholders for tokens should not be stored in version-controlled files. This practice increases the risk of accidentally committing sensitive credentials.
The sonar-scanner
CLI automatically detects and uses the SONAR_TOKEN
environment variable. It's best practice to provide the token via this environment variable instead of in this file.
# The SonarQube token should be provided via the SONAR_TOKEN environment variable.
package.json
Outdated
@@ -147,6 +148,7 @@ | |||
"properties": "^1.2.1", | |||
"quasar": "^2.16.7", | |||
"single-instance": "^0.0.1", | |||
"sonar-scanner": "^3.1.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…project.properties and run 'npm run sonar' - Updating sonar-scanner as a dev dependency only - JIRA: ZAPP-1644
ce6d491
to
daa93c7
Compare
sonar.javascript.lcov.reportPaths=test/jest/coverage/lcov.info | ||
sonar.javascript.lcov.reportPaths=jest-coverage/lcov.info,cypress-coverage/lcov.info | ||
sonar.host.url=https://sonarqube.silabs.net | ||
sonar.token=put your token here which can be created from the above url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer an environment variable for token, instead of having to put it into a properties file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we can do that later.