squabble.cli module¶
- Usage:
- squabble [options] [PATHS…] squabble (-h | –help)
- Arguments:
- PATHS Paths to check. If given a directory, will recursively traverse the
- path and lint all files ending in .sql [default: -].
- Options:
-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.
-
squabble.cli.
dispatch_args
(args)[source]¶ 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 (orNone
, 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
isTrue
, print the detailed explanation of each message after the lint has finished.
-
squabble.cli.
collect_files
(paths)[source]¶ 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.
-
squabble.cli.
list_rules
()[source]¶ Print out all registered rules and brief description of what they do.