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

# dbt™ Script Checks

> Pre-commit hooks for dbt™️ script validation enforce SQL formatting, syntax standards, and best practices. Check query structure, indentation, and coding style to maintain consistent SQL quality.

## `check-script-ref-and-source`

<Info>
  **What it does**

  Ensures that the script contains only existing sources or macros.

  **When to use it**

  Make sure you have only valid ref and sources in your script and you do not want to wait for `dbt run` to find them. This hook also finds all missing ref and sources, not find first missing only.
</Info>

**Arguments**

`--manifest`: location of `manifest.json` file. Usually `target/manifest.json`. This file contains a full representation of dbt project. **Default: `target/manifest.json`**

**Example**

```yaml theme={"system"}
repos:
<strong>  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
</strong>    rev: v1.0.0
    hooks:
      - id: check-script-ref-and-source
```

**Requirements**

| Model exists in `manifest.json` 1 | Model exists in `catalog.json` 2 |
| :-------------------------------: | :------------------------------: |
|               ✅ Yes               |           ❌ Not needed           |

1 It means that you need to run `dbt parse` before run this hook (dbt >= 1.5).\
2 It means that you need to run `dbt docs generate` before run this hook.

## `check-script-semicolon`

<Info>
  **What it does**

  Ensure that the script does not have a semicolon at the end of the file.

  **When to use it**

  Make sure you did not provide a semicolon at the end of the file.
</Info>

**Example**

```yaml theme={"system"}
repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: check-script-semicolon
```

**How it works**

* Hook takes all changed `SQL` files.
* It parses `SQL` and finds all sources and refs. If those objects do not exist in `manifest.json`, the hook fails.

***

**Requirements**

| Model exists in `manifest.json` 1 | Model exists in `catalog.json` 2 |
| :-------------------------------: | :------------------------------: |
|               ✅ Yes               |           ❌ Not needed           |

1 It means that you need to run `dbt parse` before run this hook (dbt >= 1.5).\
2 It means that you need to run `dbt docs generate` before run this hook.

**How it works**

* Hook takes all changed `SQL` files.
* If the file contains a semicolon at the end of the file, the hook fails.

***

## `check-script-has-no-table-name`

<Info>
  **What it does**

  Ensures that the script is using only source or ref macro to specify the table name.

  **When to use it**

  To make sure that you have only refs and sources in your `SQL` files.
</Info>

**Arguments**

`--ignore-dotless-table`: consider all tables without dot in name as CTE

**Example**

```yaml theme={"system"}
repos:
  - repo: https://github.com/dbt-checkpoint/dbt-checkpoint
    rev: v1.0.0
    hooks:
      - id: check-script-has-no-table-name
```

**Requirements**

| Model exists in `manifest.json` 1 | Model exists in `catalog.json` 2 |
| :-------------------------------: | :------------------------------: |
|            ❌ Not needed           |           ❌ Not needed           |

1 It means that you need to run `dbt parse` before run this hook (dbt >= 1.5).\
2 It means that you need to run `dbt docs generate` before run this hook.

**How it works**

* Hook takes all changed `SQL` files.
* `SQL` is parsed and if it contains direct tables (not ref() or source()), the hook fails.


## Related topics

- [dbt™-checkpoint Hooks](/integrations/pre-commit/dbt-tm-checkpoint-hooks/index.md)
- [dbt™ Checks](/integrations/pre-commit/dbt-tm-checkpoint-hooks/dbt-tm-checks.md)
- [dbt™ Model Checks](/integrations/pre-commit/dbt-tm-checkpoint-hooks/dbt-tm-model-checks.md)
- [dbt™ Source Checks](/integrations/pre-commit/dbt-tm-checkpoint-hooks/dbt-tm-source-checks.md)
- [dbt™ Macro Checks](/integrations/pre-commit/dbt-tm-checkpoint-hooks/dbt-tm-macro-checks.md)
