Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions environment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ var defaultGrepIgnoreDirs = map[string]struct{}{
".git": {},
"node_modules": {},
".flashduty": {}, // covers .flashduty/.work and friends
".kube": {}, // read-only kubeconfigs placed by /init; keep tokens out of greps
}

// Grep searches for a pattern in files.
Expand Down
4 changes: 4 additions & 0 deletions environment/environment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ func TestEnvironment_Grep_DefaultIgnore(t *testing.T) {
require.NoError(t, os.MkdirAll(filepath.Join(ws.Root(), "node_modules", "pkg"), 0o755))
require.NoError(t, os.MkdirAll(filepath.Join(ws.Root(), ".git"), 0o755))

require.NoError(t, os.MkdirAll(filepath.Join(ws.Root(), ".kube"), 0o755))
require.NoError(t, os.WriteFile(filepath.Join(ws.Root(), ".kube", "prod.config"), []byte("token: needle\n"), 0o600))

require.NoError(t, os.WriteFile(filepath.Join(ws.Root(), "src", "a.txt"), []byte("needle\n"), 0o644))
require.NoError(t, os.WriteFile(filepath.Join(ws.Root(), "node_modules", "pkg", "b.txt"), []byte("needle\n"), 0o644))
require.NoError(t, os.WriteFile(filepath.Join(ws.Root(), ".git", "c.txt"), []byte("needle\n"), 0o644))
Expand All @@ -225,6 +228,7 @@ func TestEnvironment_Grep_DefaultIgnore(t *testing.T) {
for _, m := range res.Matches {
assert.NotContains(t, m.Path, "node_modules", "node_modules must be ignored, got %s", m.Path)
assert.NotContains(t, m.Path, ".git", ".git must be ignored, got %s", m.Path)
assert.NotContains(t, m.Path, ".kube", ".kube must be ignored, got %s", m.Path)
}

// The src/ hit must still be present.
Expand Down
Loading