# lint a file or multiple
squawk migration_001.sql migration_002.sql migration_003.sql
# lint from standard in
cat migration.sql | squawk


Individual rules can be disabled via the --exclude flag

squawk --exclude=adding-field-with-default,disallowed-unique-constraint example.sql

.squawk.toml configuration file#

Rules can be disabled with a configuration file.

By default, Squawk will traverse up from the current directory to find a .squawk.toml configuration file. You may specify a custom path with the -c or --config flag.

squawk --config=~/.squawk.toml example.sql

The --exclude and --pg-version flags will always be prioritized over the configuration file.

example .squawk.toml configurations#

excluding rules#

# .squawk.toml
excluded_rules = [

specifying postgres version#

# .squawk.toml
pg_version = "11.0"

specifying whether SQL files will be wrapped in a transaction#

# .squawk.toml
assume_in_transaction = true

using all options#

# .squawk.toml
pg_version = "11.0"
excluded_rules = [
assume_in_transaction = true

See the Squawk website for documentation on each rule with examples and reasoning.

squawk --help#

Find problems in your SQL
squawk [FLAGS] [OPTIONS] [path]... [SUBCOMMAND]
Assume that a transaction will wrap each SQL file when run by a migration tool
Use --no-assume-in-transaction to override any config file that sets this
-h, --help
Prints help information
List all available rules
-V, --version
Prints version information
Enable debug logging output
-c, --config <config-path>
Path to the squawk config file (.squawk.toml)
--dump-ast <ast-format>
Output AST in JSON [possible values: Raw, Parsed, Debug]
-e, --exclude <rule>...
Exclude specific warnings
For example: --exclude=require-concurrent-index-creation,ban-drop-database
--explain <rule>
Provide documentation on the given rule
--pg-version <pg-version>
Specify postgres version
For example: --pg-version=13.0
--reporter <reporter>
Style of error reporting [possible values: Tty, Gcc, Json]
--stdin-filepath <filepath>
Path to use in reporting for stdin
Paths to search
help Prints this message or the help of the given subcommand(s)
upload-to-github Comment on a PR with Squawk's results