fix(deps): update module github.com/vbatts/git-validation to v1.2.1

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
renovate[bot]
2023-10-23 17:03:31 +00:00
committed by GitHub
parent 19c870da0d
commit a8e1a5ed1b
38 changed files with 3651 additions and 17 deletions

View File

@@ -75,7 +75,6 @@ func SanitizeFilters(filtStr string) (filters []string) {
//
// Some `includes` rules have values assigned to them.
// i.e. -run "dco,message_regexp='^JIRA-[0-9]+ [A-Z].*$'"
//
func FilterRules(rules []Rule, includes []string) []Rule {
ret := []Rule{}
@@ -83,7 +82,7 @@ func FilterRules(rules []Rule, includes []string) []Rule {
for i := range includes {
if strings.Contains(includes[i], "=") {
chunks := strings.SplitN(includes[i], "=", 2)
if strings.ToLower(r.Name) == strings.ToLower(chunks[0]) {
if strings.EqualFold(r.Name, chunks[0]) {
// for these rules, the Name won't be unique per se. There may be
// multiple "regexp=" with different values. We'll need to set the
// .Value = chunk[1] and ensure r is dup'ed so they don't clobber
@@ -93,7 +92,7 @@ func FilterRules(rules []Rule, includes []string) []Rule {
ret = append(ret, newR)
}
} else {
if strings.ToLower(r.Name) == strings.ToLower(includes[i]) {
if strings.EqualFold(r.Name, includes[i]) {
ret = append(ret, r)
}
}

View File

@@ -5,6 +5,7 @@ import (
"os"
"path/filepath"
"github.com/sirupsen/logrus"
"github.com/vbatts/git-validation/git"
)
@@ -29,7 +30,11 @@ func NewRunner(root string, rules []Rule, commitrange string, verbose bool) (*Ru
if err != nil {
return nil, err
}
defer os.Chdir(cwd)
defer func() {
if err := os.Chdir(cwd); err != nil {
logrus.Warnf("changing working directory to %q failed: %s", cwd, err)
}
}()
if err := os.Chdir(newroot); err != nil {
return nil, err
@@ -56,7 +61,11 @@ func (r *Runner) Run() error {
if err != nil {
return err
}
defer os.Chdir(cwd)
defer func() {
if err := os.Chdir(cwd); err != nil {
logrus.Warnf("changing working directory to %q failed: %s", cwd, err)
}
}()
if err := os.Chdir(r.Root); err != nil {
return err