Skip to content

Commit 8c7aa49

Browse files
committed
Update README with migration instructions from pre-commit
1 parent 884c997 commit 8c7aa49

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

README.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,51 @@ hooks:
7575
7676
## 🔄 Migration from `pre-commit`
7777

78-
RustyHook can run `.pre-commit-config.yaml` directly:
78+
RustyHook is designed to be a drop-in replacement for [pre-commit](https://pre-commit.com/), making migration as seamless as possible.
79+
80+
### Compatibility Mode
81+
82+
The easiest way to start using RustyHook is with compatibility mode, which allows RustyHook to use your existing `.pre-commit-config.yaml` file without any changes:
7983

8084
```sh
8185
rh compat
8286
```
8387

84-
To migrate to native format:
88+
This command will read your `.pre-commit-config.yaml` file, set up the necessary environments, and run the hooks as defined in your pre-commit configuration.
89+
90+
### Converting Your Configuration
91+
92+
While compatibility mode works well, you'll get the best performance and features by converting to RustyHook's native configuration format:
8593

8694
```sh
95+
# Convert pre-commit config to RustyHook config
8796
rh convert --from-precommit > .rustyhook/config.yaml
8897
```
8998

99+
This will create a new `.rustyhook/config.yaml` file based on your existing pre-commit configuration.
100+
101+
### Migrating Git Hooks
102+
103+
If you've installed pre-commit as a Git hook, you'll need to uninstall it and install RustyHook instead:
104+
105+
```sh
106+
# Uninstall pre-commit hooks
107+
pre-commit uninstall
108+
109+
# Install RustyHook hooks
110+
rh install
111+
```
112+
113+
### Key Differences
114+
115+
1. **Repository References**: RustyHook doesn't use the `repos` structure. Instead, it directly defines hooks with their language and version.
116+
2. **Version Specification**: RustyHook uses package version specifiers (`version`) instead of Git revisions (`rev`).
117+
3. **Dependencies**: RustyHook uses `dependencies` instead of `additional_dependencies`.
118+
4. **Entry Point**: RustyHook requires an explicit `entry` field, while pre-commit infers it from the hook ID.
119+
5. **Local Hooks**: RustyHook treats all hooks as "local" by default. There's no need for a special `local` repository designation.
120+
121+
For more detailed information about migrating from pre-commit to RustyHook, see the [Migration Guide](https://your-org.github.io/rustyhook/user-guide/migration.html).
122+
90123
---
91124

92125
## 🧰 Supported Environments

docs/plan.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Tasks:
44
- [x] Update the README to include all the above including the means to install, configure and run
55
- [x] create documentation for the project that can be pushed to github pages using a github action
66
- [x] create a github action to publish the documentation to github pages
7-
- [ ] Update the README to include a section on how to convert from pre-commit to rustyhook
7+
- [x] Update the README to include a section on how to convert from pre-commit to rustyhook
88
- [ ] create a command line tool that can be used to convert a pre-commit configuration file to rustyhook configuration file
99
- [ ] expand all built in hooks to include all known hooks from https://pre-commit.com/hooks.html
1010
- [ ] enable logging to a file or other outputs other than just stdout

0 commit comments

Comments
 (0)