Skip to content

Remote URL not working in coffee machine demo #43

@patdhlk

Description

@patdhlk

Problem

The remote URLs generated by sphinx-codelinks for the coffee-machine implementation needs contain None instead of the actual git commit hash.

Example broken link:
https://github.com/useblocks/sphinx-needs-demo/blob/None/crates/coffee-machine/src/interfaces.rs#L8

Expected link:

// @ BrewStrength enum, IMPL_BREW_STRENGTH, impl, [SWREQ_BREW_STRENGTH]

Visible on the live docs:
https://sphinx-needs-demo.readthedocs.io/en/latest/coffee-machine/index.html#implementation

Root Cause

The remote_url_pattern in docs/ubproject.toml uses the {commit} placeholder:

[codelinks.projects.coffee_machine]
remote_url_pattern = "https://github.com/useblocks/sphinx-needs-demo/blob/{commit}/{path}#L{line}"

sphinx-codelinks auto-detects the git root by traversing parent directories to find a .git folder. This likely fails in the ReadTheDocs build environment because src_dir = "../crates" points outside the docs directory, and the .git directory may not be accessible or detectable from the build working directory.

When git root detection fails, the commit hash resolves to None.

Suggested Fix

Explicitly set the git_root option in the analyse config so that sphinx-codelinks can reliably find the git repository:

[codelinks.projects.coffee_machine.analyse]
git_root = "../"  # Point to repo root relative to docs/
get_need_id_refs = false
get_oneline_needs = true
comment_type = "rust"

See sphinx-codelinks docs on git_root for details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions