9

PhpStorm - SonarLint Plugin

 3 years ago
source link: https://odan.github.io/2019/12/01/the-phpstorm-sonarlint-plugin.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Daniel’s Dev Blog

Daniel's Dev Blog

Developer, Trainer, Open Source Contributor

Blog About me Donate

PhpStorm - SonarLint Plugin

Daniel Opitz

Daniel Opitz

01 Dec 2019

I’m sure you’ve heard of phpstan, psalm, and the PhpStorm Php Inspections (EA Extended) plugin. Maybe you’re already using one of these great tools to scan your codebase for issues and possible bugs. But this time I want to show you another very cool static code analyzer for PHP:

The SonarLint Plugin for 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

  • Open the SonarLint tab (to the right of the Version Control tab)
  • Open the Report tab
  • Click the Configure SonarLint button
  • Open the File Exclusions tab and exclude the vendor/ directory of your project.

Usage

To start the code analysis…

  • Open the SonarLint > Report tab
  • Click the Analyze all Project files button

As soon as the scan is completed, you should see the result of the code inspection:

image

© 2020 Daniel Opitz | Twitter


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK