Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
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
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
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)