diff --git a/c2cciutils/__init__.py b/c2cciutils/__init__.py index 2f6018866..a2b1b176d 100644 --- a/c2cciutils/__init__.py +++ b/c2cciutils/__init__.py @@ -232,7 +232,7 @@ def get_config() -> c2cciutils.configuration.Configuration: }, "classifiers": ["Typing :: Typed"], }, - "prettier": {"ignore_patterns_re": []}, + "prettier": {}, }, "audit": { "print_versions": { diff --git a/c2cciutils/checks.py b/c2cciutils/checks.py index 3eaa095fe..5620a66dd 100644 --- a/c2cciutils/checks.py +++ b/c2cciutils/checks.py @@ -1140,41 +1140,34 @@ def prettier( Run prettier check on all the supported files. config is like: - ignore_patterns_re: [] # list of regular expression we should ignore + # Currently empty Arguments: config: The config full_config: The full config args: The parsed command arguments """ - del full_config + del config, full_config - ignore_patterns_compiled = [re.compile(p) for p in config.get("ignore_patterns_re", [])] success = True with c2cciutils.prettier.Prettier() as prettier_lib: for filename in subprocess.check_output(["git", "ls-files"]).decode().strip().split("\n"): if os.path.isfile(filename): - accept = True - for pattern in ignore_patterns_compiled: - if pattern.search(filename): - accept = False - break - if accept: - info = prettier_lib.get_info(filename) - if info.get("info", {}).get("ignored", False): - continue - if not info.get("info", {}).get("inferredParser"): - continue - prettier_config = info["config"] - prettier_config["parser"] = info["info"]["inferredParser"] - - if args.fix: - if not prettier_lib.format(filename, prettier_config): - success = False - else: - if not prettier_lib.check(filename, prettier_config): - success = False + info = prettier_lib.get_info(filename) + if info.get("info", {}).get("ignored", False): + continue + if not info.get("info", {}).get("inferredParser"): + continue + prettier_config = info["config"] + prettier_config["parser"] = info["info"]["inferredParser"] + + if args.fix: + if not prettier_lib.format(filename, prettier_config): + success = False + else: + if not prettier_lib.check(filename, prettier_config): + success = False return success diff --git a/c2cciutils/configuration.py b/c2cciutils/configuration.py index 92f8e4ee1..ab2708ad9 100644 --- a/c2cciutils/configuration.py +++ b/c2cciutils/configuration.py @@ -309,8 +309,6 @@ "ChecksPrettierConfig", { "properties": Dict[str, Any], - # List of regular expression that should be ignored - "ignore_patterns_re": List[str], }, total=False, ) diff --git a/c2cciutils/schema.json b/c2cciutils/schema.json index baefb7226..8bbdaefe7 100644 --- a/c2cciutils/schema.json +++ b/c2cciutils/schema.json @@ -121,11 +121,6 @@ "properties": { "properties": { "type": "object" - }, - "ignore_patterns_re": { - "description": "List of regular expression that should be ignored", - "type": "array", - "items": { "type": "string" } } } },