-
Notifications
You must be signed in to change notification settings - Fork 137
Improve API documentation discoverability #1167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
98b8351
33cf9bc
72ba223
336c819
d5471e4
b0d403d
3c5dc26
55da357
2b7a917
9694194
609ea97
bf2b25f
29ee512
43818e4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -806,6 +806,38 @@ if (MFC_DOCUMENTATION) | |||||||||
| GEN_DOCS(post_process "MFC: Post-Process") | ||||||||||
| GEN_DOCS(documentation "MFC") | ||||||||||
|
|
||||||||||
| # Generate API landing pages for pre_process, simulation, post_process. | ||||||||||
| # Scans src/{target}/*.fpp to produce module lists in docs/{target}/readme.md. | ||||||||||
| add_custom_command( | ||||||||||
| OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/gen-api-landing.stamp" | ||||||||||
| DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/docs/gen_api_landing.py" | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Extend the Severity Level: Minor
Suggested change
Prompt for AI Agent 🤖This is a comment left during a code review.
**Path:** CMakeLists.txt
**Line:** 815:815
**Comment:**
*Custom Rule: Extend the `gen_api_landing` custom command dependencies to also include the Fortran template sources it scans, so API landing pages regenerate when those `.fpp` files change.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise. |
||||||||||
| COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/docs/gen_api_landing.py" | ||||||||||
| "${CMAKE_CURRENT_SOURCE_DIR}" | ||||||||||
| COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_CURRENT_BINARY_DIR}/gen-api-landing.stamp" | ||||||||||
| COMMENT "Generating API landing pages" | ||||||||||
| VERBATIM | ||||||||||
| ) | ||||||||||
| add_custom_target(gen_api_landing DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/gen-api-landing.stamp") | ||||||||||
| add_dependencies(pre_process_doxygen gen_api_landing) | ||||||||||
| add_dependencies(simulation_doxygen gen_api_landing) | ||||||||||
| add_dependencies(post_process_doxygen gen_api_landing) | ||||||||||
|
|
||||||||||
| # Fix @file/@brief headers to match actual module/program declarations. | ||||||||||
| # Handles mixed-case Fortran names and catches stale module renames. | ||||||||||
| add_custom_command( | ||||||||||
| OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/fix-file-briefs.stamp" | ||||||||||
| DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/docs/fix_file_briefs.py" | ||||||||||
|
cubic-dev-ai[bot] marked this conversation as resolved.
|
||||||||||
| COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/docs/fix_file_briefs.py" | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Extend the Severity Level: Minor
Suggested change
Prompt for AI Agent 🤖This is a comment left during a code review.
**Path:** CMakeLists.txt
**Line:** 832:832
**Comment:**
*Custom Rule: Extend the `fix_file_briefs` custom command dependencies to include the Fortran template sources whose module and program declarations it inspects, so header fixes rerun when those sources change.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise. |
||||||||||
| "${CMAKE_CURRENT_SOURCE_DIR}" | ||||||||||
| COMMAND "${CMAKE_COMMAND}" -E touch "${CMAKE_CURRENT_BINARY_DIR}/fix-file-briefs.stamp" | ||||||||||
| COMMENT "Fixing @file brief headers" | ||||||||||
| VERBATIM | ||||||||||
| ) | ||||||||||
| add_custom_target(fix_file_briefs DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/fix-file-briefs.stamp") | ||||||||||
|
coderabbitai[bot] marked this conversation as resolved.
|
||||||||||
| add_dependencies(pre_process_doxygen fix_file_briefs) | ||||||||||
| add_dependencies(simulation_doxygen fix_file_briefs) | ||||||||||
| add_dependencies(post_process_doxygen fix_file_briefs) | ||||||||||
|
|
||||||||||
| # Inject per-page last-updated dates into documentation markdown files. | ||||||||||
| # Runs after auto-generated .md files exist, before Doxygen processes them. | ||||||||||
| # Uses a stamp file so it only runs once per build. | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,103 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #!/usr/bin/env python3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Ensure @file/@brief headers match actual module/program declarations. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Usage: python3 fix_file_briefs.py [source_dir] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| source_dir defaults to current directory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| For each .fpp/.f90 in src/{pre_process,simulation,post_process,common}: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1. Parses the first `module <name>` or `program <name>` declaration. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2. If no @file directive exists in the first 15 lines, prepends a header. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3. If a "Contains module/program ..." @brief exists, rewrites the name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| to match the source, using @ref for mixed-case Fortran identifiers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (Doxygen lowercases Fortran namespaces). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import re | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import sys | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from pathlib import Path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| src_dir = Path(sys.argv[1]) if len(sys.argv) > 1 else Path(".") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DIRS = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| src_dir / "src" / "pre_process", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| src_dir / "src" / "simulation", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| src_dir / "src" / "post_process", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| src_dir / "src" / "common", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # First `module X` or `program X` that isn't `end module/program`. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DECL_RE = re.compile( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| r"^\s*(module|program)\s+(\w+)\s*$", re.MULTILINE | re.IGNORECASE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Refine the declaration regex so it does not treat Severity Level: Minor
Suggested change
Prompt for AI Agent 🤖This is a comment left during a code review.
**Path:** docs/fix_file_briefs.py
**Line:** 30:30
**Comment:**
*Custom Rule: Refine the declaration regex so it does not treat `module procedure` lines or similar constructs as top-level modules.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Any "Contains module/program <name>" in a Doxygen comment line. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Matches both `!! @brief Contains ...` and `!> @brief Contains ...`. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| BRIEF_CONTAINS_RE = re.compile( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| r"^(!!|!>)\s*@brief\s+(Contains (?:module|program) )(.*)", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| re.MULTILINE, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def find_entity(text: str) -> tuple[str, str] | None: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
coderabbitai[bot] marked this conversation as resolved.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Return (kind, name) of the first module/program declaration.""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for m in DECL_RE.finditer(text): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| line_start = text.rfind("\n", 0, m.start()) + 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| line = text[line_start : m.end()].strip() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if line.lower().startswith("end"): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| continue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return m.group(1).lower(), m.group(2) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return None | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def make_ref(name: str) -> str: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Return @ref for mixed-case names, plain name for lowercase.""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| lower = name.lower() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return f'@ref {lower} "{name}"' if lower != name else name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| def has_file_directive(text: str) -> bool: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Check if @file appears in the first 15 lines.""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| head = "\n".join(text.splitlines()[:15]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return bool(re.search(r"@file", head)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fixed = 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for d in DIRS: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if not d.exists(): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| continue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for f in sorted(list(d.glob("*.fpp")) + list(d.glob("*.f90"))): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| text = f.read_text() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| entity = find_entity(text) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if entity is None: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| continue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| kind, name = entity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ref = make_ref(name) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if not has_file_directive(text): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # No @file at all — prepend a complete header. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| header = f"!>\n!! @file\n!! @brief Contains {kind} {ref}\n\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| text = header + text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| f.write_text(text) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fixed += 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| print(f"Added {f.relative_to(src_dir)}") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| continue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Has @file — check if there's a "Contains module/program" brief to fix. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| m = BRIEF_CONTAINS_RE.search(text) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if m is None: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| continue # Has @file but no "Contains ..." brief — leave it alone | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| current_name = m.group(3).strip() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if current_name == ref: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| continue # Already correct | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Replace the name portion of the brief line. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| new_line = f"{m.group(1)} @brief {m.group(2)}{ref}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| new_text = text[: m.start()] + new_line + text[m.end() :] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if new_text != text: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| f.write_text(new_text) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Read and write Fortran sources using an explicit UTF-8 encoding to avoid locale-dependent behavior on different systems. [custom_rule] Severity Level: Minor
Suggested change
Prompt for AI Agent 🤖This is a comment left during a code review.
**Path:** docs/fix_file_briefs.py
**Line:** 69:99
**Comment:**
*Custom Rule: Read and write Fortran sources using an explicit UTF-8 encoding to avoid locale-dependent behavior on different systems.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fixed += 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| print(f"Fixed {f.relative_to(src_dir)}: {current_name} -> {ref}") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| print(f"Done — {fixed} file(s) updated.") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,92 @@ | ||||||||||||||||||||||
| #!/usr/bin/env python3 | ||||||||||||||||||||||
| """Generate API landing pages for pre_process, simulation, and post_process. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Usage: python3 gen_api_landing.py [source_dir] | ||||||||||||||||||||||
| source_dir defaults to current directory. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Scans src/{target}/*.fpp and src/common/*.fpp to produce module tables | ||||||||||||||||||||||
| in docs/{target}/readme.md. Intro text is defined below per target. | ||||||||||||||||||||||
| """ | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| import sys | ||||||||||||||||||||||
| from pathlib import Path | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Import the generic type from the typing module to support the updated type annotation without causing a NameError. [custom_rule] Severity Level: Minor
Suggested change
Prompt for AI Agent 🤖This is a comment left during a code review.
**Path:** docs/gen_api_landing.py
**Line:** 13:13
**Comment:**
*Custom Rule: Import the generic type from the typing module to support the updated type annotation without causing a NameError.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise. |
||||||||||||||||||||||
| src_dir = Path(sys.argv[1]) if len(sys.argv) > 1 else Path(".") | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| TARGETS = { | ||||||||||||||||||||||
| "pre_process": { | ||||||||||||||||||||||
| "title": "MFC Pre-Process", | ||||||||||||||||||||||
| "intro": ( | ||||||||||||||||||||||
| "The pre-process component generates initial conditions and " | ||||||||||||||||||||||
| "computational meshes for MFC simulations. It supports patch-based " | ||||||||||||||||||||||
| "geometry construction, multi-component material initialization, " | ||||||||||||||||||||||
| "and immersed boundary geometry." | ||||||||||||||||||||||
| ), | ||||||||||||||||||||||
| "siblings": [("Simulation", "simulation"), ("Post-Process", "post_process")], | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| "simulation": { | ||||||||||||||||||||||
| "title": "MFC Simulation", | ||||||||||||||||||||||
| "intro": ( | ||||||||||||||||||||||
| "The simulation component is the core flow solver. It advances the " | ||||||||||||||||||||||
| "governing equations in time using high-order finite-volume methods " | ||||||||||||||||||||||
| "on structured grids with GPU acceleration via OpenACC/OpenMP offloading." | ||||||||||||||||||||||
| ), | ||||||||||||||||||||||
| "siblings": [("Pre-Process", "pre_process"), ("Post-Process", "post_process")], | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| "post_process": { | ||||||||||||||||||||||
| "title": "MFC Post-Process", | ||||||||||||||||||||||
| "intro": ( | ||||||||||||||||||||||
| "The post-process component reads raw simulation output and computes " | ||||||||||||||||||||||
| "derived quantities for visualization. It produces silo/HDF5 files " | ||||||||||||||||||||||
| "compatible with VisIt, ParaView, and other visualization tools." | ||||||||||||||||||||||
| ), | ||||||||||||||||||||||
| "siblings": [("Pre-Process", "pre_process"), ("Simulation", "simulation")], | ||||||||||||||||||||||
| }, | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| def get_modules(directory: Path) -> list[str]: | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Replace the built-in generic type annotation with the typing module equivalent for better compatibility with older Python versions commonly found on HPC systems. [custom_rule] Severity Level: Minor
Suggested change
Prompt for AI Agent 🤖This is a comment left during a code review.
**Path:** docs/gen_api_landing.py
**Line:** 48:48
**Comment:**
*Custom Rule: Replace the built-in generic type annotation with the typing module equivalent for better compatibility with older Python versions commonly found on HPC systems.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise. |
||||||||||||||||||||||
| """Return sorted list of module names (m_*) from .fpp files.""" | ||||||||||||||||||||||
| return sorted( | ||||||||||||||||||||||
| f.stem for f in directory.glob("m_*.fpp") | ||||||||||||||||||||||
| ) | ||||||||||||||||||||||
|
||||||||||||||||||||||
| """Return sorted list of module names (m_*) from .fpp files.""" | |
| return sorted( | |
| f.stem for f in directory.glob("m_*.fpp") | |
| ) | |
| """Return sorted list of module names (m_*) from .fpp and .f90 files.""" | |
| modules: set[str] = set() | |
| for pattern in ("m_*.fpp", "m_*.f90"): | |
| for f in directory.glob(pattern): | |
| modules.add(f.stem) | |
| return sorted(modules) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Ensure the target documentation directory exists before writing the generated README files so the script does not fail when the docs subtree is missing. [custom_rule]
Severity Level: Minor
| out.write_text("\n".join(lines)) | |
| out.parent.mkdir(parents=True, exist_ok=True) |
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** docs/gen_api_landing.py
**Line:** 91:91
**Comment:**
*Custom Rule: Ensure the target documentation directory exists before writing the generated README files so the script does not fail when the docs subtree is missing.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,35 @@ | ||
| # MFC Post-Process | ||
| @mainpage MFC Post-Process | ||
|
|
||
| This documentation page is for MFC Post-Process. You can also visit: | ||
| - [Home & User Guide](../documentation/) | ||
| - [Pre Process](../pre_process/) | ||
| - [Simulation](../simulation/) | ||
| The post-process component reads raw simulation output and computes derived quantities for visualization. It produces silo/HDF5 files compatible with VisIt, ParaView, and other visualization tools. | ||
|
|
||
| If you are viewing this page Github, please visit [our website](https://mflowcode.github.io/post_process) for the doxygen-generated documentation of this code. | ||
| ## Modules | ||
|
|
||
| ### Post-Process | ||
|
|
||
| - @ref m_checker "m_checker" | ||
| - @ref m_data_output "m_data_output" | ||
| - @ref m_derived_variables "m_derived_variables" | ||
| - @ref m_global_parameters "m_global_parameters" | ||
| - @ref m_mpi_proxy "m_mpi_proxy" | ||
| - @ref m_start_up "m_start_up" | ||
|
|
||
| ### Common (shared) | ||
|
|
||
| - @ref m_boundary_common "m_boundary_common" | ||
| - @ref m_checker_common "m_checker_common" | ||
| - @ref m_chemistry "m_chemistry" | ||
| - @ref m_constants "m_constants" | ||
| - @ref m_derived_types "m_derived_types" | ||
| - @ref m_finite_differences "m_finite_differences" | ||
| - @ref m_helper "m_helper" | ||
| - @ref m_helper_basic "m_helper_basic" | ||
| - @ref m_model "m_model" | ||
| - @ref m_mpi_common "m_mpi_common" | ||
| - @ref m_phase_change "m_phase_change" | ||
| - @ref m_variables_conversion "m_variables_conversion" | ||
|
|
||
| ## See Also | ||
|
|
||
| - [Home & User Guide](../documentation/index.html) | ||
| - [Pre-Process API](../pre_process/index.html) | ||
| - [Simulation API](../simulation/index.html) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,42 @@ | ||
| # MFC Pre-Process | ||
| @mainpage MFC Pre-Process | ||
|
|
||
| This documentation page is for MFC Pre-Process. You can also visit: | ||
| - [Home & User Guide](../documentation/) | ||
| - [Simulation](../simulation/) | ||
| - [Post Process](../post_process/) | ||
| The pre-process component generates initial conditions and computational meshes for MFC simulations. It supports patch-based geometry construction, multi-component material initialization, and immersed boundary geometry. | ||
|
|
||
| If you are viewing this page Github, please visit [our website](https://mflowcode.github.io/pre_process) for the doxygen-generated documentation of this code. | ||
| ## Modules | ||
|
|
||
| ### Pre-Process | ||
|
|
||
| - @ref m_assign_variables "m_assign_variables" | ||
| - @ref m_boundary_conditions "m_boundary_conditions" | ||
| - @ref m_check_ib_patches "m_check_ib_patches" | ||
| - @ref m_check_patches "m_check_patches" | ||
| - @ref m_checker "m_checker" | ||
| - @ref m_data_output "m_data_output" | ||
| - @ref m_global_parameters "m_global_parameters" | ||
| - @ref m_icpp_patches "m_icpp_patches" | ||
| - @ref m_initial_condition "m_initial_condition" | ||
| - @ref m_mpi_proxy "m_mpi_proxy" | ||
| - @ref m_perturbation "m_perturbation" | ||
| - @ref m_simplex_noise "m_simplex_noise" | ||
| - @ref m_start_up "m_start_up" | ||
|
|
||
| ### Common (shared) | ||
|
|
||
| - @ref m_boundary_common "m_boundary_common" | ||
| - @ref m_checker_common "m_checker_common" | ||
| - @ref m_chemistry "m_chemistry" | ||
| - @ref m_constants "m_constants" | ||
| - @ref m_derived_types "m_derived_types" | ||
| - @ref m_finite_differences "m_finite_differences" | ||
| - @ref m_helper "m_helper" | ||
| - @ref m_helper_basic "m_helper_basic" | ||
| - @ref m_model "m_model" | ||
| - @ref m_mpi_common "m_mpi_common" | ||
| - @ref m_phase_change "m_phase_change" | ||
| - @ref m_variables_conversion "m_variables_conversion" | ||
|
|
||
| ## See Also | ||
|
|
||
| - [Home & User Guide](../documentation/index.html) | ||
| - [Simulation API](../simulation/index.html) | ||
| - [Post-Process API](../post_process/index.html) |
Uh oh!
There was an error while loading. Please reload this page.