Kaynağa Gözat

Create start_* functions to start checkers

pull/3011/head
Matheus Felipe 2 yıl önce
ebeveyn
işleme
8c28be1497
Veri tabanında bu imza için bilinen anahtar bulunamadı GPG Anahtar Kimliği: AA785C523274872F
1 değiştirilmiş dosya ile 25 ekleme ve 8 silme
  1. +25
    -8
      scripts/validate/links.py

+ 25
- 8
scripts/validate/links.py Dosyayı Görüntüle

@@ -202,14 +202,7 @@ def check_if_list_of_links_are_working(list_of_links: List[str]) -> List[str]:
return error_messages 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...') print('Checking for duplicate links...')


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


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

for duplicate_link in duplicates_links: for duplicate_link in duplicates_links:
print(duplicate_link) print(duplicate_link)


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



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

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


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


sys.exit(1) 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)

Yükleniyor…
İptal
Kaydet