> For the complete documentation index, see [llms.txt](https://docs.veedna.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.veedna.com/unifai/scanning-for-violations/scanning-in-ides.md).

# Scanning in IDEs

After you [connect your IDE to the Lineaje MCP server](https://docs.veedna.com/lineaje-mcp-server/connect-your-ide.md) and enable policies, you can scan for policy violations on demand, or automatically with a hook.

{% hint style="info" %}
Policies are disabled by default. Until you enable policies in UnifAI, a scan has no policies to evaluate against.
{% 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.

On-demand scans use the [`security_workflow`](https://docs.veedna.com/lineaje-mcp-server/tools-reference/security_workflow-ai-security-scan-and-fix.md) tool. It proposes code changes but doesn't edit your files.

{% 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="https://2983949833-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzRZpxg1UUX5iPuJAfelm%2Fuploads%2Fev6pjZwvK0n9DgsOffum%2Fbefore%20and%20after-cursor.png?alt=media&#x26;token=01e9d310-60cb-4499-9d26-66fff476962c" alt=""><figcaption></figcaption></figure>

**Claude Code**

<figure><img src="https://2983949833-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzRZpxg1UUX5iPuJAfelm%2Fuploads%2FDWDpdkFpeXJRjOHtEPOU%2Fbefore%20and%20after-claude.png?alt=media&#x26;token=f3cb36c0-36c2-4378-8164-e3111b967dcd" 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.

{% hint style="warning" %}
Before you configure a hook, you need the `unifAI-hooks` folder on your machine. In the snippet below, replace `/path/to/unifAI-hooks` with the folder's location.

NEEDS INPUT: where users download `unifAI-hooks`, and the Python version it requires.
{% endhint %}

### 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="https://2983949833-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzRZpxg1UUX5iPuJAfelm%2Fuploads%2FcyBJf750gUf1JrRjqpWK%2Fjson-hook-cursor-1.png?alt=media&#x26;token=283ae72e-5100-4519-ac8c-3469e324b4b2" alt=""><figcaption></figcaption></figure>

5. Open the file that you want Lineaje to scan.
6. 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
