@cli.command()
@common_options
@core_options
@click.option('-f', '--format', 'format', default='human', type=click.Choice(['human', 'json', 'yaml'], case_sensitive=False), help='What format to return the lint result in.')
@click.option('--nofail', is_flag=True, help='If set, the exit code will always be zero, regardless of violations found. This is potentially useful during rollout.')
@click.option('--disregard-sqlfluffignores', is_flag=True, help='Perform the operation regardless of .sqlfluffignore configurations')
@click.option('-p', '--parallel', type=int, default=1, help='If set to a value higher than 1, run SQLFluff in parallel, speeding up processing.')
@click.argument('paths', nargs=(- 1))
def lint(paths, parallel, format, nofail, disregard_sqlfluffignores, logger=None, bench=False, **kwargs):
    "Lint SQL files via passing a list of files or using stdin.\n\n    PATH is the path to a sql file or directory to lint. This can be either a\n    file ('path/to/file.sql'), a path ('directory/of/sql/files'), a single ('-')\n    character to indicate reading from *stdin* or a dot/blank ('.'/' ') which will\n    be interpreted like passing the current working directory as a path argument.\n\n    Linting SQL files:\n\n        sqlfluff lint path/to/file.sql\n        sqlfluff lint directory/of/sql/files\n\n    Linting a file via stdin (note the lone '-' character):\n\n        cat path/to/file.sql | sqlfluff lint -\n        echo 'select col from tbl' | sqlfluff lint -\n\n    "
    c = get_config(**kwargs)
    non_human_output = (format in ('json', 'yaml'))
    (lnt, formatter) = get_linter_and_formatter(c, silent=non_human_output)
    verbose = c.get('verbose')
    formatter.dispatch_config(lnt)
    set_logging_level(verbosity=verbose, logger=logger, stderr_output=non_human_output)
    if (('-',) == paths):
        result = lnt.lint_string_wrapped(sys.stdin.read(), fname='stdin')
    else:
        if (verbose >= 1):
            click.echo(format_linting_result_header())
        try:
            result = lnt.lint_paths(paths, ignore_non_existent_files=False, ignore_files=(not disregard_sqlfluffignores), parallel=parallel)
        except IOError:
            click.echo(colorize('The path(s) {0!r} could not be accessed. Check it/they exist(s).'.format(paths), 'red'))
            sys.exit(1)
        if (verbose >= 1):
            click.echo(format_linting_stats(result, verbose=verbose))
    if (format == 'json'):
        click.echo(json.dumps(result.as_records()))
    elif (format == 'yaml'):
        click.echo(yaml.dump(result.as_records()))
    if bench:
        click.echo('==== overall timings ====')
        timing_summary = result.timing_summary()
        for step in timing_summary:
            click.echo(f'=== {step} ===')
            click.echo(cli_table(timing_summary[step].items()))
    if (not nofail):
        if (not non_human_output):
            click.echo('All Finished 📜 🎉!')
        sys.exit(result.stats()['exit code'])
    else:
        sys.exit(0)
Lint SQL files via passing a list of files or using stdin.

PATH is the path to a sql file or directory to lint. This can be either a
file ('path/to/file.sql'), a path ('directory/of/sql/files'), a single ('-')
character to indicate reading from *stdin* or a dot/blank ('.'/' ') which will
be interpreted like passing the current working directory as a path argument.

Linting SQL files:

    sqlfluff lint path/to/file.sql
    sqlfluff lint directory/of/sql/files

Linting a file via stdin (note the lone '-' character):

    cat path/to/file.sql | sqlfluff lint -
    echo 'select col from tbl' | sqlfluff lint -
@cli.command()
@common_options
@core_options
@click.option('-f', '--format', 'format', default='human', type=click.Choice(['human', 'json', 'yaml'], case_sensitive=False), help='What format to return the lint result in.')
@click.option('--nofail', is_flag=True, help='If set, the exit code will always be zero, regardless of violations found. This is potentially useful during rollout.')
@click.option('--disregard-sqlfluffignores', is_flag=True, help='Perform the operation regardless of .sqlfluffignore configurations')
@click.option('-p', '--parallel', type=int, default=1, help='If set to a value higher than 1, run SQLFluff in parallel, speeding up processing.')
@click.argument('paths', nargs=(- 1))
def lint(paths, parallel, format, nofail, disregard_sqlfluffignores, logger=None, bench=False, **kwargs):
    "Lint SQL files via passing a list of files or using stdin.\n\n    PATH is the path to a sql file or directory to lint. This can be either a\n    file ('path/to/file.sql'), a path ('directory/of/sql/files'), a single ('-')\n    character to indicate reading from *stdin* or a dot/blank ('.'/' ') which will\n    be interpreted like passing the current working directory as a path argument.\n\n    Linting SQL files:\n\n        sqlfluff lint path/to/file.sql\n        sqlfluff lint directory/of/sql/files\n\n    Linting a file via stdin (note the lone '-' character):\n\n        cat path/to/file.sql | sqlfluff lint -\n        echo 'select col from tbl' | sqlfluff lint -\n\n    "
    c = get_config(**kwargs)
    non_human_output = (format in ('json', 'yaml'))
    (lnt, formatter) = get_linter_and_formatter(c, silent=non_human_output)
    verbose = c.get('verbose')
    formatter.dispatch_config(lnt)
    set_logging_level(verbosity=verbose, logger=logger, stderr_output=non_human_output)
    if (('-',) == paths):
        result = lnt.lint_string_wrapped(sys.stdin.read(), fname='stdin')
    else:
        if (verbose >= 1):
            click.echo(format_linting_result_header())
        try:
            result = lnt.lint_paths(paths, ignore_non_existent_files=False, ignore_files=(not disregard_sqlfluffignores), parallel=parallel)
        except IOError:
            click.echo(colorize('The path(s) {0!r} could not be accessed. Check it/they exist(s).'.format(paths), 'red'))
            sys.exit(1)
        if (verbose >= 1):
            click.echo(format_linting_stats(result, verbose=verbose))
    if (format == 'json'):
        click.echo(json.dumps(result.as_records()))
    elif (format == 'yaml'):
        click.echo(yaml.dump(result.as_records()))
    if bench:
        click.echo('==== overall timings ====')
        timing_summary = result.timing_summary()
        for step in timing_summary:
            click.echo(f'=== {step} ===')
            click.echo(cli_table(timing_summary[step].items()))
    if (not nofail):
        if (not non_human_output):
            click.echo('All Finished 📜 🎉!')
        sys.exit(result.stats()['exit code'])
    else:
        sys.exit(0)