Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/chexus/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright (c) 2023 Scipp contributors (https://github.com/scipp)
# ruff: noqa: T201
import argparse
import re
import sys

import chexus
Expand All @@ -27,6 +28,12 @@ def main():
action="store_true",
help="Skip the validators that have missing dependencies",
)
# Add argument to skip certain entries based on a regex
parser.add_argument(
"--ignore-pattern",
type=str,
help="Skip entries that match the given regex pattern",
)
# Add argument to return bad exit code if validation fails
parser.add_argument(
"--exit-on-fail",
Expand Down Expand Up @@ -73,7 +80,11 @@ def main():
validators = chexus.validators.base_validators(has_scipp=has_scipp)

def skip_condition(node):
return not node.name.startswith(args.root_path)
if not node.name.startswith(args.root_path):
return True
if args.ignore_pattern and re.search(args.ignore_pattern, node.name):
return True
return False

results = chexus.validate(
group, validators=validators, skip_condition=skip_condition
Expand Down
Loading