How to use the autohooks.api.out function in autohooks

To help you get started, we’ve selected a few autohooks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github greenbone / autohooks / autohooks / plugins / black.py View on Github external
def precommit():
    out('Running black pre-commit hook')

    check_black_installed()

    files = [f for f in get_staged_status() if is_python_path(f.path)]

    if len(files) == 0:
        out('No staged files for black available')
        return 0

    out('Running black on {}'.format(', '.join([str(f.path) for f in files])))

    with stash_unstaged_changes(files):
        for f in files:
            subprocess.check_call(['black', '-q', str(f.absolute_path())])

        stage_files_from_status_list(files)
github greenbone / autohooks / autohooks / plugins / black.py View on Github external
def precommit():
    out('Running black pre-commit hook')

    check_black_installed()

    files = [f for f in get_staged_status() if is_python_path(f.path)]

    if len(files) == 0:
        out('No staged files for black available')
        return 0

    out('Running black on {}'.format(', '.join([str(f.path) for f in files])))

    with stash_unstaged_changes(files):
        for f in files:
            subprocess.check_call(['black', '-q', str(f.absolute_path())])

        stage_files_from_status_list(files)

    return 0
github greenbone / autohooks / autohooks / plugins / black.py View on Github external
def precommit():
    out('Running black pre-commit hook')

    check_black_installed()

    files = [f for f in get_staged_status() if is_python_path(f.path)]

    if len(files) == 0:
        out('No staged files for black available')
        return 0

    out('Running black on {}'.format(', '.join([str(f.path) for f in files])))

    with stash_unstaged_changes(files):
        for f in files:
            subprocess.check_call(['black', '-q', str(f.absolute_path())])

        stage_files_from_status_list(files)

    return 0
github greenbone / autohooks / autohooks / plugins / pylint.py View on Github external
def precommit():
    out('Running pylint pre-commit hook')

    check_pylint_installed()

    files = [f for f in get_staged_status() if is_python_path(f.path)]

    with stash_unstaged_changes(files):
        args = ['pylint']
        args.extend([str(f.absolute_path()) for f in files])

        return subprocess.call(args)