Skip to content

Comments

chore: add pre-commit hooks and fix clippy/fmt issues#26

Merged
fslongjin merged 5 commits intofslongjin:masterfrom
staryxchen:dev/pre-commit
Feb 24, 2026
Merged

chore: add pre-commit hooks and fix clippy/fmt issues#26
fslongjin merged 5 commits intofslongjin:masterfrom
staryxchen:dev/pre-commit

Conversation

@staryxchen
Copy link
Contributor

Summary

Add pre-commit configuration and fix all code quality issues reported by pre-commit hooks.

Changes

Pre-commit Setup

  • Add .pre-commit-config.yaml with:
    • pre-commit-hooks: trailing-whitespace, end-of-file-fixer, check-yaml, check-toml, check-merge-conflict, check-added-large-files
    • pre-commit-rust: fmt, clippy, cargo-check

Clippy Fixes

  • config.rs: Use #[derive(Default)] + #[default] instead of manual impl Default; rename to_template_levelas_template_level; inline format args
  • template_engine.rs: Follow method rename
  • update_checker.rs: Inline format args; assert_eq!(…, true/false)assert!() / assert!(!…); remove format!("literal")
  • generate.rs: Eliminate let_and_return; unwrap_or_else(|| 0)unwrap_or(0); inline format args
  • sanitizer.rs: loop { if let … break }while let; inline format args
  • main.rs: else { if … }else if …; inline format args
  • text_wrapper/: Fix field_reassign_with_default, module_inception, unused variable; inline format args

Other

  • Add .codebuddy to .gitignore
  • Fix trailing whitespace and end-of-file issues in markdown and yaml files

- 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>
@fslongjin fslongjin merged commit 71dce29 into fslongjin:master Feb 24, 2026
3 checks passed
@staryxchen staryxchen deleted the dev/pre-commit branch February 24, 2026 07:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants