-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support .lefthook.yml
and .lefthook-local.yml
#520
Support .lefthook.yml
and .lefthook-local.yml
#520
Conversation
codecov seemed to decrease but new missed lines seem to be similar to existing ones? |
internal/lefthook/install.go
Outdated
file := filepath.Join(path, config.DefaultConfigName) | ||
file := filepath.Join(path, config.DefaultDotConfigName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep this behavior unchanged? We'll change this in later major release. I think it would be great to just support .lefthook.yml
and .lefthook-local.yml
by now, fix possible issue, decide on what to do when both variants exist and so on. So, this transition will be smooth. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds good! The docs don't mention of the dot-prefixed variants so keeping the behavior unchanged means there is no chance of confusion if one is generated or has priority over the non-dot-prefixed variants.
Thank you for the PR! 🎉 I like the code. I've left a few comments about the default behavior.
Let's keep this behavior unchanged? Then we can release this PR with just a minor/patch version and polish it before making
You are right! I will fix it myself, you don't have to fix this in this PR, thank you for noticing! |
@@ -614,12 +614,16 @@ pre-push: | |||
} | |||
|
|||
t.Run(fmt.Sprintf("%d: %s", i, tt.name), func(t *testing.T) { | |||
if err := fs.WriteFile(filepath.Join(root, "lefthook.yml"), []byte(tt.global), 0o644); err != nil { | |||
t.Errorf("unexpected error: %s", err) | |||
if tt.global != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only write to the config file if we explicitly specify its content. That way, if .lefthook.yml
is written to, an empty lefthook.yml
doesn't always take precedence
Closes #319
⚡ Summary
This supports the new
.lefthook*
formats:.lefthook.yml
if one doesn't already exist.-local
(.local
was suggested, but this is easier and in line with the scripts directory)I was wondering some other things:
☑️ Checklist