|
| 1 | +# Frequently Asked Questions |
| 2 | + |
| 3 | +## General Questions |
| 4 | + |
| 5 | +### What is RustyHook? |
| 6 | + |
| 7 | +RustyHook is a blazing-fast, Rust-native Git hook runner designed to be a modern, drop-in replacement for `pre-commit`. It is language-agnostic, monorepo-friendly, and automatically provisions environments for linters and checkers written in Python, Node.js, Ruby, and more. |
| 8 | + |
| 9 | +### How does RustyHook compare to pre-commit? |
| 10 | + |
| 11 | +RustyHook is designed to be a faster, more efficient alternative to pre-commit with these key advantages: |
| 12 | +- Written in Rust for better performance |
| 13 | +- Concurrent hook execution |
| 14 | +- Native support for monorepos |
| 15 | +- Automatic environment setup for multiple languages |
| 16 | +- Compatible with existing pre-commit configurations |
| 17 | + |
| 18 | +### Is RustyHook compatible with pre-commit configurations? |
| 19 | + |
| 20 | +Yes! RustyHook can run your existing `.pre-commit-config.yaml` files using the `rh compat` command. You can also convert your pre-commit configuration to RustyHook's native format using `rh convert`. |
| 21 | + |
| 22 | +## Installation and Setup |
| 23 | + |
| 24 | +### How do I install RustyHook? |
| 25 | + |
| 26 | +The easiest way to install RustyHook is using Cargo: |
| 27 | + |
| 28 | +```sh |
| 29 | +cargo install rustyhook |
| 30 | +``` |
| 31 | + |
| 32 | +For other installation methods, see the [Installation Guide](user-guide/installation.md). |
| 33 | + |
| 34 | +### How do I set up RustyHook in my project? |
| 35 | + |
| 36 | +To set up RustyHook in your project: |
| 37 | + |
| 38 | +1. Install RustyHook |
| 39 | +2. Initialize a configuration file: |
| 40 | + ```sh |
| 41 | + rh init |
| 42 | + ``` |
| 43 | +3. Edit the `.rustyhook/config.yaml` file to configure your hooks |
| 44 | +4. Install the Git hooks: |
| 45 | + ```sh |
| 46 | + rh install |
| 47 | + ``` |
| 48 | + |
| 49 | +### Can I use RustyHook with CI/CD systems? |
| 50 | + |
| 51 | +Yes, RustyHook works well in CI/CD environments. You can run hooks using: |
| 52 | + |
| 53 | +```sh |
| 54 | +rh run --all-files |
| 55 | +``` |
| 56 | + |
| 57 | +This will run all hooks on all files, not just changed ones. |
| 58 | + |
| 59 | +## Configuration |
| 60 | + |
| 61 | +### How do I configure RustyHook? |
| 62 | + |
| 63 | +RustyHook uses a YAML configuration file located at `.rustyhook/config.yaml`. See the [Configuration Guide](user-guide/configuration.md) for details. |
| 64 | + |
| 65 | +### Can I use RustyHook in a monorepo? |
| 66 | + |
| 67 | +Yes, RustyHook is designed with monorepos in mind. You can have multiple configuration files in different directories, and RustyHook will use the closest configuration file to the Git root. |
| 68 | + |
| 69 | +### How do I add a new hook? |
| 70 | + |
| 71 | +To add a new hook, edit your `.rustyhook/config.yaml` file and add a new entry to the `hooks` array: |
| 72 | + |
| 73 | +```yaml |
| 74 | +hooks: |
| 75 | + - id: my-new-hook |
| 76 | + language: python |
| 77 | + version: "==1.0.0" |
| 78 | + entry: "my-hook-command" |
| 79 | + files: "\\.py$" |
| 80 | +``` |
| 81 | +
|
| 82 | +## Troubleshooting |
| 83 | +
|
| 84 | +### My hooks aren't running. What should I check? |
| 85 | +
|
| 86 | +1. Make sure RustyHook is installed correctly (`rh --version`) |
| 87 | +2. Check that your configuration file is valid (`rh doctor`) |
| 88 | +3. Verify that Git hooks are installed (`ls -la .git/hooks`) |
| 89 | +4. Run hooks manually to see any errors (`rh run --verbose`) |
| 90 | + |
| 91 | +### How do I debug hook failures? |
| 92 | + |
| 93 | +Use the `--verbose` flag to get more detailed output: |
| 94 | + |
| 95 | +```sh |
| 96 | +rh run --verbose |
| 97 | +``` |
| 98 | + |
| 99 | +You can also use the `doctor` command to diagnose issues: |
| 100 | + |
| 101 | +```sh |
| 102 | +rh doctor |
| 103 | +``` |
| 104 | + |
| 105 | +### How do I clean up cached environments? |
| 106 | + |
| 107 | +To clean up cached environments: |
| 108 | + |
| 109 | +```sh |
| 110 | +rh clean --all |
| 111 | +``` |
| 112 | + |
| 113 | +Or to clean only specific language environments: |
| 114 | + |
| 115 | +```sh |
| 116 | +rh clean --language python |
| 117 | +``` |
| 118 | + |
| 119 | +## Advanced Usage |
| 120 | + |
| 121 | +### Can I run hooks on specific files? |
| 122 | + |
| 123 | +Yes, you can run hooks on specific files: |
| 124 | + |
| 125 | +```sh |
| 126 | +rh run --files src/main.rs,src/lib.rs |
| 127 | +``` |
| 128 | + |
| 129 | +### How do I skip hooks for a specific commit? |
| 130 | + |
| 131 | +To skip hooks for a specific commit: |
| 132 | + |
| 133 | +```sh |
| 134 | +git commit --no-verify |
| 135 | +``` |
| 136 | + |
| 137 | +Or with the `-n` shorthand: |
| 138 | + |
| 139 | +```sh |
| 140 | +git commit -n |
| 141 | +``` |
| 142 | + |
| 143 | +### Can I use RustyHook with hooks other than pre-commit? |
| 144 | + |
| 145 | +Yes, RustyHook supports various Git hooks: |
| 146 | + |
| 147 | +```sh |
| 148 | +rh install --hook-type pre-push |
| 149 | +``` |
| 150 | + |
| 151 | +## Contributing |
| 152 | + |
| 153 | +### How can I contribute to RustyHook? |
| 154 | + |
| 155 | +We welcome contributions! See the [Contributing Guide](contributing/development-setup.md) for details on how to get started. |
| 156 | + |
| 157 | +### Where can I report bugs or request features? |
| 158 | + |
| 159 | +You can report bugs or request features on the [GitHub issue tracker](https://github.com/your-org/rustyhook/issues). |
0 commit comments