SonarQube is a platform for checking code for quality according to rules based on conventions and standards. Supports more than 20 different programming languages.
Here you can see all these rules.
')
I want to share a little tutorial on how to make friends sonarQube, PhpStorm and your project. All actions are described for Windows, but still configured for a different OS.
First you need to
download the SonarQube daemon (currently the latest version is 5.1), which will start the server and store data about your tests. Unpack it in a folder
C:\sonarqube
Then,
download the plugin for the programming language that you are going to check (for me it is
a PHP plugin ) and put it in the plugins folder
C:\sonarqube\extensions\plugins
In order to run the check itself, you need a
runner , which we
download there and, if necessary, we will write it in the system variables.
C:\sonar-runner
It is also necessary to configure test configuration files. To do this, in the root of your project, create a
sonar-project.properties file with the following content:
sonar.projectKey=runner // , sonar.projectName=PHPNAME // sonar.projectVersion=1.0 // sonar.sources=src // , ( ) sonar.language=php // sonar.dynamicAnalysis=false // \ , sonar.sourceEncoding=UTF-8 //
Before you start SonarQube, make sure that your machine is
JavaVirtualMachineLaunch SonarQube
C:\sonarqube\bin\windows-x86-xx\StartSonar.bat
Go to the root of the project and run from there
runner C:\sonar-runner\bin\sonar-runner.bat
After successful execution of the text will appear, about the content.

If your test fails, then for me it was for several reasons:
Incorrectly written configs. For example, a folder that is listed for verification does not exist.
Not enough memory for the JVM. It is solved by increasing the memory for our daemon:
Required in SonarQube settings
C:\sonarqube\conf\sonar.properties
Register:
%JAVA_EXEC% -Xmx1024m -XX:MaxPermSize=512m -XX:ReservedCodeCacheSize=128m %SONAR_RUNNER_OPTS%
Now we can look at the test results at:
http://localhost:9000/dashboard/index/runner
In the results you can see the number and types of errors, as well as read in detail about each error and an example of its correction.

Download the plugin for IDE itself:
Go to the menu to install plugins in PhpStorm: File-> settings-> plugins-> BrowseRepositories
Find the SonarQube there and install it.
(The plugin was developed by Jetbrains, so most likely it is also supported by other IDEs of this company).
Customize plugin:
Go to the plugin settings: File-> settings-> OtherSettings-> SonarQube
First, let's configure the server that the plugin will contact to get the test results. To do this, click on the
add button and enter the settings.

Then load the results of our test. To do this, click on the green plus sign, update the list of projects by clicking on the
download resources button, select our project and add it.

Now you can inspect the code, see what inconsistencies with the standards were allowed and correct them.
Inspect the code in PhpStorm: Code-> InsectCode-> wholeProject:

I hope my instructions come in handy.