Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
Repomatic works fine, but is maintained by only one person 😶‍🌫️.
You can help if you purchase business support 🤝 or sponsor the project 🫶.
Repomatic
Light Logo Dark Logo
  • Installation
  • CLI
  • Configuration
  • Dependency management
  • Tool runner
  • Reusable workflows
  • Cloudflare Pages
  • Test matrix
  • Nuitka compilation
  • Security
  • Benchmark

Agent tooling

  • Agent skills
  • Subagents
  • Claude Code plugin

Development

  • Contributing
  • Commit messages
  • Upstream development
  • Automated operation contracts
  • API
    • repomatic.cli package
      • repomatic.cli.github module
      • repomatic.cli.lint module
      • repomatic.cli.main module
      • repomatic.cli.release module
      • repomatic.cli.sample module
      • repomatic.cli.setup module
      • repomatic.cli.sync module
    • repomatic.data package
      • repomatic.data.awesome_template package
    • repomatic.deps package
      • repomatic.deps.dep_graph module
      • repomatic.deps.dep_policy module
      • repomatic.deps.dep_report module
      • repomatic.deps.dep_sources module
      • repomatic.deps.uv module
      • repomatic.deps.vulnerable_deps module
    • repomatic.github package
      • repomatic.github.actions module
      • repomatic.github.ci_status module
      • repomatic.github.dev_release module
      • repomatic.github.gh module
      • repomatic.github.issue module
      • repomatic.github.job_timings module
      • repomatic.github.matrix module
      • repomatic.github.pr module
      • repomatic.github.pr_body module
      • repomatic.github.release_sync module
      • repomatic.github.releases module
      • repomatic.github.sponsor module
      • repomatic.github.status module
      • repomatic.github.token module
      • repomatic.github.unsubscribe module
      • repomatic.github.workflow_sync module
    • repomatic.metadata package
      • repomatic.metadata.core module
      • repomatic.metadata.env module
      • repomatic.metadata.git module
      • repomatic.metadata.matrix module
      • repomatic.metadata.project module
    • repomatic.release package
      • repomatic.release.attestation module
      • repomatic.release.binaries_page module
      • repomatic.release.binary module
      • repomatic.release.checksums module
      • repomatic.release.prepare_release module
      • repomatic.release.version_sync module
      • repomatic.release.virustotal module
    • repomatic.templates package
    • repomatic.tooling package
      • repomatic.tooling.bundle module
      • repomatic.tooling.plugin module
      • repomatic.tooling.tool_registry module
      • repomatic.tooling.tool_runner module
    • repomatic.awesome_toc module
    • repomatic.broken_links module
    • repomatic.cache module
    • repomatic.changelog module
    • repomatic.cloudflare module
    • repomatic.compat module
    • repomatic.config module
    • repomatic.docs module
    • repomatic.file_inventory module
    • repomatic.forge module
    • repomatic.frontmatter module
    • repomatic.git_ops module
    • repomatic.gitignore module
    • repomatic.hashing module
    • repomatic.http module
    • repomatic.humanize module
    • repomatic.images module
    • repomatic.init_project module
    • repomatic.labels module
    • repomatic.lint_repo module
    • repomatic.mailmap module
    • repomatic.matrix_axes module
    • repomatic.metric_chart module
    • repomatic.metrics module
    • repomatic.npm module
    • repomatic.pages_redirects module
    • repomatic.pypi module
    • repomatic.pyproject module
    • repomatic.registry module
    • repomatic.runner_catalog module
    • repomatic.runner_images module
    • repomatic.setup_guide module
    • repomatic.site_anchors module
    • repomatic.sync_ops module
    • repomatic.tabular module
    • repomatic.versions module
  • tests package
    • tests.conftest module
    • tests.test_actions module
    • tests.test_attestation module
    • tests.test_awesome_template module
    • tests.test_awesome_toc module
    • tests.test_binaries_page module
    • tests.test_binary module
    • tests.test_broken_links module
    • tests.test_cache module
    • tests.test_changelog module
    • tests.test_checksums module
    • tests.test_ci_status module
    • tests.test_claude_assets module
    • tests.test_cloudflare module
    • tests.test_config module
    • tests.test_dep_graph module
    • tests.test_dep_policy module
    • tests.test_dep_report module
    • tests.test_dep_sources module
    • tests.test_dev_release module
    • tests.test_docs module
    • tests.test_docstrings module
    • tests.test_forge module
    • tests.test_frontmatter module
    • tests.test_gh module
    • tests.test_git_ops module
    • tests.test_gitignore module
    • tests.test_hashing module
    • tests.test_help module
    • tests.test_http module
    • tests.test_humanize module
    • tests.test_images module
    • tests.test_imports module
    • tests.test_init_project module
    • tests.test_issue module
    • tests.test_job_timings module
    • tests.test_labels module
    • tests.test_lint_repo module
    • tests.test_mailmap module
    • tests.test_matrix module
    • tests.test_metadata module
    • tests.test_metrics module
    • tests.test_npm module
    • tests.test_pages_redirects module
    • tests.test_platform_keys module
    • tests.test_plugin module
    • tests.test_pr module
    • tests.test_pr_body module
    • tests.test_prepare_release module
    • tests.test_pypi module
    • tests.test_pyproject module
    • tests.test_readme module
    • tests.test_release_sync module
    • tests.test_releases module
    • tests.test_runner_catalog module
    • tests.test_runner_sync module
    • tests.test_setup_guide module
    • tests.test_site_anchors module
    • tests.test_skills module
    • tests.test_sphinx_crossrefs module
    • tests.test_status module
    • tests.test_suite_hygiene module
    • tests.test_sync_ops module
    • tests.test_tabular module
    • tests.test_todolist module
    • tests.test_tool_runner module
    • tests.test_unsubscribe module
    • tests.test_uv module
    • tests.test_version_sync module
    • tests.test_versions module
    • tests.test_virustotal module
    • tests.test_vulnerable_deps module
    • tests.test_workflow_sync module
    • tests.test_workflows module
  • Packaging
  • Binaries
  • Index
  • Module Index
  • Changelog
  • Changelog archive
  • History
  • Todo list
  • Code of conduct
  • License
  • GitHub repository
  • Funding
