-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
81 changed files
with
71,207 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import sys | ||
|
||
import click | ||
|
||
from .full_submission_validator import FullSubmissionValidator | ||
|
||
|
||
@click.command() | ||
@click.option('--directory', '-d', default='.', help='Directory to check (defaults to current working directory)') | ||
@click.option('--file', '-f', default=None, help='Single submission yaml file to check - see https://hepdata-submission.readthedocs.io/en/latest/single_yaml.html. (Overrides directory)') | ||
@click.option('--zipfile', '-z', default=None, help='Zipped file (e.g. .zip, .tar.gz, .gzip) to check. (Overrides directory and file)') | ||
def validate(directory, file, zipfile): # pragma: no cover | ||
""" | ||
Offline validation of submission.yaml and YAML data files. | ||
Can check either a single file or a directory | ||
""" | ||
file_or_dir_checked = zipfile if zipfile else (file if file else directory) | ||
validator = FullSubmissionValidator() | ||
is_valid = validator.validate(directory, file, zipfile) | ||
if is_valid: | ||
click.echo(f"{file_or_dir_checked} is valid.") | ||
else: | ||
click.echo(f"ERROR: {file_or_dir_checked} is invalid.") | ||
|
||
validator.print_valid_files() | ||
for f in validator.messages.keys(): | ||
validator.print_errors(f) | ||
|
||
if not is_valid: | ||
sys.exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.