- Operating system: Mac and Windows
- SonarQube for IntelliJ plugin version: 10.25.0.81505
- IntelliJ version: 2024.2.1
- Programming language you’re coding in: Java
- Is connected mode used: Yes
- SonarQube Cloud, SonarQube Server, or SonarQube Community Build? (if one of the latter two, which version?): SonarQube Server
I want to run a SonarQube scan using the IntelliJ plugin and access the report in a Git commit hook for internal code quality checks. This setup would help verify if coding standards are followed during development. However, I noticed that the reports are only available in the UI and are not cached in a report file. Is there a way to achieve this within IntelliJ, and can I receive a notification when the scan is complete?
Thanks in advance!
Hello, welcome to the community! And thank you for your question.
This is currently not possible: all analysis jobs are handled by a process tied to the IDE, and the analysis results are only accessible from within the IDE. This is a very intentional design choice at the core of the current solution.
At the same time, we are working on a Git pre-commit
hook that would integrate with a running instance of the IDE and report newly introduced issue in the changed files, similar to the pull request/merge request analysis on the server (essentially, “shifting left” some of the PR-analysis benefits).
If you have a few minutes to spare, we would definitely be interested in gathering your insights about the following points:
- What kind of behavior would you expect from the
pre-commit
hook? Should it e.g. interrupt the commit if there are new issues in the files about to be committed?
- Do you plan to use a single
pre-commit
executable, or are you using the pre-commit framework?
Thanks!
Hi Jean,
We’re planning to run SonarQube rules, along with a few additional company-specific checks, at the time of commit. The aim is to display the scan results directly in the terminal during the commit process.
For now, we intend only to display the results during commit/push without enforcing any interruptions. Please note that we are not using a pre-commit framework for this setup.