Back to top
View this page
Edit this page

repomatic.broken_links module¶

Broken links detection and reporting.

Combines Lychee and Sphinx linkcheck results into a single “Broken links” GitHub issue. Sphinx linkcheck parsing detects broken auto-generated links (intersphinx, autodoc, type annotations) that Lychee cannot see because they only exist in the rendered HTML output.

Issue lifecycle management is delegated to issue.

repomatic.broken_links.ISSUE_TITLE = 'Broken links'¶

Issue title used for the combined broken links report.

repomatic.broken_links.LYCHEE_BROKEN_LINKS_EXIT = 2¶

The one lychee exit code that reports on the links rather than on the run.

Lychee exits 0 on success, 1 on an unexpected failure, 2 when it found broken links, and 3 on a config error. Only 2 is a verdict about the links; 1 and 3 say the run itself did not complete, so neither “broken links found” nor “no broken links” can be claimed from them.

repomatic.broken_links.LYCHEE_DEFAULT_BODY = PosixPath('lychee/out.md')¶

Default output path used by the lychee-action GitHub Action.

repomatic.broken_links.SPHINX_DEFAULT_OUTPUT = PosixPath('docs/_linkcheck/output.json')¶

Default Sphinx linkcheck output path produced by the docs.yaml workflow.

class repomatic.broken_links.LinkcheckResult(filename, lineno, status, code, uri, info)[source]¶

Bases: object

A single result entry from Sphinx linkcheck output.json.

Each line in the JSON-lines file corresponds to one checked URI.

