Skip to content

Commit 01e86f0

Browse files
committed
fix: remove unused/unneeded validateSettingsMap function
1 parent 02f507c commit 01e86f0

File tree

2 files changed

+43
-52
lines changed

2 files changed

+43
-52
lines changed

pkg/agentfs/docker.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,15 +277,15 @@ func validateYarnProject(dir string, silent bool) {
277277
func validateYarnBerryProject(dir string, silent bool) {
278278
yarnLockPath := filepath.Join(dir, "yarn.lock")
279279
yarnrcPath := filepath.Join(dir, ".yarnrc.yml")
280-
280+
281281
if _, err := os.Stat(yarnLockPath); err != nil {
282282
if !silent {
283283
fmt.Printf("! Warning: Yarn Berry project detected but %s file not found\n", util.Accented("yarn.lock"))
284284
fmt.Printf(" Consider running %s to generate %s for reproducible builds\n", util.Accented("yarn install"), util.Accented("yarn.lock"))
285285
fmt.Printf(" This ensures consistent dependency versions across environments\n\n")
286286
}
287287
}
288-
288+
289289
if _, err := os.Stat(yarnrcPath); err != nil {
290290
if !silent {
291291
fmt.Printf("! Warning: Yarn Berry project detected but %s file not found\n", util.Accented(".yarnrc.yml"))

pkg/agentfs/utils.go

Lines changed: 41 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ import (
2929
type ProjectType string
3030

3131
const (
32-
ProjectTypePythonPip ProjectType = "python.pip"
33-
ProjectTypePythonUV ProjectType = "python.uv"
34-
ProjectTypePythonPoetry ProjectType = "python.poetry"
35-
ProjectTypePythonHatch ProjectType = "python.hatch"
36-
ProjectTypePythonPDM ProjectType = "python.pdm"
37-
ProjectTypePythonPipenv ProjectType = "python.pipenv"
32+
ProjectTypePythonPip ProjectType = "python.pip"
33+
ProjectTypePythonUV ProjectType = "python.uv"
34+
ProjectTypePythonPoetry ProjectType = "python.poetry"
35+
ProjectTypePythonHatch ProjectType = "python.hatch"
36+
ProjectTypePythonPDM ProjectType = "python.pdm"
37+
ProjectTypePythonPipenv ProjectType = "python.pipenv"
3838
ProjectTypeNodeNPM ProjectType = "node.npm"
3939
ProjectTypeNodePNPM ProjectType = "node.pnpm"
4040
ProjectTypeNodeYarn ProjectType = "node.yarn"
@@ -77,66 +77,66 @@ func LocateLockfile(dir string, p ProjectType) (bool, string) {
7777
// Define files to check based on project type
7878
// Prioritize actual lock files over dependency manifests
7979
var filesToCheck []string
80-
80+
8181
switch p {
8282
case ProjectTypePythonPip:
8383
filesToCheck = []string{
84-
"requirements.lock", // Lock file (if exists)
85-
"pyproject.toml", // Modern Python project file
86-
"requirements.txt", // Legacy pip dependencies
84+
"requirements.lock", // Lock file (if exists)
85+
"pyproject.toml", // Modern Python project file
86+
"requirements.txt", // Legacy pip dependencies
8787
}
8888
case ProjectTypePythonUV:
8989
filesToCheck = []string{
90-
"uv.lock", // UV lock file (highest priority)
91-
"pyproject.toml", // UV uses pyproject.toml
92-
"requirements.txt", // Fallback
90+
"uv.lock", // UV lock file (highest priority)
91+
"pyproject.toml", // UV uses pyproject.toml
92+
"requirements.txt", // Fallback
9393
}
9494
case ProjectTypePythonPoetry:
9595
filesToCheck = []string{
96-
"poetry.lock", // Poetry lock file (highest priority)
97-
"pyproject.toml", // Poetry configuration
96+
"poetry.lock", // Poetry lock file (highest priority)
97+
"pyproject.toml", // Poetry configuration
9898
}
9999
case ProjectTypePythonHatch:
100100
filesToCheck = []string{
101-
"pyproject.toml", // Hatch uses pyproject.toml
102-
"hatch.toml", // Optional Hatch configuration
101+
"pyproject.toml", // Hatch uses pyproject.toml
102+
"hatch.toml", // Optional Hatch configuration
103103
}
104104
case ProjectTypePythonPDM:
105105
filesToCheck = []string{
106-
"pdm.lock", // PDM lock file (highest priority)
107-
"pyproject.toml", // PDM configuration
108-
".pdm.toml", // Local PDM configuration
106+
"pdm.lock", // PDM lock file (highest priority)
107+
"pyproject.toml", // PDM configuration
108+
".pdm.toml", // Local PDM configuration
109109
}
110110
case ProjectTypePythonPipenv:
111111
filesToCheck = []string{
112-
"Pipfile.lock", // Pipenv lock file (highest priority)
113-
"Pipfile", // Pipenv configuration
112+
"Pipfile.lock", // Pipenv lock file (highest priority)
113+
"Pipfile", // Pipenv configuration
114114
}
115115
case ProjectTypeNodeNPM:
116116
filesToCheck = []string{
117-
"package-lock.json", // npm lock file (highest priority)
118-
"package.json", // Package manifest (fallback)
117+
"package-lock.json", // npm lock file (highest priority)
118+
"package.json", // Package manifest (fallback)
119119
}
120120
case ProjectTypeNodePNPM:
121121
filesToCheck = []string{
122-
"pnpm-lock.yaml", // pnpm lock file (highest priority)
123-
"package.json", // Package manifest (fallback)
122+
"pnpm-lock.yaml", // pnpm lock file (highest priority)
123+
"package.json", // Package manifest (fallback)
124124
}
125125
case ProjectTypeNodeYarn:
126126
filesToCheck = []string{
127-
"yarn.lock", // Yarn lock file (highest priority)
128-
"package.json", // Package manifest (fallback)
127+
"yarn.lock", // Yarn lock file (highest priority)
128+
"package.json", // Package manifest (fallback)
129129
}
130130
case ProjectTypeNodeYarnBerry:
131131
filesToCheck = []string{
132-
"yarn.lock", // Yarn lock file (highest priority)
133-
".yarnrc.yml", // Yarn Berry configuration
134-
"package.json", // Package manifest (fallback)
132+
"yarn.lock", // Yarn lock file (highest priority)
133+
".yarnrc.yml", // Yarn Berry configuration
134+
"package.json", // Package manifest (fallback)
135135
}
136136
case ProjectTypeNodeBun:
137137
filesToCheck = []string{
138-
"bun.lockb", // Bun lock file (highest priority, binary format)
139-
"package.json", // Package manifest (fallback)
138+
"bun.lockb", // Bun lock file (highest priority, binary format)
139+
"package.json", // Package manifest (fallback)
140140
}
141141
default:
142142
return false, ""
@@ -148,7 +148,7 @@ func LocateLockfile(dir string, p ProjectType) (bool, string) {
148148
return true, filename
149149
}
150150
}
151-
151+
152152
return false, ""
153153
}
154154

@@ -159,22 +159,22 @@ func DetectProjectType(dir string) (ProjectType, error) {
159159
if util.FileExists(dir, "bun.lockb") {
160160
return ProjectTypeNodeBun, nil
161161
}
162-
162+
163163
// Check for pnpm (most definitive pnpm indicator)
164164
if util.FileExists(dir, "pnpm-lock.yaml") {
165165
return ProjectTypeNodePNPM, nil
166166
}
167-
167+
168168
// Check for Yarn Berry (yarn.lock WITH .yarnrc.yml means Yarn v2+)
169169
if util.FileExists(dir, "yarn.lock") && util.FileExists(dir, ".yarnrc.yml") {
170170
return ProjectTypeNodeYarnBerry, nil
171171
}
172-
172+
173173
// Check for Yarn Classic (yarn.lock without .yarnrc.yml means Yarn v1)
174174
if util.FileExists(dir, "yarn.lock") {
175175
return ProjectTypeNodeYarn, nil
176176
}
177-
177+
178178
// Fall back to npm for other Node.js projects
179179
if util.FileExists(dir, "package.json") || util.FileExists(dir, "package-lock.json") {
180180
return ProjectTypeNodeNPM, nil
@@ -190,12 +190,12 @@ func DetectProjectType(dir string) (ProjectType, error) {
190190
if util.FileExists(dir, "poetry.lock") {
191191
return ProjectTypePythonPoetry, nil
192192
}
193-
193+
194194
// 3. Check for PDM lock file (most definitive PDM indicator)
195195
if util.FileExists(dir, "pdm.lock") {
196196
return ProjectTypePythonPDM, nil
197197
}
198-
198+
199199
// 4. Check for Pipenv lock file (most definitive Pipenv indicator)
200200
if util.FileExists(dir, "Pipfile.lock") {
201201
return ProjectTypePythonPipenv, nil
@@ -205,7 +205,7 @@ func DetectProjectType(dir string) (ProjectType, error) {
205205
if util.FileExists(dir, "Pipfile") {
206206
return ProjectTypePythonPipenv, nil
207207
}
208-
208+
209209
// 6. Check for requirements.txt (classic pip setup)
210210
if util.FileExists(dir, "requirements.txt") {
211211
return ProjectTypePythonPip, nil
@@ -290,12 +290,3 @@ func ParseMem(mem string, suffix bool) (string, error) {
290290
}
291291
return fmt.Sprintf("%.2g", memGB), nil
292292
}
293-
294-
func validateSettingsMap(settingsMap map[string]string, keys []string) error {
295-
for _, key := range keys {
296-
if _, ok := settingsMap[key]; !ok {
297-
return fmt.Errorf("client setting %s is required, please try again later", key)
298-
}
299-
}
300-
return nil
301-
}

0 commit comments

Comments
 (0)