mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Remove deprecated pcre language
This commit is contained in:
parent
3fadbefab9
commit
97e3371046
9 changed files with 18 additions and 139 deletions
|
|
@ -82,14 +82,6 @@ def _subtle_line(s, use_color):
|
|||
def _run_single_hook(classifier, hook, skips, cols, verbose, use_color):
|
||||
filenames = classifier.filenames_for_hook(hook)
|
||||
|
||||
if hook.language == 'pcre':
|
||||
logger.warning(
|
||||
'`{}` (from {}) uses the deprecated pcre language.\n'
|
||||
'The pcre language is scheduled for removal in pre-commit 2.x.\n'
|
||||
'The pygrep language is a more portable (and usually drop-in) '
|
||||
'replacement.'.format(hook.id, hook.src),
|
||||
)
|
||||
|
||||
if hook.id in skips or hook.alias in skips:
|
||||
output.write(
|
||||
get_hook_message(
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ from pre_commit.languages import docker_image
|
|||
from pre_commit.languages import fail
|
||||
from pre_commit.languages import golang
|
||||
from pre_commit.languages import node
|
||||
from pre_commit.languages import pcre
|
||||
from pre_commit.languages import pygrep
|
||||
from pre_commit.languages import python
|
||||
from pre_commit.languages import python_venv
|
||||
|
|
@ -59,7 +58,6 @@ languages = {
|
|||
'fail': fail,
|
||||
'golang': golang,
|
||||
'node': node,
|
||||
'pcre': pcre,
|
||||
'pygrep': pygrep,
|
||||
'python': python,
|
||||
'python_venv': python_venv,
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import sys
|
||||
|
||||
from pre_commit.languages import helpers
|
||||
from pre_commit.xargs import xargs
|
||||
|
||||
|
||||
ENVIRONMENT_DIR = None
|
||||
GREP = 'ggrep' if sys.platform == 'darwin' else 'grep'
|
||||
get_default_version = helpers.basic_get_default_version
|
||||
healthy = helpers.basic_healthy
|
||||
install_environment = helpers.no_install
|
||||
|
||||
|
||||
def run_hook(hook, file_args, color):
|
||||
# For PCRE the entry is the regular expression to match
|
||||
cmd = (GREP, '-H', '-n', '-P') + tuple(hook.args) + (hook.entry,)
|
||||
|
||||
# Grep usually returns 0 for matches, and nonzero for non-matches so we
|
||||
# negate it here.
|
||||
return xargs(cmd, file_args, negate=True, color=color)
|
||||
|
|
@ -149,7 +149,7 @@ def _hook(*hook_dicts, **kwargs):
|
|||
def _non_cloned_repository_hooks(repo_config, store, root_config):
|
||||
def _prefix(language_name, deps):
|
||||
language = languages[language_name]
|
||||
# pcre / pygrep / script / system / docker_image do not have
|
||||
# pygrep / script / system / docker_image do not have
|
||||
# environments so they work out of the current directory
|
||||
if language.ENVIRONMENT_DIR is None:
|
||||
return Prefix(os.getcwd())
|
||||
|
|
|
|||
|
|
@ -107,11 +107,9 @@ def xargs(cmd, varargs, **kwargs):
|
|||
"""A simplified implementation of xargs.
|
||||
|
||||
color: Make a pty if on a platform that supports it
|
||||
negate: Make nonzero successful and zero a failure
|
||||
target_concurrency: Target number of partitions to run concurrently
|
||||
"""
|
||||
color = kwargs.pop('color', False)
|
||||
negate = kwargs.pop('negate', False)
|
||||
target_concurrency = kwargs.pop('target_concurrency', 1)
|
||||
max_length = kwargs.pop('_max_length', _get_platform_max_length())
|
||||
cmd_fn = cmd_output_p if color else cmd_output_b
|
||||
|
|
@ -135,8 +133,6 @@ def xargs(cmd, varargs, **kwargs):
|
|||
results = thread_map(run_cmd_partition, partitions)
|
||||
|
||||
for proc_retcode, proc_out, _ in results:
|
||||
if negate:
|
||||
proc_retcode = not proc_retcode
|
||||
retcode = max(retcode, proc_retcode)
|
||||
stdout += proc_out
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue