mirror of
https://gerrit.googlesource.com/git-repo
synced 2026-01-12 01:20:26 +00:00
check-metadata: skip files that do not exist
If the files don't exist, then they can't have errors, so skip checking. Change-Id: I3ed4be4912b253c5454df41d690cb33dfe191289 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/540003 Reviewed-by: Gavin Mak <gavinmak@google.com> Tested-by: Mike Frysinger <vapier@google.com> Commit-Queue: Mike Frysinger <vapier@google.com>
This commit is contained in:
@@ -90,7 +90,10 @@ def check_license(path: Path, lines: list[str]) -> bool:
|
|||||||
|
|
||||||
def check_path(opts: argparse.Namespace, path: Path) -> bool:
|
def check_path(opts: argparse.Namespace, path: Path) -> bool:
|
||||||
"""Check a single path."""
|
"""Check a single path."""
|
||||||
data = path.read_text(encoding="utf-8")
|
try:
|
||||||
|
data = path.read_text(encoding="utf-8")
|
||||||
|
except FileNotFoundError:
|
||||||
|
return True
|
||||||
lines = data.splitlines()
|
lines = data.splitlines()
|
||||||
# NB: Use list comprehension and not a generator so we run all the checks.
|
# NB: Use list comprehension and not a generator so we run all the checks.
|
||||||
return all(
|
return all(
|
||||||
|
|||||||
Reference in New Issue
Block a user