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.main()[source]
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 (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.

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.show_rule(name)[source]

Print information about rule named name.

squabble.cli.list_rules()[source]

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

squabble.cli.explain_message(code)[source]

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

squabble.cli.list_presets()[source]

Print out all the preset configurations.