-
Notifications
You must be signed in to change notification settings - Fork 13
fix(cli): clippy errors in tests #330
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
fix(cli): clippy errors in tests #330
Conversation
- Add dead_code flag to footer and raw of Message struct
WalkthroughThe recent changes enhance the Changes
Sequence Diagram(s)sequenceDiagram
participant Test
participant Message
Test->>Message: Initialize with footers and raw fields
Message-->>Test: Return initialized Message
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (6)
- src/message.rs (1 hunks)
- src/rule/description_format.rs (3 hunks)
- src/rule/scope.rs (4 hunks)
- src/rule/scope_format.rs (3 hunks)
- src/rule/type.rs (4 hunks)
- src/rule/type_format.rs (3 hunks)
Files skipped from review due to trivial changes (4)
- src/rule/description_format.rs
- src/rule/scope.rs
- src/rule/type.rs
- src/rule/type_format.rs
Additional comments not posted (5)
src/message.rs (2)
27-29: LGTM! But verify the field usage in the codebase.The addition of the
footersfield enhances theMessagestruct's ability to encapsulate more comprehensive commit message data.However, ensure that the
footersfield is used appropriately in the codebase.
31-33: LGTM! But verify the field usage in the codebase.The addition of the
rawfield enhances theMessagestruct's ability to encapsulate more comprehensive commit message data.However, ensure that the
rawfield is used appropriately in the codebase.Verification successful
The
rawfield is actively used in the codebase.The
rawfield is utilized in thenewfunction for initializing theMessagestruct and in various validation rules across multiple files in thesrc/rule/directory. This confirms that the field is not dead code and is appropriately integrated into the codebase.
- Files and locations where
rawis used:
src/message.rs- Multiple files within the
src/rule/directoryScripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the `raw` field in the codebase. # Test: Search for the field usage. Expect: Occurrences of `raw` field in the codebase. rg --type rust -A 5 $'raw'Length of output: 16640
src/rule/scope_format.rs (3)
81-84: LGTM!The change enhances readability and eliminates the need for mutable state, promoting a more functional style of programming.
101-104: LGTM!The change enhances readability and eliminates the need for mutable state, promoting a more functional style of programming.
127-130: LGTM!The change enhances readability and eliminates the need for mutable state, promoting a more functional style of programming.
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.
Thank you for your PR!
Overall LGTM, I have one request!
src/message.rs
Outdated
| /// Description part of the commit message. | ||
| pub description: Option<String>, | ||
|
|
||
| #[allow(dead_code)] |
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.
I recently added a rule for footers, so this is not dead anymore: #327
Could you remove it from this field?
Thank you!
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.
Actionable comments posted: 0
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.
LGTM, thank you!!!
Why
When I run clippy with few parameters, I'm getting errors on the tests where unnecessary mut is defined.
That is not proper way to declare variables in Rust, so as best practice should be avoided even in test code.
This is the command to show the errors on main branch:
cargo clippy --workspace --keep-going --all-targets -- -D warningsSummary by CodeRabbit
New Features
Messagestruct for enhanced commit message metadata.Refactor
Bug Fixes