# Scanning in IDEs

After you've completed the [configuration of the Lineaje MCP server](/unifai/setting-up/configuring-the-lineaje-mcp-server.md), UnifAI automatically scans for policy violations.

{% hint style="info" %}
Policies are disabled by default. You must [enable policies in UnifAI](/unifai/policies/viewing-and-enabling-policies.md#enable-or-disable-policies) to allow policies scanning.&#x20;
{% endhint %}

<details>

<summary>On-demand scanning</summary>

Use this workflow when hook functionality is disabled in your environment or unavailable in your IDE.

You can request manuals scans for policy violations:

1. To check for violations, open, edit, and save the file you want to be scanned. You can do this in an IDE (for example, Cursor) or CLI (for example Claude Code).
2. Run the command  `scan file_processor.py using Lineaje`. Replace `file_processor.py` with your file name. Lineaje performs a policy‑violation scan on the specified file and generates a detailed report. The report includes the project evaluated, the policies applied, and the controls enforced during the scan.

{% hint style="info" %}
If the Lineaje MCP server is not detected during scanning, disable the MCP server, then enable it. In addition, select the latest agent model instead of an auto Agent.
{% endhint %}

The following examples display Lineaje suggestions for modifying code to prevent policy violations.

**Cursor**

<figure><img src="/files/ziQKUnlCLtxJZ0uMifmn" alt=""><figcaption></figcaption></figure>

**Claude Code**

<figure><img src="/files/Jq1wrMMIihlrT0xw1Hg2" alt=""><figcaption></figcaption></figure>

</details>

<details>

<summary>Installing a hook for automatic scanning</summary>

Use this workflow when hook integration is available in your IDE.

Hooks automatically detect changes to a file and send the file to the MCP server for policy violation detection and remediation.

### Cursor

To install a hook in Cursor:

1. Open a file in your repository.
2. Go to **Settings** > **Hooks.**
3. Click **Open user config**.
4. Copy and paste the following JSON configuration snippet:

```
{
  "version": 1,
  "hooks": {
    "afterFileEdit": [
      {
        "command": "python3 /path/to/unifAI-hooks/hooks/after_file_edit_hook_handler.py"
      }
    ],
    "stop": [
      {
        "command": "python3 /path/to/unifAI-hooks/hooks/stop_hook_handler.py"
      }
    ]
  }
}
```

<figure><img src="/files/zWIqLOMxKRK615J5v9VP" alt=""><figcaption></figcaption></figure>

4. Open the file that you want Lineaje to scan.
5. As you write code, Lineaje evaluates the selected file for policy violations and produces a detailed report. The report lists the project reviewed, the applied policies, and the controls enforced.

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.veedna.com/unifai/scanning-for-violations/scanning-in-ides.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
