Getting started with Scrutinizer Code Intelligence¶
1. Setting Up Your Project on Scrutinizer¶
First, set-up your project on Scrutinizer. This will generate a default configuration, and set-up hooks so that new inspections are automatically triggered when a pull-request is made or when you push changes.
If you have added your project some time ago, make sure that you have the respective analysis tool added to your configuration:
- For PHP: PHP Scrutinizer
- For Python: Python Scrutinizer
2. Installing the Browser Extension¶
The Browser extension automatically retrieves intelligence data and adds it to the code as you browse GitHub or Bitbucket.
3. Accessing Code Intelligence Data¶
Browse to one of your files on GitHub/Bitbucket or view a pull-request. You should now see a Code Intelligence
button at
the top right. You can click that or use one of the keyboard shortcuts (CMD/CTRL
or CMD/CTRL + SHIFT
).
![../../../_images/activating-code-intelligece.png](png/fcc64754fca18a36c28e5c2ca7898723-29.png)
Variable Highlighting¶
To see where a variable is used, simply click on the variable or select part (or all) of the variable name. The variable itself should now become highlighted. Where a variable is defined, the color will be a bit darker than in other locations where it is just read.
![../../../_images/code-intelligence-variable-highlighting.png](png/8caf847c8b7c8cf1bd0b03d44dbd76f5-30.png)
Viewing Attached Data¶
Many code fragments have data like type information attached. To view this data, toggle code intelligence either via the button at the top or via one of the keyboard shortcuts. Code fragments with data are now marked with an underscore. Now simply hover the fragments you are interested in.
![../../../_images/code-intelligence-attached-data.png](png/50ae92120b3818245a6b728f36b20d2c-31.png)
Jumping into Functions/Methods¶
Some code fragments like function calls point to other areas of your project, or even another project. Scrutinizer turns those fragments into regular links you can open and directly jump into the function.
![../../../_images/code-intelligence-code-navigation.png](png/a3f57c6de766b5436e8ebf704306a0e3-32.png)