Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidSouther committed Nov 2, 2023
1 parent 76c67c1 commit 571f2cd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
25 changes: 13 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
.venv
build_dir/
target/
*.exe
*.swp
.*~
.DS_Store
.metadata
.recommenders
._*
vendor/
*.exe
.idea
.vscode
venv
.*~
xcuserdata
.metadata
.phpunit.result.cache
.recommenders
.swiftpm
.venv
.vscode
Package.resolved
build_dir
node_modules
super-linter.log
.phpunit.result.cache
target
vendor
venv
xcuserdata
16 changes: 8 additions & 8 deletions .tools/validation/metadata_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def _is_valid(self, value):

def validate_files(schema_name: Path, meta_names: Iterable[Path], validators):
"""Iterate a list of files and validate each one against a schema."""
success = 0
errors = 0

schema = yamale.make_schema(schema_name, validators=validators)
for meta_name in meta_names:
Expand All @@ -163,8 +163,8 @@ def validate_files(schema_name: Path, meta_names: Iterable[Path], validators):
print(f"{meta_name.resolve()} validation success! 👍")
except YamaleError as e:
print(e.message)
success += 1
return success
errors += 1
return errors


def validate_metadata(doc_gen: Path):
Expand Down Expand Up @@ -203,13 +203,13 @@ def validate_metadata(doc_gen: Path):
("curated_sources_schema.yaml", "curated/sources.yaml"),
("curated_example_schema.yaml", "curated/*_metadata.yaml"),
]
success = 0
errors = 0
for schema, metadata in to_validate:
success += validate_files(
errors += validate_files(
schema_root / schema, (doc_gen / "metadata").glob(metadata), validators
)

return success
return errors


def main():
Expand All @@ -222,9 +222,9 @@ def main():
)
args = parser.parse_args()

success = validate_metadata(Path(args.doc_gen))
errors = validate_metadata(Path(args.doc_gen))

if success == 0:
if errors == 0:
print("Validation succeeded! 👍👍👍")
else:
print("\n********************************************")
Expand Down

0 comments on commit 571f2cd

Please sign in to comment.