chore: add pre-commit hooks and fix clippy/fmt issues#26
Merged
fslongjin merged 5 commits intofslongjin:masterfrom Feb 24, 2026
Merged
chore: add pre-commit hooks and fix clippy/fmt issues#26fslongjin merged 5 commits intofslongjin:masterfrom
fslongjin merged 5 commits intofslongjin:masterfrom
Conversation
- add .codebuddy/ to .gitignore Signed-off-by: staryxchen <staryxchen@tencent.com>
- Add pre-commit hooks for rustfmt, clippy, and cargo-check - Update documentation Signed-off-by: staryxchen <staryxchen@tencent.com>
- Use `format!` inline variables throughout the codebase.
- Derive `Default` trait for enums instead of manual implementation.
- Replace `loop { if let ... }` patterns with `while let ...`.
- Simplify test configuration initialization using struct update syntax.
- Update assertions from `assert_eq!(..., true)` to `assert!(...)`.
Signed-off-by: staryxchen <staryxchen@tencent.com>
- add trailing-whitespace hook - add end-of-file-fixer hook - add check-yaml hook - add check-toml hook - add check-merge-conflict hook - add check-added-large-files hook Signed-off-by: staryxchen <staryxchen@tencent.com>
- Remove trailing whitespace in workflow, gitignore, and readme files - Ensure newline at end of file in docs/TEXT_WRAPPING.md Signed-off-by: staryxchen <staryxchen@tencent.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add pre-commit configuration and fix all code quality issues reported by pre-commit hooks.
Changes
Pre-commit Setup
.pre-commit-config.yamlwith:trailing-whitespace,end-of-file-fixer,check-yaml,check-toml,check-merge-conflict,check-added-large-filesfmt,clippy,cargo-checkClippy Fixes
config.rs: Use#[derive(Default)]+#[default]instead of manualimpl Default; renameto_template_level→as_template_level; inline format argstemplate_engine.rs: Follow method renameupdate_checker.rs: Inline format args;assert_eq!(…, true/false)→assert!()/assert!(!…); removeformat!("literal")generate.rs: Eliminatelet_and_return;unwrap_or_else(|| 0)→unwrap_or(0); inline format argssanitizer.rs:loop { if let … break }→while let; inline format argsmain.rs:else { if … }→else if …; inline format argstext_wrapper/: Fixfield_reassign_with_default,module_inception, unused variable; inline format argsOther
.codebuddyto.gitignore