Skip to content

Commit

Permalink
yamlfmt_test: re-enable and fix doublestar tests
Browse files Browse the repository at this point in the history
Doublestar tests have been disabled for quite a long time and I honestly
forget why they were. Regardless, they were missing some features to be
properly robust anyway. This PR re-enables the tests and adds two test
cases relevant to google#97 that will be skipped individually for now.
  • Loading branch information
braydonk committed Apr 12, 2023
1 parent 596e973 commit 5b5a098
Show file tree
Hide file tree
Showing 2 changed files with 231 additions and 157 deletions.
9 changes: 1 addition & 8 deletions path_collector.go
Expand Up @@ -2,7 +2,6 @@ package yamlfmt

import (
"io/fs"
"log"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -116,13 +115,7 @@ func (c *DoublestarCollector) CollectPaths() ([]string, error) {
}
excluded := false
for _, pattern := range c.Exclude {
absPath, err := filepath.Abs(path)
if err != nil {
// I wonder how this could ever happen...
log.Printf("could not create absolute path for %s: %v", path, err)
continue
}
match, err := doublestar.PathMatch(filepath.Clean(pattern), absPath)
match, err := doublestar.PathMatch(filepath.Clean(pattern), path)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 5b5a098

Please sign in to comment.