Skip to content

Commit

Permalink
fixup! docs: impl tool to list .md missing in SUMMARY.md
Browse files Browse the repository at this point in the history
  • Loading branch information
obrusvit committed Feb 7, 2024
1 parent 1dbb487 commit 0b83095
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ PY_FILES = $(shell find . -type f -name '*.py' | sed 'sO^\./OO' | grep -f ./to
C_FILES = $(shell find . -type f -name '*.[ch]' | grep -f ./tools/style.c.include | grep -v -f ./tools/style.c.exclude )


style_check: pystyle_check ruststyle_check cstyle_check changelog_check yaml_check editor_check ## run all style checks
style_check: pystyle_check ruststyle_check cstyle_check changelog_check yaml_check docs_summary_check editor_check ## run all style checks

style: pystyle ruststyle cstyle ## apply all code styles (C+Rust+Py)

Expand Down Expand Up @@ -138,6 +138,10 @@ ci_docs: ## generate CI documentation
ci_docs_check: ## check that generated CI documentation is up to date
./tools/generate_ci_docs.py --check

docs_summary_check: ## check if there are unlinked documentation files
@echo [DOCS-SUMMARY-MARKDOWN-CHECK]
python3 tools/check_docs_summary.py

vendorheader: ## generate vendor header
./core/embed/vendorheader/generate.sh --quiet

Expand Down
13 changes: 12 additions & 1 deletion tools/check_docs_summary.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ def difference(g1: Iterable[str], g2: Iterable[str]) -> Generator[str, None, Non
yield item


def print_result(filenames: Iterable[str]) -> None:
if not filenames:
print("OK")
else:
print(
f"WARNING: these files exist in {DOCS_DIR} but are not linked in {DOCS_DIR + SUMMARY_FILENAME}"
)
for f in filenames:
print(f"\t- {f}")


def main():
re_md_link = re.compile(RE_MARKDOWN_LINK)

Expand All @@ -61,7 +72,7 @@ def main():
DOCS_DIR + SUMMARY_FILENAME, re_md_link, 1
)
diff = difference(md_files_in_docs_dir, md_files_linked_in_summary)
print(list(diff))
print_result(list(diff))


if __name__ == "__main__":
Expand Down

0 comments on commit 0b83095

Please sign in to comment.