Skip to content

Commit a1dc69a

Browse files
authored
docs: add notes about ignoring errors via comment (#448)
With v2 we can ignore errors via the `squawk-ignore` comment.
1 parent ac38018 commit a1dc69a

File tree

2 files changed

+40
-8
lines changed

2 files changed

+40
-8
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,22 @@ Individual rules can be disabled via the `--exclude` flag
159159
squawk --exclude=adding-field-with-default,disallowed-unique-constraint example.sql
160160
```
161161
162+
### Disabling rules via comments
163+
164+
Rule violations can be ignored via the `squawk-ignore` comment:
165+
166+
```sql
167+
-- squawk-ignore ban-drop-column
168+
alter table t drop column c cascade;
169+
```
170+
171+
You can also ignore multiple rules by making a comma seperated list:
172+
173+
```sql
174+
-- squawk-ignore ban-drop-column, renaming-column,ban-drop-database
175+
alter table t drop column c cascade;
176+
```
177+
162178
### Configuration file
163179
164180
Rules can also be disabled with a configuration file.

docs/docs/cli.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ id: cli
33
title: CLI
44
---
55

6-
## usage
6+
## Usage
77

88
```bash
99
# lint a file or multiple
@@ -13,15 +13,31 @@ squawk migration_001.sql migration_002.sql migration_003.sql 'migrations/*.sql'
1313
cat migration.sql | squawk
1414
```
1515

16-
## rules
16+
## Rules
1717

1818
Individual rules can be disabled via the `--exclude` flag
1919

2020
```shell
2121
squawk --exclude=adding-field-with-default,disallowed-unique-constraint example.sql
2222
```
2323

24-
## files
24+
### Disabling rules via comments
25+
26+
Rule violations can be ignored via the `squawk-ignore` comment:
27+
28+
```sql
29+
-- squawk-ignore ban-drop-column
30+
alter table t drop column c cascade;
31+
```
32+
33+
You can also ignore multiple rules by making a comma seperated list:
34+
35+
```sql
36+
-- squawk-ignore ban-drop-column, renaming-column,ban-drop-database
37+
alter table t drop column c cascade;
38+
```
39+
40+
## Files
2541

2642
Files can be excluded from linting via the `--exclude-path` flag. Glob matching is supported and the flag can be provided multiple times.
2743

@@ -41,9 +57,9 @@ squawk --config=~/.squawk.toml example.sql
4157

4258
The `--exclude`, `--exclude-path`, and `--pg-version` flags will always be prioritized over the configuration file.
4359

44-
## example `.squawk.toml` configurations
60+
## Example `.squawk.toml` configurations
4561

46-
### excluding rules
62+
### Excluding rules
4763

4864
```toml
4965
# .squawk.toml
@@ -53,21 +69,21 @@ excluded_rules = [
5369
]
5470
```
5571

56-
### specifying postgres version
72+
### Specifying postgres version
5773

5874
```toml
5975
# .squawk.toml
6076
pg_version = "11.0"
6177
```
6278

63-
### specifying whether SQL files will be wrapped in a transaction
79+
### Specifying whether SQL files will be wrapped in a transaction
6480

6581
```toml
6682
# .squawk.toml
6783
assume_in_transaction = true
6884
```
6985

70-
### using all options
86+
### Using all options
7187

7288
```toml
7389
# .squawk.toml

0 commit comments

Comments
 (0)