Skip to content

Commit 9115d4a

Browse files
author
Colin Leong
committed
CDL: some cleanup items
1 parent 30f8166 commit 9115d4a

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/find_bare_citations.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@
1313

1414
def extract_citation_keys(bib_file_path):
1515
content = bib_file_path.read_text()
16-
# with open(bib_file_path, "r") as file:
17-
# for line in file:
1816
citation_keys = re.findall(r"@\w+\{([^,]+),", content)
19-
# if match:
20-
# citation_keys.append(match.group(1))
2117
return citation_keys
2218

2319
def find_bare_citations(markdown_file_path: Path, citation_keys: list) -> list:
@@ -88,17 +84,16 @@ def find_bare_citations(markdown_file_path: Path, citation_keys: list) -> list:
8884
# we cannot simply check "if issues" due to using yield
8985
issues_exist = False
9086
for citation_key, matches in issues:
91-
print(f"Citation key: {citation_key}")
87+
print(f"Citation key: {citation_key}: {len(matches)} bare citations")
9288

93-
for match in matches:
94-
print(match)
95-
# print(f"* {match.group(0)}")
89+
for i, match in enumerate(matches):
90+
print(f"{i}: {match}")
9691

9792
# iff we've gotten here then issues exist and we should set return value to 1 at the end.
9893
issues_exist = True
9994
print()
10095
elapsed_time = timeit.default_timer() - start_time
101-
print(f"Bare-citation check complete after ~{elapsed_time:.2f} seconds")
96+
print(f"Bare-citation check complete after ~{elapsed_time} seconds")
10297
if issues_exist:
10398
sys.exit(1) # exit with an error
10499

0 commit comments

Comments
 (0)