Conversation
Reviewer's GuideThis PR enriches documentation by adding and repositioning doc comments across the logging module and test suites, providing usage examples for logger utilities and clear descriptions for each push and policy test. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Summary by CodeRabbit
Summary by CodeRabbit
WalkthroughAdd descriptive doc comments to test functions, fixtures, and helper methods in Changes
Possibly related PRs
Poem
✨ 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 found some issues that need to be addressed.
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Actionable comments posted: 3
🔭 Outside diff range comments (2)
wireframe_testing/src/logging.rs (1)
67-73: Replace the forbidden#[allow]with a scoped#[expect].
#[allow]violates the project lint policy. Use#[expect]and scope it to the single lint.-#[allow( - unused_braces, - reason = "rustc false positive for single line rstest fixtures" -)] +#[expect(unused_braces, reason = "rustc false positive for single-line rstest fixture")]tests/push_policies.rs (1)
14-18: Replace#[allow]with#[expect]to satisfy lint policy.Same rationale as in
logging.rs.-#[allow( - unused_braces, - reason = "rustc false positive for single line rstest fixtures" -)] +#[expect(unused_braces, reason = "rustc false positive for single-line rstest fixture")]
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
tests/push.rs(8 hunks)tests/push_policies.rs(5 hunks)wireframe_testing/src/logging.rs(3 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`**/*.rs`: Comment why, not what. Explain assumptions, edge cases, trade-offs, o...
**/*.rs: Comment why, not what. Explain assumptions, edge cases, trade-offs, or complexity. Don't echo the obvious.
Comments must use en-GB-oxendict spelling and grammar.
Function documentation must include clear examples.
Every module must begin with a module level (//!) comment explaining the module's purpose and utility.
Document public APIs using Rustdoc comments (///) so documentation can be generated with cargo doc.
Place function attributes after doc comments.
Do not usereturnin single-line functions.
Use predicate functions for conditional criteria with more than two branches.
Lints must not be silenced except as a last resort.
Lint rule suppressions must be tightly scoped and include a clear reason.
Preferexpectoverallow.
Prefer.expect()over.unwrap().
Clippy warnings MUST be disallowed.
Fix any warnings emitted during tests in the code itself rather than silencing them.
Where a function is too long, extract meaningfully named helper functions adhering to separation of concerns and CQRS.
Where a function has too many parameters, group related parameters in meaningfully named structs.
Where a function is returning a large error consider usingArcto reduce the amount of data returned.
Write unit and behavioural tests for new functionality. Run both before and after making any change.
Prefer immutable data and avoid unnecessarymutbindings.
Handle errors with theResulttype instead of panicking where feasible.
Avoidunsafecode unless absolutely necessary and document any usage clearly.
📄 Source: CodeRabbit Inference Engine (AGENTS.md)
List of files the instruction was applied to:
tests/push.rstests/push_policies.rswireframe_testing/src/logging.rs
`**/*.rs`: * Seek to keep the cyclomatic complexity of functions no more than 12...
**/*.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 must use en-GB-oxendict 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/
⚙️ Source: CodeRabbit Configuration File
List of files the instruction was applied to:
tests/push.rstests/push_policies.rswireframe_testing/src/logging.rs
⏰ Context from checks skipped due to timeout of 240000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: build-test
- GitHub Check: Analyze (actions)
🔇 Additional comments (15)
tests/push.rs (8)
9-10: Doc comment reads well.No issues spotted.
26-27: Doc comment reads well.
42-43: Doc comment reads well.
56-57: Doc comment reads well.
92-93: Doc comment reads well.
106-108: Doc comment reads well.
127-129: Doc comment reads well.
141-143: Doc comment reads well.tests/push_policies.rs (7)
27-38: Doc comment reads well.
69-86: Doc comment reads well.
88-92: Doc comment reads well.
93-95: Doc comment reads well.
97-103: Doc comment reads well.
105-107: Doc comment reads well.
108-123: Doc comment reads well.
There was a problem hiding this comment.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
wireframe_testing/src/logging.rs (1)
70-74: Replace forbidden#[allow]with#[expect]and add an# Examplessection.The coding guidelines disallow
#[allow]; use#[expect(lint)]to keep the lint active while acknowledging the known false positive. Also include an example block for consistency with other public items.-#[allow( - unused_braces, - reason = "rustc false positive for single line rstest fixtures" -)] +#[expect(unused_braces, reason = "rustc false positive for single-line rstest fixture")] +/// rstest fixture returning a [`LoggerHandle`] for log assertions. +/// +/// # Examples +/// ``` +/// use wireframe_testing::logger; +/// +/// let mut log = logger(); +/// log::error!("demo"); +/// assert!(log.pop().is_some()); +/// ``` #[fixture] pub fn logger() -> LoggerHandle { LoggerHandle::new() }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
wireframe_testing/src/logging.rs(3 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`**/*.rs`: Comment why, not what. Explain assumptions, edge cases, trade-offs, o...
**/*.rs: Comment why, not what. Explain assumptions, edge cases, trade-offs, or complexity. Don't echo the obvious.
Comments must use en-GB-oxendict spelling and grammar.
Function documentation must include clear examples.
Every module must begin with a module level (//!) comment explaining the module's purpose and utility.
Document public APIs using Rustdoc comments (///) so documentation can be generated with cargo doc.
Place function attributes after doc comments.
Do not usereturnin single-line functions.
Use predicate functions for conditional criteria with more than two branches.
Lints must not be silenced except as a last resort.
Lint rule suppressions must be tightly scoped and include a clear reason.
Preferexpectoverallow.
Prefer.expect()over.unwrap().
Clippy warnings MUST be disallowed.
Fix any warnings emitted during tests in the code itself rather than silencing them.
Where a function is too long, extract meaningfully named helper functions adhering to separation of concerns and CQRS.
Where a function has too many parameters, group related parameters in meaningfully named structs.
Where a function is returning a large error consider usingArcto reduce the amount of data returned.
Write unit and behavioural tests for new functionality. Run both before and after making any change.
Prefer immutable data and avoid unnecessarymutbindings.
Handle errors with theResulttype instead of panicking where feasible.
Avoidunsafecode unless absolutely necessary and document any usage clearly.
📄 Source: CodeRabbit Inference Engine (AGENTS.md)
List of files the instruction was applied to:
wireframe_testing/src/logging.rs
`**/*.rs`: * Seek to keep the cyclomatic complexity of functions no more than 12...
**/*.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 must use en-GB-oxendict 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/
⚙️ Source: CodeRabbit Configuration File
List of files the instruction was applied to:
wireframe_testing/src/logging.rs
⏰ Context from checks skipped due to timeout of 240000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: build-test
- GitHub Check: Analyze (actions)
🔇 Additional comments (2)
wireframe_testing/src/logging.rs (2)
6-17: Remove the#[tokio::test]attribute from the doctest.
rustdocinjects its own test harness. Attribute macros such as#[tokio::test]are rejected in that context and make the doctest fail to compile. Either drop the attribute or add, no_runto the code-block fence so the snippet is compiled but not executed.-//! #[tokio::test] -//! async fn logs_are_collected() { +//! // async context +//! # #[tokio::main] // <-- hides in rendered docs but compiles +//! # async fn main() { //! let mut log = logger(); //! log::info!("example"); //! assert!(log.pop().is_some()); //! } -//! ``` +//! # } +//! ```
42-49: Good addition of example section fornew().The method is now documented in line with std-lib style. No further action required.
| /// serialising access to a [`logtest::Logger`]. Acquire it using [`logger`] or | ||
| /// [`LoggerHandle::new`]. | ||
| /// | ||
| /// # Examples | ||
| /// ``` | ||
| /// use wireframe_testing::logger; | ||
| /// | ||
| /// let mut log = logger(); | ||
| /// log::warn!("warned"); | ||
| /// assert!(log.pop().is_some()); | ||
| /// ``` | ||
| pub struct LoggerHandle { |
There was a problem hiding this comment.
🧹 Nitpick (assertive)
Add the missing # Examples macro import or silence the unused-imports lint.
log::warn! expands to a macro call and triggers the unused_imports lint in doctests when log is not imported explicitly. Import log (hidden with #) to satisfy the lint and keep the rendered docs clean.
/// ```
/// use wireframe_testing::logger;
+/// # use log::warn;
///
/// let mut log = logger();
-/// log::warn!("warned");
+/// warn!("warned");
/// assert!(log.pop().is_some());
/// ```📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /// serialising access to a [`logtest::Logger`]. Acquire it using [`logger`] or | |
| /// [`LoggerHandle::new`]. | |
| /// | |
| /// # Examples | |
| /// ``` | |
| /// use wireframe_testing::logger; | |
| /// | |
| /// let mut log = logger(); | |
| /// log::warn!("warned"); | |
| /// assert!(log.pop().is_some()); | |
| /// ``` | |
| pub struct LoggerHandle { | |
| /// serialising access to a [`logtest::Logger`]. Acquire it using [`logger`] or | |
| /// [`LoggerHandle::new`]. | |
| /// | |
| /// # Examples | |
| /// |
🤖 Prompt for AI Agents
In wireframe_testing/src/logging.rs around lines 26 to 37, the doctest uses the
macro log::warn! without importing the log crate, which triggers the
unused_imports lint. Fix this by adding a hidden import of the log crate in the
doctest with `# use log::warn;` before using the warn! macro, and replace
`log::warn!` with just `warn!` to keep the documentation clean and lint-free.
|
Stale |
Summary
wireframe_testinglogging docsTesting
make lintmake testhttps://chatgpt.com/codex/tasks/task_e_68704f8b047c83228f77d571ea0d49ad
Summary by Sourcery
Add comprehensive documentation comments and examples for logging utilities and push queue tests, and reorganize doc placement for clarity.
Enhancements:
Documentation: