doxyfile.py¶
clew/guard/doxyfile.py
Doxyfile fragment generation.
build_fragment
str clew.guard.doxyfile.build_fragment(dict[str, Any] config)
Build the Doxyfile fragment for the given config.
Called by _run_doxyfile_command
Tested by 8 tests
test_declares_an_alias_for_every_tool_tag, test_enables_validity_checking, test_exemption_markers_map_to_nothing, test_internal_docs_enabled_so_markers_hide_nothing, test_is_include_ready, test_needs_no_doxygen_installed, test_policy_warnings_are_opt_in_not_default, test_req_becomes_a_cross_referenced_section
Calls _marker_alias, _xref_alias, tool_tags_for
Source · 28 lines
def build_fragment(config: dict[str, Any]) -> str:
lines = [_HEADER, "# Tags clew guard defines that doxygen does not."]
for tag in tool_tags_for(config):
if tag in EXEMPTION_TAGS:
lines.append(f"# @{tag}: exemption marker, no rendered output")
lines.append(_marker_alias(tag))
else:
title = _TAG_TITLES.get(tag, tag.replace("_", " ").title())
lines.append(_xref_alias(tag, title, f"{title} Index"))
lines.append("")
lines.append("# Validity: is the comment well-formed doxygen.")
for key, value, why in _WARNINGS:
lines.append(f"# {why}")
lines.append(f"{key} = {value}")
lines.append("")
lines.append("# Policy, not validity — stricter than clew guard. Opt in if you want it.")
for key, why in _OPTIONAL_WARNINGS:
lines.append(f"# {key} = YES # {why}")
lines.append("")
lines.append("# Exemption markers must not hide the rest of the block.")
lines.append("INTERNAL_DOCS = YES")
logger.info("Generated Doxyfile fragment for %d tool-owned tag(s)", len(tool_tags_for(config)))
return "\n".join(lines) + "\n"1 more lines, not shown
Activity · 22 steps
Requirements
Flows
tool_tags_for
list[str] clew.guard.doxyfile.tool_tags_for(dict[str, Any] config)
Collect the tool-owned tags that need declaring for a given config.
Source · 13 lines
def tool_tags_for(config: dict[str, Any]) -> list[str]:
validate = get_validate(config)
tags = set(TOOL_OWNED_TAGS)
tags.update(validate.get("tags", {}).keys())
tags.update(str(t).lstrip("@") for t in validate.get("extra_tags", []))
version_tag = str(validate.get("version", {}).get("tag", "@version")).lstrip("@")
if version_tag != "version":
tags.add(version_tag)
# brief/version/return and friends are real doxygen commands; never alias those.
return sorted(tags - {"brief", "version", "return", "returns", "file", "param"})