filename: str¶
lineno: int¶
status: str¶
code: int¶
uri: str¶
info: str¶
repomatic.broken_links.parse_output_json(output_json)[source]¶

Parse the Sphinx linkcheck output.json file.

The file uses JSON-lines format: one JSON object per line. Blank lines are skipped.

Parameters:

output_json (Path) – Path to the output.json file.

Return type:

list[LinkcheckResult]

Returns:

List of parsed linkcheck results.

repomatic.broken_links.filter_broken(results)[source]¶

Filter results to only broken and timed-out links.

Parameters:

results (Iterable[LinkcheckResult]) – Iterable of linkcheck results.

Return type:

list[LinkcheckResult]

Returns:

List of results with status of "broken" or "timeout".

repomatic.broken_links.generate_markdown_report(broken, source_url=None)[source]¶

Generate a Markdown report of broken links grouped by source file.

The report starts with H2 file headings, suitable for embedding as a section in the combined broken links issue body.

Parameters:
  • broken (list[LinkcheckResult]) – List of broken linkcheck results.

  • source_url (str | None) – Base URL for linking filenames and line numbers. When provided, file headers become clickable links and line numbers deep-link to the specific line.

Return type:

str

Returns:

Markdown-formatted report string.

repomatic.broken_links.get_label(repo_name)[source]¶

Return the appropriate label based on repository name.

Parameters:

repo_name (str) – The repository name.

Return type:

str

Returns:

"🩹 fix link" for awesome-* repos, else "📚 documentation".

repomatic.broken_links.manage_combined_broken_links_issue(repo_name=None, lychee_exit_code=None, lychee_body_file=None, sphinx_output_json=None, sphinx_source_url=None)[source]¶

Manage the combined broken links issue lifecycle.

Combines results from Lychee and Sphinx linkcheck into a single “Broken links” issue. Each tool’s results appear under its own heading. Tools that were not run are omitted from the report. Tools that found no broken links show a “No broken links found.” message.

When running in GitHub Actions, most parameters are auto-detected from Metadata and well-known file paths:

  • repo_name defaults to Metadata.repo_name.

  • lychee_body_file defaults to ./lychee/out.md when lychee_exit_code is provided and the file exists.

  • sphinx_output_json defaults to ./docs/_linkcheck/output.json when the file exists.

  • sphinx_source_url is composed from Metadata.repo_url and Metadata.sha.

Parameters:
  • repo_name (str | None) – Repository name (for label selection). Defaults to Metadata.repo_name.

  • lychee_exit_code (int | None) – Exit code from lychee (0=no broken links, 2=broken links found). None if lychee was not run.

  • lychee_body_file (Path | None) – Path to the lychee output file. Defaults to ./lychee/out.md when lychee_exit_code is provided and the file exists.

  • sphinx_output_json (Path | None) – Path to Sphinx linkcheck output.json. Defaults to ./docs/_linkcheck/output.json when the file exists.

  • sphinx_source_url (str | None) – Base URL for linking filenames and line numbers in the Sphinx report. Auto-composed from Metadata.repo_url and Metadata.sha.

Raises:

ValueError – If repo_name cannot be determined.

Return type:

None

Next
repomatic.cache module
Previous
repomatic.awesome_toc module
Copyright © Kevin Deldycke and contributors
Made with Furo
Last updated on 2026-08-27
On this page
  • repomatic.broken_links module
    • ISSUE_TITLE
    • LYCHEE_BROKEN_LINKS_EXIT
    • LYCHEE_DEFAULT_BODY
    • SPHINX_DEFAULT_OUTPUT
    • LinkcheckResult
      • LinkcheckResult.filename
      • LinkcheckResult.lineno
      • LinkcheckResult.status
      • LinkcheckResult.code
      • LinkcheckResult.uri
      • LinkcheckResult.info
    • parse_output_json()
    • filter_broken()
    • generate_markdown_report()
    • get_label()
    • manage_combined_broken_links_issue()