MCPcopy
hub / github.com/larksuite/cli / errorFactFiles

Function errorFactFiles

internal/qualitygate/rules/errorfacts.go:981–1008  ·  view source on GitHub ↗
(repo string, changedFiles []string, changedOnly bool)

Source from the content-addressed store, hash-verified

979}
980
981func errorFactFiles(repo string, changedFiles []string, changedOnly bool) ([]string, error) {
982 if changedOnly {
983 var out []string
984 for _, path := range changedFiles {
985 path = filepath.ToSlash(path)
986 if isErrorFactGoFile(path) {
987 if _, err := vfs.Stat(filepath.Join(repo, filepath.FromSlash(path))); err != nil {
988 if os.IsNotExist(err) {
989 continue
990 }
991 return nil, err
992 }
993 out = append(out, path)
994 }
995 }
996 sort.Strings(out)
997 return out, nil
998 }
999
1000 var out []string
1001 for _, root := range []string{"cmd", "shortcuts"} {
1002 if err := walkErrorFactFiles(repo, root, &out); err != nil {
1003 return nil, err
1004 }
1005 }
1006 sort.Strings(out)
1007 return out, nil
1008}
1009
1010func walkErrorFactFiles(repo, rel string, out *[]string) error {
1011 entries, err := vfs.ReadDir(filepath.Join(repo, filepath.FromSlash(rel)))

Callers 1

CollectRepoErrorFactsFunction · 0.85

Calls 3

StatFunction · 0.92
isErrorFactGoFileFunction · 0.85
walkErrorFactFilesFunction · 0.85

Tested by

no test coverage detected