ci: check the links in code comments

Open
#8 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
github-actions, shell
Domain
ci-cd

Research direction

Read .github/workflows/ci.yml and the markdown-links job, then review docs/doc-rules.md for the expected link behavior. Decide how to check relative Markdown links and heading anchors in comments of tracked non-Markdown files while matching remark-validate-links anchor rules. Done means CI reports broken links in those comments using the same anchor rule as the Markdown check; run the repository’s CI link check to verify.

Written by the indexing model from the issue text.

Description

type/ci
Problem to solve

The Comments row in Where to write in docs/doc-rules.md tells a comment to link the design doc for design reasons across modules. The trace-decision skill starts from these links to go from code to its design section.

The link check in .github/workflows/ci.yml (job markdown-links) gives only the tracked *.md files to remark-validate-links. A link in a code comment, for example in .githooks/pre-push, is not checked. When a heading or a file of a design doc changes, the link in the comment breaks, and CI does not report it.

Proposal

Check the relative links to Markdown files, and their heading anchors, in the comments of the tracked files that are not Markdown. CI fails on a broken link, like the current Markdown check.

The check must use the same rule as remark-validate-links to make an anchor from a heading. Then one link is valid or broken in both checks.

More information

Item 4 of When to write in docs/doc-rules.md says: "If the compiler, project references, tests or CI can enforce a rule, let the tool do it."

Possible ways, not chosen yet:

  • A script collects the links in comments and gives them to remark-validate-links in a generated Markdown file.
  • A link checker that reads any text file replaces or joins the current check.
Dominant language
Shell
Stars
1
Forks
0
Avg merge
6h 59m
Merged PRs (30d)
26

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from c-w-z/commit-decision-record

All issues in c-w-z/commit-decision-record

Similar issues

More Shell/Bash issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.