Comments (6)
I definitely think that removal of the config file should not stop normal git flow, a warning (perhaps with instructions to run the new shiny rusty-hook remove command) and allow commits to flow freely w/o a config file makes the most sense to me. My reasoning for this is that from the user’s perspective, once their config file is gone, they don’t want any hooks to be run. My guess is your average user isn’t trying to dig into their .git/hooks folder + wants rusty-hook to take care of everything for them. It follows then that removing their configuration file should remove all hook behavior.
from rusty-hook.
My various opinions here...
Regardless of how the configuration file becomes missing, I think having an error that signals to the user as to why the git hooks are failing is definitely warranted. I can see it being frustrating that things stop working with no specific reasoning given and any help we can provide the user to help them solve their issue makes sense to have.
That said, I think the default behavior for a missing configuration file should simply be a message indicating that the "rusty-hook.toml file is missing" and the process should continue to correctly fail. Specifically, I don't think this use case warrants building in user customization for a single default value.
As far as the removal of rusty-hook, I do think having a documented section/subsection in the README on "how to remove rusty-hook" should cover this scenario well enough for now. While having a command built into the CLI to remove any generated files is neat, it may be overkill when the solution really comes down to "delete all these files" vs "delete this one file"
To that point though, it may also be helpful to make it more clear in the documentation that "both a configuration file and other files/scripts are generated" so that in a "removal" section it is better understood that it is not only the configuration file that needs to be removed.
@calebcartwright
Thoughts?
from rusty-hook.
Thanks Travis! The core question here is the behavior we want for the git hooks themselves.
Currently, the hook scripts fail when there's any non-zero return code from rusty-hook which completely exits the git workflow. There's no differentiation between missing config, the configured command (test, lint, etc.) failing, etc. The proposal here is to update the the git hooks to handle the non-zero return codes a bit more intelligently, specifically to handle the "no config file" in such a way that the git hooks are no longer going to fail out when the config file is missing.
It sounds like you are voting against that proposal. Do I have that correct @traviskosarek?
from rusty-hook.
Also
As far as the removal of rusty-hook, I do think having a documented section/subsection in the README on "how to remove rusty-hook" should cover this scenario well enough for now. While having a command built into the CLI to remove any generated files is neat, it may be overkill when the solution really comes down to "delete all these files" vs "delete this one file"
To that point though, it may also be helpful to make it more clear in the documentation that "both a configuration file and other files/scripts are generated" so that in a "removal" section it is better understood that it is not only the configuration file that needs to be removed.
Agreed, see #51
While having a command built into the CLI to remove any generated files is neat, it may be overkill
Disagree with this part, but a little off topic for this issue. Let's discuss the remove
command in #5
from rusty-hook.
Ahh I didn't mean to vote against the proposed change. I like following the pattern that husky has set, although I think it is better to give the user a message versus failing silently. Based on the PR #53, I am definitely good with this solution.
from rusty-hook.
@EverlastingBugstopper - we've completely revamped the behavior when the config file does not exist. I believe this makes for a much better experience, so want to thank you again for bringing this to our attention.
If you're interested and willing to test this update (no worries if not!), we'd really appreciate your feedback on this new behavior. To test the new version:
(since you likely have the older version on your system)
cargo install rusty-hook --force
Then in a new/sample project, either run rusty-hook init
or add rusty-hook = "0.9.0"
as a dev dependency and run cargo test
. Finally, delete the generated .rusty-hook.toml
file and then run a git commit.
from rusty-hook.
Related Issues (20)
- Exit gracefully from hook scripts when requisite bins missing
- Don't attempt to init during bin install
- Fix clippy warnings
- Setup Testspace publishing
- Switch to GitHub Actions
- Hooks fail when using toml array syntax for multi-commands in rusty-hook.toml HOT 2
- Allow for alternative path for config HOT 7
- constantly upgrading HOT 10
- Rename existing commit hooks HOT 1
- Improve handling of projects in sub-directories HOT 12
- Clarify/document hook commands executed in git root directory
- Document git hook files are automanaged HOT 1
- error: Found argument '' which wasn't expected, or isn't valid in this context HOT 7
- Release `0.12.0` ? HOT 3
- Differences to the altenative? HOT 2
- The git arguments are not properly passed by `%rh!` HOT 2
- Allow setting environment variables and map them with specific hook HOT 2
- Invalid rusty-hook config file HOT 1
- Pre-push hook does not work when it has a list as value HOT 1
- Using a custom script HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rusty-hook.