Skip to content

Commit

Permalink
Adds information about custom .sqlfluff and .sqlfluffignore files (#3928
Browse files Browse the repository at this point in the history
)

## What are you changing in this pull request and why?
The current docs are a bit unclear about the fact that we now support
custom `.sqlfluff` and `.sqlfluffignore` files. This PR adds that
information, as well as links to docs and resources to configure them.

This changes comes from responding to customer questions.

## Checklist
  • Loading branch information
mirnawong1 committed Aug 16, 2023
2 parents 49cbdb9 + 2e9ebea commit 66eccd1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions website/docs/docs/cloud/dbt-cloud-ide/lint-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ With the dbt Cloud IDE, you can seamlessly use [SQLFluff](https://sqlfluff.com/)

### Customize linting

SQLFluff is a configurable SQL linter, which means you can configure your own linting rules instead of using the default linting settings in the IDE.
SQLFluff is a configurable SQL linter, which means you can configure your own linting rules instead of using the default linting settings in the IDE. You can exclude files and directories by using a standard `.sqlfluffignore` file. Learn more about the syntax in the [.sqlfluffignore syntax docs](https://docs.sqlfluff.com/en/stable/configuration.html#id2).

To configure your own linting rules:

Expand All @@ -76,7 +76,7 @@ To configure your own linting rules:

:::tip Configure dbtonic linting rules

Use the following code example to incorporate well-written dbt code (or dbtonic) to your linting:
Refer to the [SQLFluff config file](https://github.com/dbt-labs/jaffle-shop-template/blob/main/.sqlfluff) to add the dbt code (or dbtonic) rules we use for our own projects:

<details>
<summary>dbtonic config code example provided by dbt Labs</summary>
Expand Down Expand Up @@ -122,6 +122,8 @@ capitalisation_policy = lower
group_by_and_order_by_style = implicit
```
</details>

For more info on styling best practices, refer to [How we style our SQL](/guides/best-practices/how-we-style/2-how-we-style-our-sql).
:::

<Lightbox src="/img/docs/dbt-cloud/cloud-ide/ide-sqlfluff-config.jpg" width="95%" title="Customize linting by configuring your own linting code rules, including dbtonic linting/styling."/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ id: 2-how-we-style-our-sql
## Basics

- ☁️ Use [SQLFluff](https://sqlfluff.com/) to maintain these style rules automatically.
- Reference this [SQLFluff config file](https://github.com/dbt-labs/jaffle-shop-template/blob/main/.sqlfluff) for the rules we use.
- Customize `.sqlfluff` configuration files to your needs.
- Refer to our [SQLFluff config file](https://github.com/dbt-labs/jaffle-shop-template/blob/main/.sqlfluff) for the rules we use in our own projects.

- Exclude files and directories by using a standard `.sqlfluffignore` file. Learn more about the syntax in the [.sqlfluffignore syntax docs](https://docs.sqlfluff.com/en/stable/configuration.html#id2).
- 👻 Use Jinja comments (`{# #}`) for comments that should not be included in the compiled SQL.
- ⏭️ Use trailing commas.
- 4️⃣ Indents should be four spaces.
Expand Down

0 comments on commit 66eccd1

Please sign in to comment.