Browse Source

Create start_* functions to start checkers

pull/3011/head
Matheus Felipe 2 years ago
parent
commit
8c28be1497
No known key found for this signature in database GPG Key ID: AA785C523274872F
1 changed files with 25 additions and 8 deletions
  1. +25
    -8
      scripts/validate/links.py

+ 25
- 8
scripts/validate/links.py View File

@@ -202,14 +202,7 @@ def check_if_list_of_links_are_working(list_of_links: List[str]) -> List[str]:
return error_messages


if __name__ == '__main__':
num_args = len(sys.argv)

if num_args < 2:
print('No .md file passed')
sys.exit(1)

links = find_links_in_file(sys.argv[1])
def start_duplicate_links_checker(links: List[str]) -> None:

print('Checking for duplicate links...')

@@ -217,6 +210,7 @@ if __name__ == '__main__':

if has_duplicate_link:
print(f'Found duplicate links:')

for duplicate_link in duplicates_links:
print(duplicate_link)

@@ -224,6 +218,9 @@ if __name__ == '__main__':
else:
print('No duplicate links.')


def start_links_working_checker(links: List[str]) -> None:

print(f'Checking if {len(links)} links are working...')

errors = check_if_list_of_links_are_working(links)
@@ -236,3 +233,23 @@ if __name__ == '__main__':
print(error_message)

sys.exit(1)


def main(filename: str) -> None:

links = find_links_in_file(filename)

start_duplicate_links_checker(links)
start_links_working_checker(links)


if __name__ == '__main__':
num_args = len(sys.argv)

if num_args < 2:
print('No .md file passed')
sys.exit(1)

filename = sys.argv[1]

main(filename)

Loading…
Cancel
Save