In this section, we setup our IntelliJ IDEA workspace to integrate with our SonarCloud server so that we can use a centralized quality profile. SonarQube empowers all developers to write cleaner and safer code. Join an Open Community of more than 200k dev teams. Complete details on how to configure phpstorm for sonar qube server and also analyze my local code with sonar qube server configured on a centralized machine.
01 Dec 2019
I’m sure you’ve heard of phpstan, psalm, and thePhpStorm Php Inspections (EA Extended) plugin. Maybe you’re already using one of these great tools to scan your codebase for issuesand possible bugs. But this time I want to show you another very cool static code analyzer for PHP:
The SonarLint Pluginfor PhpStorm.
SonarLint is an IDE extension that helps you detect and fix quality issues as you write code. Like a spell checker, SonarLint squiggles flaws so they can be fixed before committing code. You can get it directly from the IntelliJ IDEA Plugin Repository, and it will then detect new bugs and quality issues as you code (PHP, Java, Kotlin, Ruby, JavaScript and Python).
If your project is analyzed on SonarQube or on SonarCloud, SonarLint can connect to the server to retrieve the appropriate quality profiles and settings for that project.
Installation
- Open PhpStorm > File > Settings > Plugins
- Type “SonarLint” to search for the plugin
- Click: Install
- Restart PhpStorm
Configuration
Sonarqube Phpstorm
- Open the
SonarLint
tab (to the right of theVersion Control
tab) - Open the
Report
tab - Click the
Configure SonarLint
button - Open the
File Exclusions
tab and exclude thevendor/
directory of your project.
Usage
To start the code analysis…
- Open the
SonarLint
>Report
tab - Click the
Analyze all Project files
button
Sonarlint Intellij Plugin
As soon as the scan is completed, you should see the result of the code inspection:
Please enable JavaScript to view the comments powered by Disqus.