{"id":30897635,"url":"https://github.com/ry-sun/rust-pre-commit-hooks","last_synced_at":"2025-09-09T00:43:26.388Z","repository":{"id":269592419,"uuid":"907855378","full_name":"ry-sun/rust-pre-commit-hooks","owner":"ry-sun","description":"A set of pre-commit hooks for Rust projects","archived":false,"fork":false,"pushed_at":"2025-05-25T10:48:48.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-05T11:54:12.191Z","etag":null,"topics":["clippy","developer-tools","pre-commit","pre-commit-hook","pre-commit-hooks","rust","rustfmt"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ry-sun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-12-24T15:01:50.000Z","updated_at":"2025-05-25T10:48:05.000Z","dependencies_parsed_at":"2025-06-05T11:54:19.325Z","dependency_job_id":"ffba0c06-3169-4afa-82a5-7ee96764a4af","html_url":"https://github.com/ry-sun/rust-pre-commit-hooks","commit_stats":null,"previous_names":["rockmagma02/rust-pre-commit-hooks","ry-sun/rust-pre-commit-hooks"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ry-sun/rust-pre-commit-hooks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ry-sun%2Frust-pre-commit-hooks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ry-sun%2Frust-pre-commit-hooks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ry-sun%2Frust-pre-commit-hooks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ry-sun%2Frust-pre-commit-hooks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ry-sun","download_url":"https://codeload.github.com/ry-sun/rust-pre-commit-hooks/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ry-sun%2Frust-pre-commit-hooks/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274231036,"owners_count":25245687,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clippy","developer-tools","pre-commit","pre-commit-hook","pre-commit-hooks","rust","rustfmt"],"created_at":"2025-09-09T00:43:25.007Z","updated_at":"2025-09-09T00:43:26.372Z","avatar_url":"https://github.com/ry-sun.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- markdownlint-disable no-inline-html first-line-heading no-emphasis-as-heading ol-prefix --\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n# Rust Pre-Commit Hooks\n\n**A set of pre-commit hooks for Rust projects**\n\n[![GitHub License](https://img.shields.io/github/license/rockmagma02/rust-pre-commit-hooks)](https://github.com/rockmagma02/rust-pre-commit-hooks/blob/main/LICENSE)\n[![GitHub Release](https://img.shields.io/github/v/release/rockmagma02/rust-pre-commit-hooks)](https://github.com/rockmagma02/rust-pre-commit-hooks/releases)\n[![GitHub Issues or Pull Requests](https://img.shields.io/github/issues/rockmagma02/rust-pre-commit-hooks)](https://github.com/rockmagma02/rust-pre-commit-hooks/issues)\n[![GitHub Issues or Pull Requests](https://img.shields.io/github/issues-pr/rockmagma02/rust-pre-commit-hooks)](https://github.com/rockmagma02/rust-pre-commit-hooks/pulls)\n[![Static Badge](https://img.shields.io/badge/pre--commit-hooks-blue)](https://pre-commit.com/)\n![GitHub Repo stars](https://img.shields.io/github/stars/rockmagma02/rust-pre-commit-hooks)\n\n\u003c/div\u003e\n\n## Table of Contents\n\n\u003c!-- markdownlint-disable ul-indent --\u003e\n\n- [Table of Contents](#table-of-contents)\n- [Implementation](#implementation)\n- [Hooks](#hooks)\n  - [Code Formatting](#code-formatting)\n  - [Linting](#linting)\n  - [Example](#example)\n- [Known Issues](#known-issues)\n- [License](#license)\n\n\u003c!-- markdownlint-enable ul-indent --\u003e\n\n## Implementation\n\nThis project uses a `build.rs` script to automatically install and configure necessary Rust components (rustfmt and clippy) for all installed toolchains. The build script:\n\n1. Detects all installed Rust toolchains\n2. Installs `rustfmt` and `clippy` components for each toolchain\n3. Ensures rustup is properly initialized\n\nThis approach ensures that the pre-commit hooks will work correctly regardless of which Rust toolchain you're using.\n\n## Hooks\n\nThe following pre-commit hooks are available:\n\n### Code Formatting\n\n- **rustfmt**: Formats individual Rust files using `rustfmt`\n  - ID: `rustfmt`\n  - Runs on: `.rs` files\n\n- **cargo-fmt**: Formats all bin and lib files in the current crate\n  - ID: `cargo-fmt`\n  - Runs on entire project\n\n### Linting\n\n- **clippy**: Runs Clippy lints on all crates in the project\n  - ID: `clippy`\n  - Runs on entire project\n\n### Example\n\n```yaml\n# .pre-commit-config.yaml\n\n  - repo: https://github.com/rockmagma02/rust-pre-commit-hooks\n    rev: v0.2.0\n    hooks:\n      - id: rustfmt\n      - id: cargo-fmt\n      - id: clippy\n```\n\n## Known Issues\n\n1. When modifying (install new) Rust toolchains, you may need to reinstall the pre-commit hooks to ensure the components (rustfmt and clippy) are properly installed for the new toolchain.\n\n   ```bash\n   pre-commit uninstall\n   pre-commit clean\n   pre-commit install\n   ```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/rockmagma02/rust-pre-commit-hooks/blob/main/LICENSE) file for details.\n\nThe MIT License is a permissive license that allows you to use, modify, and distribute this software for any purpose, provided that the license and copyright notice are included.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fry-sun%2Frust-pre-commit-hooks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fry-sun%2Frust-pre-commit-hooks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fry-sun%2Frust-pre-commit-hooks/lists"}