Conversation
Reviewer's GuideThis PR enriches the library documentation by adding Rustdoc examples to the split_cells, reflow_table, and format_breaks functions to illustrate typical usage and behavior, and cleans up project docs by wrapping lines in AGENTS.md and adjusting whitespace in README.md for consistency. Class diagram for updated table helper functions documentationclassDiagram
class split_cells {
+Vec<String> split_cells(line: &str)
"""Split a Markdown table row into individual cell strings.
Escaped pipe characters (\|) are treated as literals and whitespace inside each cell is trimmed.
Example usage provided in docs."""
}
class reflow_table {
+Vec<String> reflow_table(lines: &[String])
"""Reflow a Markdown table so columns align uniformly.
Invalid tables are returned unchanged.
Example usage provided in docs."""
}
class format_breaks {
+Vec<Cow<'_, str>> format_breaks(lines: &[String])
"""Normalize thematic breaks outside fenced code blocks.
Consecutive hyphens, asterisks or underscores are replaced with a standardised line of underscores.
Example usage provided in docs."""
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Summary by CodeRabbit
WalkthroughApply editorial and formatting improvements to Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant TableModule as src/table.rs
User->>TableModule: Call reflow_table(lines)
TableModule->>TableModule: Parse table lines, validate structure
TableModule->>TableModule: Calculate column widths
TableModule->>TableModule: Align and format table rows
TableModule-->>User: Return reflowed table as Vec<String>
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15 minutes Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1)**/*.md📄 CodeRabbit Inference Engine (AGENTS.md)
Files:
⚙️ CodeRabbit Configuration File
Files:
🧠 Learnings (1)AGENTS.md (4)Learnt from: CR Learnt from: CR Learnt from: CR Learnt from: CR 🪛 LanguageToolAGENTS.md[uncategorized] ~33-~33: Do not mix variants of the same word (‘co-locate’ and ‘colocate’) within a single text. (EN_WORD_COHERENCY) 🔇 Additional comments (2)
✨ Finishing Touches🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Hey @leynos - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `AGENTS.md:31` </location>
<code_context>
+ examples demonstrating the usage and outcome of the function. Test
+ documentation should omit examples where the example serves only to reiterate
+ the test logic.
+- **Keep file size managable.** No single code file may be longer than 400
+ lines. Long switch statements or dispatch tables should be broken up by
+ feature and constituents colocated with targets. Large blocks of test data
</code_context>
<issue_to_address>
Typo: 'managable' should be 'manageable'.
Please correct the spelling to 'manageable'.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
- **Keep file size managable.** No single code file may be longer than 400
lines. Long switch statements or dispatch tables should be broken up by
feature and constituents colocated with targets. Large blocks of test data
=======
- **Keep file size manageable.** No single code file may be longer than 400
lines. Long switch statements or dispatch tables should be broken up by
feature and constituents colocated with targets. Large blocks of test data
>>>>>>> REPLACE
</suggested_fix>
### Comment 2
<location> `src/table.rs:32` </location>
<code_context>
+/// vec!["a".to_string(), "b | c".to_string(), "d".to_string()]
+/// );
+/// ```
pub fn split_cells(line: &str) -> Vec<String> {
let mut s = line.trim();
if let Some(stripped) = s.strip_prefix('|') {
</code_context>
<issue_to_address>
Consider replacing the manual loop in split_cells with a regex-based split and map for cleaner and more maintainable code.
```suggestion
You can collapse all the manual peek/loop logic in `split_cells` into a single regex‐based split and a map cleanup. This preserves escaped “\|” and trimming:
```rust
use once_cell::sync::Lazy;
use regex::Regex;
// match an unescaped '|' (i.e. not preceded by backslash)
static UNESCAPED_PIPE: Lazy<Regex> = Lazy::new(|| {
Regex::new(r"(?<!\\)\|").unwrap()
});
pub fn split_cells(line: &str) -> Vec<String> {
// strip outer pipes and trim
let s = line.trim().trim_start_matches('|').trim_end_matches('|');
UNESCAPED_PIPE
.split(s)
.map(|cell| {
cell
.trim()
.replace(r"\|", "|") // unescape literal pipes
})
.collect()
}
```
This:
- drops the manual `peekable` loop entirely
- still trims whitespace per cell
- preserves `\|` escapes
- compiles the regex once via `Lazy` for performance
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (1)
src/table.rs (1)
31-39: Well-implemented regex-based refactorThe regex-based approach with placeholder replacement effectively addresses the previous review suggestion whilst maintaining the same functionality. The implementation is clean and more maintainable than the previous manual parsing approach.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (4)
AGENTS.md(4 hunks)README.md(1 hunks)src/breaks.rs(1 hunks)src/table.rs(2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.md
⚙️ CodeRabbit Configuration File
**/*.md: * Avoid 2nd person or 1st person pronouns ("I", "you", "we")
- Use en-GB-oxendict (-ize / -our) spelling and grammar
- Paragraphs and bullets must be wrapped to 80 columns, except where a long URL would prevent this (in which case, silence MD013 for that line)
- Code blocks should be wrapped to 120 columns.
- Headings must not be wrapped.
- Documents must start with a level 1 heading
- Headings must correctly increase or decrease by no more than one level at a time
- Use GitHub-flavoured Markdown style for footnotes and endnotes.
- Numbered footnotes must be numbered by order of appearance in the document.
Files:
AGENTS.mdREADME.md
**/*.rs
⚙️ CodeRabbit Configuration File
**/*.rs: * Seek to keep the cyclomatic complexity of functions no more than 12.
Adhere to single responsibility and CQRS
Place function attributes after doc comments.
Do not use
returnin single-line functions.Move conditionals with >2 branches into a predicate function.
Avoid
unsafeunless absolutely necessary.Every module must begin with a
//!doc comment that explains the module's purpose and utility.Comments and docs must follow en-GB-oxendict (-ize / -our) spelling and grammar
Lints must not be silenced except as a last resort.
#[allow]is forbidden.- Only narrowly scoped
#[expect(lint, reason = "...")]is allowed.- No lint groups, no blanket or file-wide suppression.
- Include
FIXME:with link if a fix is expected.Use
rstestfixtures for shared setup and to avoid repetition between tests.Replace duplicated tests with
#[rstest(...)]parameterised cases.Prefer
mockallfor mocks/stubs.Prefer
.expect()over.unwrap()Ensure that any API or behavioural changes are reflected in the documentation in
docs/Ensure that any completed roadmap steps are recorded in the appropriate roadmap in
docs/Files must not exceed 400 lines in length
- Large modules must be decomposed
- Long match statements or dispatch tables should be decomposed by domain and collocated with targets
- Large blocks of inline data (e.g., test fixtures, constants or templates) must be moved to external files and inlined at compile-time or loaded at run-time.
Files:
src/breaks.rssrc/table.rs
🧠 Learnings (1)
AGENTS.md (10)
Learnt from: CR
PR: leynos/rstest-bdd#0
File: AGENTS.md:0-0
Timestamp: 2025-07-22T06:27:02.647Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar (with the exception of "license" which is to be left unchanged for community consistency).
Learnt from: CR
PR: leynos/ortho-config#0
File: AGENTS.md:0-0
Timestamp: 2025-07-20T21:31:16.982Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar (with the exception of "license" which is to be left unchanged for community consistency).
Learnt from: CR
PR: leynos/comenq#0
File: AGENTS.md:0-0
Timestamp: 2025-07-27T00:57:05.353Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar. (EXCEPTION: the naming of the "LICENSE" file, which is to be left unchanged for community consistency.)
Learnt from: CR
PR: leynos/lille#0
File: AGENTS.md:0-0
Timestamp: 2025-07-27T12:14:14.253Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar. (EXCEPTION: the naming of the "LICENSE" file, which is to be left unchanged for community consistency.)
Learnt from: CR
PR: leynos/mdtablefix#0
File: AGENTS.md:0-0
Timestamp: 2025-07-29T12:44:22.976Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar. (EXCEPTION: the naming of the "LICENSE" file, which is to be left unchanged for community consistency.)
Learnt from: CR
PR: leynos/ddlint#0
File: AGENTS.md:0-0
Timestamp: 2025-07-18T18:35:14.639Z
Learning: Applies to docs/**/*.md : Documentation must use en-GB-oxendict spelling and grammar (with the exception of "license" which is to be left unchanged for community consistency).
Learnt from: CR
PR: leynos/vk#0
File: AGENTS.md:0-0
Timestamp: 2025-07-27T00:37:06.651Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar, except for the naming of the "LICENSE" file.
Learnt from: CR
PR: leynos/femtologging#0
File: AGENTS.md:0-0
Timestamp: 2025-07-28T19:14:46.188Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar, except for the naming of the "LICENSE" file.
Learnt from: CR
PR: leynos/wireframe#0
File: AGENTS.md:0-0
Timestamp: 2025-07-27T13:30:09.180Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar, except for the naming of the "LICENSE" file.
Learnt from: CR
PR: leynos/netsuke#0
File: AGENTS.md:0-0
Timestamp: 2025-07-27T17:57:57.505Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar, except for the naming of the "LICENSE" file.
🪛 LanguageTool
AGENTS.md
[locale-violation] ~46-~46: LICENSE must be spelled with a “c” when used as a noun in British English. Use “licence”.
Context: ...grammar. (EXCEPTION: the naming of the "LICENSE" file, which is to be left unchanged ...
(LICENCE_LICENSE_NOUN_SINGULAR)
[uncategorized] ~160-~160: Possible missing comma found.
Context: ...(>=) version requirements is strictly forbidden as they introduce unacceptable risk a...
(AI_HYDRA_LEO_MISSING_COMMA)
🔇 Additional comments (9)
AGENTS.md (5)
12-13: LGTM - Clear text rewrappingThe rewrapping improves readability whilst maintaining the original meaning.
28-31: LGTM - Editorial improvements enhance clarityThe text restructuring with proper line breaks and spacing improves readability without altering the substantive guidance.
31-34: LGTM - Consistent formatting appliedThe rewrapping maintains the 80-column guideline whilst preserving the technical content.
46-47: LGTM - LICENSE exception correctly maintainedThe spacing adjustment improves readability whilst correctly preserving the LICENSE naming exception as documented in the retrieved learnings.
167-169: LGTM - Technical content properly formattedThe rewrapping maintains clarity whilst adhering to line length guidelines.
src/breaks.rs (1)
19-42: Excellent documentation with comprehensive exampleThe doc comment clearly explains the function's behaviour and includes a practical example demonstrating both usage and expected output. The en-GB spelling ("standardised") correctly follows the project guidelines.
src/table.rs (3)
9-10: LGTM - Clean regex implementationThe static regex for escaped pipes provides an efficient, reusable pattern for the refactored
split_cellsfunction.
13-30: Excellent documentation with clear examplesThe doc comment provides comprehensive usage examples that demonstrate both basic functionality and escaped pipe handling. The examples clearly show the expected input-output behaviour.
159-177: Comprehensive documentation for new public functionThe doc comment provides a clear description and practical example demonstrating the table reflow functionality. The example effectively shows both input and expected output format.
There was a problem hiding this comment.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
AGENTS.md(4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.md
📄 CodeRabbit Inference Engine (AGENTS.md)
**/*.md: Documentation must use en-GB-oxendict spelling and grammar. (EXCEPTION: the naming of the "LICENSE" file, which is to be left unchanged for community consistency.)
Validate Markdown files usingmake markdownlint.
Runmake fmtafter any documentation changes to format all Markdown files and fix table markup.
Validate Mermaid diagrams in Markdown files by runningmake nixie.
Markdown paragraphs and bullet points must be wrapped at 80 columns.
Code blocks must be wrapped at 120 columns.
Tables and headings must not be wrapped.
Use dashes (-) for list bullets.
Use GitHub-flavoured Markdown footnotes ([^1]) for references and footnotes.
Files:
AGENTS.md
⚙️ CodeRabbit Configuration File
**/*.md: * Avoid 2nd person or 1st person pronouns ("I", "you", "we")
- Use en-GB-oxendict (-ize / -our) spelling and grammar
- Paragraphs and bullets must be wrapped to 80 columns, except where a long URL would prevent this (in which case, silence MD013 for that line)
- Code blocks should be wrapped to 120 columns.
- Headings must not be wrapped.
- Documents must start with a level 1 heading
- Headings must correctly increase or decrease by no more than one level at a time
- Use GitHub-flavoured Markdown style for footnotes and endnotes.
- Numbered footnotes must be numbered by order of appearance in the document.
Files:
AGENTS.md
🧠 Learnings (1)
AGENTS.md (10)
Learnt from: CR
PR: leynos/rstest-bdd#0
File: AGENTS.md:0-0
Timestamp: 2025-07-22T06:27:02.647Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar (with the exception of "license" which is to be left unchanged for community consistency).
Learnt from: CR
PR: leynos/ortho-config#0
File: AGENTS.md:0-0
Timestamp: 2025-07-20T21:31:16.982Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar (with the exception of "license" which is to be left unchanged for community consistency).
Learnt from: CR
PR: leynos/comenq#0
File: AGENTS.md:0-0
Timestamp: 2025-07-27T00:57:05.353Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar. (EXCEPTION: the naming of the "LICENSE" file, which is to be left unchanged for community consistency.)
Learnt from: CR
PR: leynos/lille#0
File: AGENTS.md:0-0
Timestamp: 2025-07-27T12:14:14.253Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar. (EXCEPTION: the naming of the "LICENSE" file, which is to be left unchanged for community consistency.)
Learnt from: CR
PR: leynos/mdtablefix#0
File: AGENTS.md:0-0
Timestamp: 2025-07-29T12:44:22.976Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar. (EXCEPTION: the naming of the "LICENSE" file, which is to be left unchanged for community consistency.)
Learnt from: CR
PR: leynos/ddlint#0
File: AGENTS.md:0-0
Timestamp: 2025-07-18T18:35:14.639Z
Learning: Applies to docs/**/*.md : Documentation must use en-GB-oxendict spelling and grammar (with the exception of "license" which is to be left unchanged for community consistency).
Learnt from: CR
PR: leynos/vk#0
File: AGENTS.md:0-0
Timestamp: 2025-07-27T00:37:06.651Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar, except for the naming of the "LICENSE" file.
Learnt from: CR
PR: leynos/femtologging#0
File: AGENTS.md:0-0
Timestamp: 2025-07-28T19:14:46.188Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar, except for the naming of the "LICENSE" file.
Learnt from: CR
PR: leynos/wireframe#0
File: AGENTS.md:0-0
Timestamp: 2025-07-27T13:30:09.180Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar, except for the naming of the "LICENSE" file.
Learnt from: CR
PR: leynos/netsuke#0
File: AGENTS.md:0-0
Timestamp: 2025-07-27T17:57:57.505Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar, except for the naming of the "LICENSE" file.
🪛 LanguageTool
AGENTS.md
[locale-violation] ~46-~46: LICENSE must be spelled with a “c” when used as a noun in British English. Use “licence”.
Context: ...grammar. (EXCEPTION: the naming of the "LICENSE" file, which is to be left unchanged ...
(LICENCE_LICENSE_NOUN_SINGULAR)
🔇 Additional comments (1)
AGENTS.md (1)
46-47: LGTM – exception wording is correctThe explicit reference to the “LICENSE” filename is intentional and aligns with the documented exception. No changes needed.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
AGENTS.md (1)
12-13: Delete the superfluous comma after “comprehensions”.Maintain smooth flow and stay aligned with prior review guidance.
- logic. Prefer generators or comprehensions, and declarative code to + logic. Prefer generators or comprehensions and declarative code to
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
AGENTS.md(4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.md
⚙️ CodeRabbit Configuration File
**/*.md: * Avoid 2nd person or 1st person pronouns ("I", "you", "we")
- Use en-GB-oxendict (-ize / -our) spelling and grammar
- Paragraphs and bullets must be wrapped to 80 columns, except where a long URL would prevent this (in which case, silence MD013 for that line)
- Code blocks should be wrapped to 120 columns.
- Headings must not be wrapped.
- Documents must start with a level 1 heading
- Headings must correctly increase or decrease by no more than one level at a time
- Use GitHub-flavoured Markdown style for footnotes and endnotes.
- Numbered footnotes must be numbered by order of appearance in the document.
Files:
AGENTS.md
🧠 Learnings (1)
AGENTS.md (10)
Learnt from: CR
PR: leynos/ortho-config#0
File: AGENTS.md:0-0
Timestamp: 2025-07-20T21:31:16.982Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar (with the exception of "license" which is to be left unchanged for community consistency).
Learnt from: CR
PR: leynos/rstest-bdd#0
File: AGENTS.md:0-0
Timestamp: 2025-07-22T06:27:02.647Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar (with the exception of "license" which is to be left unchanged for community consistency).
Learnt from: CR
PR: leynos/comenq#0
File: AGENTS.md:0-0
Timestamp: 2025-07-27T00:57:05.353Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar. (EXCEPTION: the naming of the "LICENSE" file, which is to be left unchanged for community consistency.)
Learnt from: CR
PR: leynos/lille#0
File: AGENTS.md:0-0
Timestamp: 2025-07-27T12:14:14.253Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar. (EXCEPTION: the naming of the "LICENSE" file, which is to be left unchanged for community consistency.)
Learnt from: CR
PR: leynos/mdtablefix#0
File: AGENTS.md:0-0
Timestamp: 2025-07-29T12:44:22.976Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar. (EXCEPTION: the naming of the "LICENSE" file, which is to be left unchanged for community consistency.)
Learnt from: CR
PR: leynos/ddlint#0
File: AGENTS.md:0-0
Timestamp: 2025-07-18T18:35:14.639Z
Learning: Applies to docs/**/*.md : Documentation must use en-GB-oxendict spelling and grammar (with the exception of "license" which is to be left unchanged for community consistency).
Learnt from: CR
PR: leynos/vk#0
File: AGENTS.md:0-0
Timestamp: 2025-07-27T00:37:06.651Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar, except for the naming of the "LICENSE" file.
Learnt from: CR
PR: leynos/femtologging#0
File: AGENTS.md:0-0
Timestamp: 2025-07-28T19:14:46.188Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar, except for the naming of the "LICENSE" file.
Learnt from: CR
PR: leynos/wireframe#0
File: AGENTS.md:0-0
Timestamp: 2025-07-27T13:30:09.180Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar, except for the naming of the "LICENSE" file.
Learnt from: CR
PR: leynos/netsuke#0
File: AGENTS.md:0-0
Timestamp: 2025-07-27T17:57:57.505Z
Learning: Applies to **/*.md : Documentation must use en-GB-oxendict spelling and grammar, except for the naming of the "LICENSE" file.
🪛 LanguageTool
AGENTS.md
[uncategorized] ~33-~33: Do not mix variants of the same word (‘co-locate’ and ‘colocate’) within a single text.
Context: ...broken up by feature and constituents co-located with targets. Large blocks of test data...
(EN_WORD_COHERENCY)
[locale-violation] ~46-~46: LICENSE must be spelled with a “c” when used as a noun in British English. Use “licence”.
Context: ...grammar. (EXCEPTION: the naming of the "LICENSE" file, which is to be left unchanged ...
(LICENCE_LICENSE_NOUN_SINGULAR)
🔇 Additional comments (5)
AGENTS.md (5)
28-30: Usage-example guidance reads well.The re-phrased bullet is clear and within 80-column limits.
31-34: Hyphenation fix accepted.“Co-located” now follows en-GB orthography.
46-47: Licence naming exception correctly retained.No action required.
157-158: Caret-range rationale is concise and correct.Good addition.
160-163: Pronoun agreement fixed.Sentence is now grammatically sound.
Summary
format_breakswith a simple Rustdoc examplesplit_cellsandreflow_tablemake fmt,make lintandmake testTesting
make fmtmake lintmake testhttps://chatgpt.com/codex/tasks/task_e_6888f6653184832283bebd7d9927a75f
Summary by Sourcery
Add usage examples to the Rustdoc comments for table helper functions and refine project documentation formatting.
Documentation:
Chores: