squabble.cli module

squabble [options] [PATHS…] squabble (-h | –help)
PATHS Paths to check. If given a directory, will recursively traverse the
path and lint all files ending in .sql [default: -].

-h –help Show this screen. -V –verbose Turn on debug level logging. -v –version Show version information.

-x –expanded Show explantions for every raised message.

-c –config=PATH Path to configuration file. -p –preset=PRESETS Comma-separated list of presets to use as a base. -r –reporter=REPORTER Use REPORTER for output rather than one in config.

-e –explain=CODE Show detailed explanation of a message code. –list-presets List available preset configurations. –list-rules List available rules. –show-rule=RULE Show detailed information about RULE.


Handle the command line arguments as parsed by docopt. Calls the subroutine implied by the combination of command line flags and returns the exit status (or None, if successful) of the program.

Note that some exceptional conditions will terminate the program directly.

squabble.cli.run_linter(base_config, paths, expanded)[source]

Run linter against all SQL files contained in paths.

paths may contain both files and directories.

If paths is empty or only contains "-", squabble will read from stdin instead.

If expanded is True, print the detailed explanation of each message after the lint has finished.


Given a list of files or directories, find all named files as well as any files ending in .sql in the directories.

The return format is a list of tuples containing the file name and file contents.

The value '-' is treated specially as stdin.


Print information about rule named name.


Print out all registered rules and brief description of what they do.


Print out the more detailed explanation of the given message code.


Print out all the preset configurations.