On this page:
Code Sniffer Page
The page is available only when the PHP plugin is enabled. The plugin is not bundled with IntelliJ IDEA, but it can be installed from the JetBrains plugin repository as described in Installing, Updating and Uninstalling Repository Plugins and Enabling and Disabling Plugins.
On this page, choose the Code Sniffer script to use.
|Configuration|| From this drop-down list, choose the script to use: |
|Ignored files|| This area displays a list of files that Code Sniffer skips. IntelliJ IDEA suggests adding a new file to the list during inspection when waiting for response from the Code Sniffer exceeds the limit specified in the Tool process timeout field. This is done to prevent slowing down processing. For each file, IntelliJ IDEA displays its name and location. |
Code Sniffer Dialog
The dialog box opens when you click next to the Configuration drop-down list on the Code Sniffer page.
Use this dialog box to configure local Code Sniffer scripts, scripts associated with remote PHP interpreters, see PHP Code Sniffer, and configure Code Sniffer's behaviour.
The left-hand pane of the dialog box shows all the configured Code Sniffer scripts, one of them is of the type Local, and others are named after the remote PHP interpreters with which the scripts are associated. When you select a configuration, the right-hand pane shows its details.
- To configure or edit the Local script, select Local and specify the location of
phpcsin the PHP Code Sniffer path field.
- To configure a new script associated with a remote PHP interpreter:
- Click on the toolbar.
- In the Code Sniffer by Remote Interpreter dialog box that opens, choose the remote PHP interpreter to use the associated script from. If the list does not contain a relevant interpreter, click and configure a remote interpreter in the CLI Interpreters dialog box as described in Configuring Remote PHP Interpreters.
When you click OK, IntelliJ IDEA brings you back to the Code Sniffer dialog box where the new Code Sniffer configuration is added to the list and the right-hand pane shows the chosen remote PHP interpreter, the path to the Code Sniffer associated with it, and the advanced PHP Code Sniffer options.
|PHP Code Sniffer (phpcs) Path|| In this text box, specify the location of the Code Sniffer utility |
In either case, type the path manually or click the Browse button and select the path in the dialog box, that opens.
To check that the specified path to
|Interpreter||The field shows the chosen PHP interpreter to use the Code Sniffer from.|
|Maximum number of messages per file|| In this text box, set the upper limit for the total number of messages to be reported for a file. All the messages above this limit will be rejected. IntelliJ IDEA will display the following warning right in the code: |
|Tool process timeout||In this text box, specify how long you want IntelliJ IDEA to wait for a result from PHP Code Sniffer, whereupon the process is killed to prevent excessive CPU and memory usage. This gives you the capability to fine tune the PHP Code Sniffer process behavior depending on the configuration of your computer and the rule sets used.|