Skip to content

Commit

Permalink
Fix PEP8 issues in tests/validate_automatus_metadata.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Mab879 committed Oct 16, 2024
1 parent 762e132 commit 21e8c0f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/validate_automatus_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
+ list(ssg.constants.MULTI_PLATFORM_MAPPING.keys())
+ ['multi_platform_all'])


def _parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser()
parser.add_argument("-r", "--root", required=False, default=SSG_ROOT,
Expand All @@ -36,13 +37,15 @@ def _test_filename_valid(test_file: str) -> bool:
return False
return True


def _validate_platform(param_value, test_file):
for platform in param_value.split(","):
if platform.strip() not in VALID_PLATFORMS:
print(f"Invalid platform '{platform}' in {test_file}", file=sys.stderr)
return False
return True


def _has_invalid_param(root: str, test_file: str) -> bool:
full_path = os.path.join(root, test_file)
has_no_errors = True
Expand All @@ -59,14 +62,12 @@ def _has_invalid_param(root: str, test_file: str) -> bool:
param_value = parts[1].strip()
if param_name == 'platform':
has_no_errors = _validate_platform(param_value, test_file)

if param_name not in VALID_FIELDS:
print(f"Invalid field '{param_name}' in {test_file}", file=sys.stderr)
has_no_errors = False
return has_no_errors



def main() -> int:
args = _parse_args()
test_files = get_files(args.root)
Expand Down

0 comments on commit 21e8c0f

Please sign in to comment.