# VS Code

Qualor for VS Code shows your Qualor server's issues on the files you open, and finds new ones
while you type and when you save. It works in VS Code 1.91 or later, and in VSCodium, Cursor and
Windsurf.

Without a server, the local checks still run. With one, the editor also shows the open issues of
your branch, the quality gate and the actions: rule descriptions, false positive, won't fix, and
the AI assistant.

## Install

| Where | How |
| --- | --- |
| VS Code | Install [Qualor from the Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=Qualor.qualor-vscode), or run `code --install-extension qualor.qualor-vscode` |
| VSCodium, Cursor, Windsurf | Install [Qualor from Open VSX](https://open-vsx.org/extension/qualor/qualor-vscode) |
| A closed network | Download the file of your platform from the [GitHub release](https://github.com/qualor-dev/qualor/releases), then run `code --install-extension <file>` or use **Install from VSIX** in the Extensions view |
| Remote-SSH, WSL, a dev container | Install it in the remote window. The extension runs on the remote host, so the file is the remote's platform |

The release has one file for each platform:

| File | Platform |
| --- | --- |
| `qualor-vscode-<version>-win32-x64.vsix` | Windows x64 |
| `qualor-vscode-<version>-darwin-arm64.vsix` | macOS on Apple silicon |
| `qualor-vscode-<version>-darwin-x64.vsix` | macOS on Intel |
| `qualor-vscode-<version>-linux-x64.vsix` | Linux x64 |
| `qualor-vscode-<version>-linux-arm64.vsix` | Linux arm64 |
| `qualor-vscode-<version>-universal.vsix` | any other platform: the server's issues only ([Other platforms](#other-platforms)) |

The Marketplace and Open VSX give each editor the file of its platform.

To verify a file, check the release's `SHA256SUMS` with Qualor's public key, then check the file
against it. Cosign needs `--insecure-ignore-tlog=true`, as in
[Install the server](https://qualor.dev/docs/install-server.md#images):

```sh
curl -fsSLO https://qualor.dev/cosign.pub
cosign verify-blob --key cosign.pub --insecure-ignore-tlog=true --bundle SHA256SUMS.bundle SHA256SUMS
sha256sum --ignore-missing -c SHA256SUMS
```

## Other platforms

Windows on Arm, Alpine and other platforms take the universal file. It holds the extension and
Qualor's CLI, but no engine and no rules pack.

- The server's issues, the actions and the Qualor view work.
- No local check runs. The **Local checks** view lists the engines as skipped.
- `qualor.enginesPath` can name a folder laid out like the bundled `engines` folder. Its engines
  then run. Qualor's own rules need a platform file.

## Sign in

1. Run **Qualor: Sign In**. If no server is set, the editor asks for its address and keeps it in
   your user settings (`qualor.serverUrl`).
2. Your browser opens the server. Sign in if needed, and allow the editor.
3. The editor shows **Signed in to `<host>` as `<you>`.** The tokens stay in VS Code's secret
   storage.

If the server does not offer browser sign-in, or you work in a browser-based editor, the editor
asks for a **personal access token** instead. Create one in Qualor under **Settings → Access
tokens** ([Tokens](https://qualor.dev/docs/users-projects-tokens.md#personal-tokens)). **Read** shows the issues. **Write**
is also needed to mark issues.

| Setting | Use |
| --- | --- |
| `qualor.serverUrl` | The server's address, such as `https://qualor.example.com`. Set it in a workspace to share it with the team |
| `qualor.caFile` | A PEM file with extra CA certificates, when the server's certificate comes from a private CA |

A workspace can name a server, and a repository can change that setting. The editor therefore asks
once, **This workspace connects Qualor to `<host>`**, before it sends your sign-in there. In a
workspace in Restricted Mode, Qualor checks files locally and connects after you trust it.

## Bind a folder to a project

A folder is bound to a Qualor project, and to a branch of it, before the server's issues show. The
editor looks for the project in this order:

1. `qualor.projectKey`.
2. `project.key` in the folder's `qualor.yml`.
3. The projects whose repository is the folder's git remote. When exactly one matches, it is used.
4. A picker of your projects: **Qualor: Select Project**.

Then it picks the branch: the one you have checked out, else a merge request from that branch, else
the project's main branch, shown as `showing main`.

The status bar item shows the state of the folder in view.

| Status bar | Meaning |
| --- | --- |
| `Qualor: <project> · <branch>` with a check | Connected. The tooltip has the server, the time of the last analysis and the reason when the branch is not yours |
| `Qualor: local only` | No server is set, the window is in Restricted Mode, or no folder is open. With no server set, click it to connect one |
| `Qualor: sign in` | A server is set, but you are not signed in |
| `Qualor: confirm server` | The workspace names a server you have not confirmed |
| `Qualor: limited` | The server is older than 0.18 ([Versions](#versions)) |
| `Qualor` with an error | The server cannot be reached, the project is not visible to you, or the analysis stopped. The tooltip says why. Click it for the output |

## What runs where

| Where | What | Languages | Needs |
| --- | --- | --- | --- |
| While you type | Qualor's code quality rules | C#, Java, Python, JavaScript, TypeScript, Go | Nothing |
| While you type | Gitleaks: leaked secrets | Every file | Nothing |
| While you type | Ruff | Python | Nothing |
| While you type | sonarjs | JavaScript, TypeScript | A trusted workspace |
| When you open or save a file | Qualor's security rules | [The languages of the rules](https://qualor.dev/docs/languages-and-analyzers.md) | Nothing. `qualor.securityRulesWhileTyping` runs them while you type |
| When you open or save a file | PMD | Java | A trusted workspace and Java 17 or newer |
| When you open or save a file | staticcheck and go vet | Go | A trusted workspace and the Go toolchain |
| From the server | The open issues of the branch's last analysis, from every analyzer that ran in your CI, including those the editor cannot run | All | Sign in |

- The engines come with the extension, except Java and Go, which are yours.
- PMD uses `JAVA_HOME`, else `java` on `PATH`. staticcheck and go vet use `GOROOT`, else `go` on
  `PATH`. A Java or Go inside the workspace is never run.
- staticcheck and go vet read the saved package. While a Go file has unsaved changes, they wait for
  the save.
- A problem found both locally and on the server shows once.
- The engines' versions are in [Languages and analyzers](https://qualor.dev/docs/languages-and-analyzers.md).

## The Qualor view

The Qualor icon in the Activity Bar opens the view. It has three sections.

| Section | What it shows |
| --- | --- |
| **Connection** | The server and its version, the project, the branch, the last analysis and the quality gate. A failed gate lists each failed condition |
| **Issues** | The open issues of the branch, grouped by file or by severity (**Group by Severity**, **Group by File**). **Show Only New Code** keeps the issues in new code, **Show All Code** brings back the rest |
| **Local checks** | The local engines that were skipped or blocked, each with its reason |

**Local checks** is hidden until a local check is skipped or blocked, or the analysis is not
running. Then it lists only those rows. **Qualor: Show Local Checks** lists every engine, with its
last file and time, until you press **Back to Problems Only** in the section's title bar.

Click an issue row to open the file at its line. Right-click it for **Open in Qualor**,
**Open Issue**, **Show Rule Description**, **Explain Issue**, **Mark as False Positive** and
**Mark as Won't Fix**. **Qualor: Open in Qualor** opens the branch in the server.

## Actions

Use the light bulb (the quick fixes) on a problem from the server, or the right-click menu of a row
in the Issues view. The menu has the command titles. The quick fixes start with `Qualor:`.

| Action | Quick fix | What happens |
| --- | --- | --- |
| **Show Rule Description** | `Show the description of <rule>` | Opens the rule's description in a tab |
| **Mark as False Positive**, **Mark as Won't Fix** | `Qualor: Mark as false positive`, `Qualor: Mark as won't fix` | Asks for a comment and changes the issue on the server. The issue then disappears from the editor. Trivy's findings cannot be marked from the editor |
| **Explain Issue** | `Qualor: Explain with AI` | Asks the [AI assistant](https://qualor.dev/docs/ai-assistant.md) and shows its explanation in a tab |
| **Suggest a Fix with AI** | `Qualor: Suggest a fix with AI` | Shows the fix as a diff. **Apply fix** replaces the lines in the file and leaves the edit unsaved, so undo works as always. **Discard** closes the diff |

- Marking an issue needs a role in the project that may triage it
  ([Roles and the audit log](https://qualor.dev/docs/roles-and-audit.md)).
- The AI actions appear when the AI assistant is on for the project's organisation and you may use
  it. The fix needs the organisation to allow fixes too.
- Signed in with the browser, you give the editor the optional permission to change issue statuses
  and use the AI assistant on the consent page ([Editor extensions](https://qualor.dev/docs/mcp.md#editor-extensions)).
  With a personal access token, the scope is **Write**.

The other way round, an issue's page in Qualor has an **Open in VS Code** button. It opens the file
at the line in your editor, in the folder bound to that project.

## Settings

Open **Settings** and search for `qualor`.

| Setting | Default | Scope | Meaning |
| --- | --- | --- | --- |
| `qualor.serverUrl` | empty | Resource | Address of your Qualor server. Empty checks files locally only |
| `qualor.projectKey` | empty | Resource | The project's key. Empty uses the key in `qualor.yml`, or finds the project from the git remote |
| `qualor.caFile` | empty | Machine | A PEM file with extra CA certificates for your server |
| `qualor.localAnalysis.qualor` | on | Resource | Qualor's security rules |
| `qualor.localAnalysis.quality` | on | Resource | Qualor's code quality rules |
| `qualor.localAnalysis.sonarjs` | on | Resource | sonarjs for JavaScript and TypeScript (trusted workspaces only) |
| `qualor.localAnalysis.gitleaks` | on | Resource | Leaked secrets |
| `qualor.localAnalysis.ruff` | on | Resource | Ruff for Python |
| `qualor.localAnalysis.pmd` | on | Resource | PMD for Java, on open and save (trusted workspaces only; Java 17 or newer) |
| `qualor.localAnalysis.staticcheck` | on | Resource | staticcheck for Go, on open and save (trusted workspaces only; the Go toolchain) |
| `qualor.localAnalysis.govet` | on | Resource | go vet for Go, on open and save (trusted workspaces only; the Go toolchain) |
| `qualor.securityRulesWhileTyping` | off | Resource | Run Qualor's security rules while you type. When off, they run when you save |
| `qualor.enginesPath` | empty | Machine | A folder with your own engines, laid out like the bundled `engines` folder (`opengrep`, `gitleaks`, `ruff`, `ast-grep`, `sonarjs/`, `pmd/`, `staticcheck`, `golang/run.mjs`). It is used instead of the bundled ones |
| `qualor.cliPath` | empty | Machine | A Qualor CLI to run instead of the bundled one |
| `qualor.trace.server` | `off` | Window | `messages` or `verbose` logs the messages between the editor and Qualor, for troubleshooting |

The extension also reads the folder's `qualor.yml`, so the editor and your CI use the same
configuration. In Restricted Mode, the editor ignores `qualor.serverUrl`, `qualor.projectKey`,
`qualor.caFile`, `qualor.enginesPath` and `qualor.cliPath` until you trust the workspace.

The extension runs Qualor's CLI as JavaScript on the editor's own runtime, so it installs no
`qualor` program. **Qualor: Show Output** shows its log. The log never holds a token.

## Versions

The extension's version is Qualor's version.

| Server | What works |
| --- | --- |
| 0.18 or later | Everything, with browser sign-in or a personal access token |
| 0.16 and 0.17 | A personal access token only, and connected mode is limited. The status bar says `limited` |
| Older than 0.16 | Local analysis only |

When your CI analysed the branch with another Qualor release than the editor's, the editor tells
you once: **Your CI analysed this branch with Qualor `<release>`; the editor runs `<release>`'s
rules**. Keep the scanner and the extension on the same release.

Qualor signs the Windows programs it ships. Windows shows the publisher as `Gurfing Oy`.

## Privacy

The extension sends no telemetry. It talks only to the server you configured, and it adds no other
network call. Tokens are kept in VS Code's secret storage.

## Troubleshooting

Run **Qualor: Show Output** first. Find the message you see:

| Symptom | Cause | Fix |
| --- | --- | --- |
| `<host> does not offer browser sign-in.` | The server has no public address (`QUALOR_PUBLIC_URL`), so sign-in through the browser is off | Use a personal access token. An administrator can set `QUALOR_PUBLIC_URL` ([MCP server](https://qualor.dev/docs/mcp.md#requirements)) |
| `This server does not allow editors to register.`, or "The administrator of this server does not allow this app." in the browser | The administrator restricts which apps may sign in | The administrator adds the prefix `https://qualor.dev/clients/vscode/` to **Allowed apps** in **Settings → MCP** ([For administrators](https://qualor.dev/docs/mcp.md#for-administrators)), or you use a personal access token |
| `Windows blocked opengrep.exe (Smart App Control or an application control policy)` | OpenGrep, which runs Qualor's security rules, unpacks its core program when it starts, and that program is not signed yet, so Smart App Control refuses it | Turn off `qualor.localAnalysis.qualor`. The other local checks keep running, and the server still checks the security rules on every scan |
| `Windows blocked <file> (Smart App Control or an application control policy)` | A company application control policy does not trust the publisher of the program | The administrator allows the publisher `Gurfing Oy`. Or turn off the `qualor.localAnalysis.*` settings: the server's issues still show |
| `PMD needs Java 17 or newer: …`, and the other Java reasons | No Java 17 or newer, or the `JAVA_HOME` found lies inside the workspace | Set `JAVA_HOME`, or put `java` on `PATH`, outside the workspace |
| `staticcheck and go vet need the Go toolchain: …`, and the other Go reasons | No Go toolchain, or the `GOROOT` found lies inside the workspace | Set `GOROOT`, or put `go` on `PATH`, outside the workspace |
| `the file has unsaved changes; staticcheck and go vet check it once it is saved` | The Go checks read the saved package | Save the file |
| `<engine> runs in trusted workspaces only` | The window is in Restricted Mode | Trust the workspace |
| `This Qualor extension has no CLI. Reinstall it, or set qualor.cliPath to a Qualor CLI.` | The install is damaged | Reinstall the extension, or set `qualor.cliPath` |
| `Qualor's analysis stopped: qualor.cliPath runs Qualor …, and this extension (…) needs …` | `qualor.cliPath` names a CLI of another release | Use the CLI of the extension's release, or clear the setting |
| `Qualor <version> on <server>: connected mode is limited until the server is upgraded to 0.18` | The server is older than 0.18 | Sign in with a personal access token, or upgrade the server |
| `Cannot reach <server> (…); local analysis still runs` | The editor cannot reach the server | Check the address, the network and the proxy. For a private CA, set `qualor.caFile` |
| `Project <key> is not visible to you on <server>` | The key is wrong, or your account has no access to the project | Fix `qualor.projectKey` or `project.key`, or ask for access |
| Engines are missing or skipped without a reason you can use | `qualor.enginesPath` is wrong, or antivirus removed a program | Fix or clear the setting, or reinstall the extension |
| Every local check is skipped | The universal file is installed | Install the file of your platform ([Other platforms](#other-platforms)) |

Without a fix here, open an issue at
[github.com/qualor-dev/qualor](https://github.com/qualor-dev/qualor/issues) with the output of
**Qualor: Show Output**. Set `qualor.trace.server` to `messages` first if the problem is in the
messages.