> ## Documentation Index
> Fetch the complete documentation index at: https://glua.bluejutzu.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# GLua Diagnostic Rules Reference

> Complete reference for every diagnostic rule in GLua Language Server, including what each rule catches and how to configure its severity level.

GLua Language Server ships with built-in diagnostics that catch common mistakes in Garry's Mod Lua. Each rule can be set to `off`, `warning`, or `error` inside your `.glua.json` file. This page lists every rule, grouped by the area it covers.

<AccordionGroup>
  <Accordion title="Globals">
    | Rule              | Description                                                                                                                                  |
    | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
    | `undefinedGlobal` | Flags undefined globals. Respects optional-addon guards so shared code that branches on addon availability does not trigger false positives. |
    | `unusedLocal`     | Flags local variables that are declared but never read.                                                                                      |
  </Accordion>

  <Accordion title="Realms">
    | Rule             | Description                                                                                                                            |
    | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
    | `realmViolation` | Flags calls to API that does not exist in the current realm. For example, calling a serverside-only function inside a clientside file. |
  </Accordion>

  <Accordion title="Net messages">
    | Rule                   | Description                                                                                                                   |
    | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
    | `net-unregistered`     | Flags `net.Start` with a string that has no matching `net.Receive` registration anywhere in the workspace.                    |
    | `net-no-send`          | Flags a `net.Start` block that never calls a send method, so the message is constructed but never transmitted.                |
    | `net-no-receiver`      | Flags `net.Receive` for a message name that nothing in the workspace ever sends.                                              |
    | `net-payload-mismatch` | Flags when the sequence of `net.Write*` calls in the sender does not match the sequence of `net.Read*` calls in the receiver. |
  </Accordion>

  <Accordion title="Hooks">
    | Rule               | Description                                                                                                                |
    | ------------------ | -------------------------------------------------------------------------------------------------------------------------- |
    | `hook-typo`        | Flags a hook name that is not found in the wiki. Offers a quick fix based on edit-distance to the closest known hook name. |
    | `hook-extra-param` | Flags when a hook callback declares more parameters than the hook is documented to pass.                                   |
  </Accordion>

  <Accordion title="API">
    | Rule             | Description                                                                                        |
    | ---------------- | -------------------------------------------------------------------------------------------------- |
    | `deprecated`     | Flags use of API marked deprecated in the Garry's Mod wiki.                                        |
    | `argument-count` | Flags calls that pass the wrong number of arguments, including when overloads are available.       |
    | `argument-type`  | Flags arguments whose type does not match the documented signature, including overload resolution. |
  </Accordion>

  <Accordion title="Files">
    | Rule                      | Description                                                                                                                                      |
    | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
    | `include-no-addcsluafile` | Flags a clientside `include` of a file that is never sent to the client via `AddCSLuaFile`. A quick fix is available to insert the missing call. |
  </Accordion>
</AccordionGroup>

## Setting severity

You can tune every rule in `.glua.json`. The `diagnostics` block accepts `off`, `warning`, or `error` for each rule name.

```json theme={null}
{
  "diagnostics": {
    "undefinedGlobal": "error",
    "unusedLocal": "warning",
    "realmViolation": "error",
    "net-unregistered": "warning",
    "net-no-send": "error",
    "net-no-receiver": "off",
    "net-payload-mismatch": "error",
    "hook-typo": "warning",
    "hook-extra-param": "warning",
    "deprecated": "warning",
    "argument-count": "error",
    "argument-type": "error",
    "include-no-addcsluafile": "warning"
  }
}
```

<Info>
  If a rule is omitted, the server uses its built-in default. You only need to list rules you want to override.
</Info>


## Related topics

- [Inline Diagnostic Suppressions for GLua](/configuration/suppressions.md)
- [GLua Annotation Reference](/reference/annotations.md)
- [GLua Language Server Performance](/reference/performance.md)
- [GLua Language Server: GMod Lua IDE Support](/index.md)
