Skip to content

Commit

Permalink
added no-legacy flag to show-validations
Browse files Browse the repository at this point in the history
  • Loading branch information
Shalucik committed Jun 5, 2024
1 parent b8fce36 commit 001d665
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
11 changes: 9 additions & 2 deletions geopackage_validator/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,16 +420,23 @@ def geopackage_validator_command_generate_table_definitions(
name="show-validations",
help="Show all the possible validations that can be executed in the validate command.",
)
@click.option(
"--no-legacy",
required=False,
is_flag=True,
help="Output without Legacy checks",
)
@click.option(
"--yaml",
required=False,
is_flag=True,
help="Output yaml",
)
@click_log.simple_verbosity_option(logger)
def geopackage_validator_command_show_validations(yaml):
def geopackage_validator_command_show_validations(no_legacy, yaml):
try:
validation_codes = validate.get_validation_descriptions()
legacy = not no_legacy
validation_codes = validate.get_validation_descriptions(legacy)
output.print_output(validation_codes, yaml, yaml_indent=5)
except Exception:
logger.exception("Error while listing validations")
Expand Down
14 changes: 12 additions & 2 deletions geopackage_validator/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,20 @@ def gdal_error_handler(err_class, err_num, error):
)


def get_validation_descriptions():
def get_validation_descriptions(legacy):
validation_classes = get_validator_classes()

if legacy:
return OrderedDict(
(klass.validation_code, klass.__doc__) for klass in validation_classes
)

rq_drop_list = DROP_LEGACY_RQ_FROM_ALL

return OrderedDict(
(klass.validation_code, klass.__doc__) for klass in validation_classes
(klass.validation_code, klass.__doc__)
for klass in validation_classes
if klass.validation_code not in rq_drop_list
)


Expand Down

0 comments on commit 001d665

Please sign in to comment.