@@ -56,14 +56,14 @@ func TestLsTool_Run(t *testing.T) {
5656 // Create directories
5757 for _ , dir := range testDirs {
5858 dirPath := filepath .Join (tempDir , dir )
59- err := os .MkdirAll (dirPath , 0755 )
59+ err := os .MkdirAll (dirPath , 0o755 )
6060 require .NoError (t , err )
6161 }
6262
6363 // Create files
6464 for _ , file := range testFiles {
6565 filePath := filepath .Join (tempDir , file )
66- err := os .WriteFile (filePath , []byte ("test content" ), 0644 )
66+ err := os .WriteFile (filePath , []byte ("test content" ), 0o644 )
6767 require .NoError (t , err )
6868 }
6969
@@ -83,19 +83,19 @@ func TestLsTool_Run(t *testing.T) {
8383
8484 response , err := tool .Run (context .Background (), call )
8585 require .NoError (t , err )
86-
86+
8787 // Check that visible directories and files are included
8888 assert .Contains (t , response .Content , "dir1" )
8989 assert .Contains (t , response .Content , "dir2" )
9090 assert .Contains (t , response .Content , "dir3" )
9191 assert .Contains (t , response .Content , "file1.txt" )
9292 assert .Contains (t , response .Content , "file2.txt" )
93-
93+
9494 // Check that hidden files and directories are not included
9595 assert .NotContains (t , response .Content , ".hidden_dir" )
9696 assert .NotContains (t , response .Content , ".hidden_file.txt" )
9797 assert .NotContains (t , response .Content , ".hidden_root_file.txt" )
98-
98+
9999 // Check that __pycache__ is not included
100100 assert .NotContains (t , response .Content , "__pycache__" )
101101 })
@@ -122,7 +122,7 @@ func TestLsTool_Run(t *testing.T) {
122122 t .Run ("handles empty path parameter" , func (t * testing.T ) {
123123 // For this test, we need to mock the config.WorkingDirectory function
124124 // Since we can't easily do that, we'll just check that the response doesn't contain an error message
125-
125+
126126 tool := NewLsTool ()
127127 params := LSParams {
128128 Path : "" ,
@@ -138,7 +138,7 @@ func TestLsTool_Run(t *testing.T) {
138138
139139 response , err := tool .Run (context .Background (), call )
140140 require .NoError (t , err )
141-
141+
142142 // The response should either contain a valid directory listing or an error
143143 // We'll just check that it's not empty
144144 assert .NotEmpty (t , response .Content )
@@ -173,11 +173,11 @@ func TestLsTool_Run(t *testing.T) {
173173
174174 response , err := tool .Run (context .Background (), call )
175175 require .NoError (t , err )
176-
176+
177177 // The output format is a tree, so we need to check for specific patterns
178178 // Check that file1.txt is not directly mentioned
179179 assert .NotContains (t , response .Content , "- file1.txt" )
180-
180+
181181 // Check that dir1/ is not directly mentioned
182182 assert .NotContains (t , response .Content , "- dir1/" )
183183 })
@@ -189,12 +189,12 @@ func TestLsTool_Run(t *testing.T) {
189189 defer func () {
190190 os .Chdir (origWd )
191191 }()
192-
192+
193193 // Change to a directory above the temp directory
194194 parentDir := filepath .Dir (tempDir )
195195 err = os .Chdir (parentDir )
196196 require .NoError (t , err )
197-
197+
198198 tool := NewLsTool ()
199199 params := LSParams {
200200 Path : filepath .Base (tempDir ),
@@ -210,7 +210,7 @@ func TestLsTool_Run(t *testing.T) {
210210
211211 response , err := tool .Run (context .Background (), call )
212212 require .NoError (t , err )
213-
213+
214214 // Should list the temp directory contents
215215 assert .Contains (t , response .Content , "dir1" )
216216 assert .Contains (t , response .Content , "file1.txt" )
@@ -291,22 +291,22 @@ func TestCreateFileTree(t *testing.T) {
291291 }
292292
293293 tree := createFileTree (paths )
294-
294+
295295 // Check the structure of the tree
296296 assert .Len (t , tree , 1 ) // Should have one root node
297-
297+
298298 // Check the root node
299299 rootNode := tree [0 ]
300300 assert .Equal (t , "path" , rootNode .Name )
301301 assert .Equal (t , "directory" , rootNode .Type )
302302 assert .Len (t , rootNode .Children , 1 )
303-
303+
304304 // Check the "to" node
305305 toNode := rootNode .Children [0 ]
306306 assert .Equal (t , "to" , toNode .Name )
307307 assert .Equal (t , "directory" , toNode .Type )
308308 assert .Len (t , toNode .Children , 3 ) // file1.txt, dir1, dir2
309-
309+
310310 // Find the dir1 node
311311 var dir1Node * TreeNode
312312 for _ , child := range toNode .Children {
@@ -315,7 +315,7 @@ func TestCreateFileTree(t *testing.T) {
315315 break
316316 }
317317 }
318-
318+
319319 require .NotNil (t , dir1Node )
320320 assert .Equal (t , "directory" , dir1Node .Type )
321321 assert .Len (t , dir1Node .Children , 2 ) // file2.txt and subdir
@@ -354,9 +354,9 @@ func TestPrintTree(t *testing.T) {
354354 Type : "file" ,
355355 },
356356 }
357-
357+
358358 result := printTree (tree , "/root" )
359-
359+
360360 // Check the output format
361361 assert .Contains (t , result , "- /root/" )
362362 assert .Contains (t , result , " - dir1/" )
@@ -390,22 +390,22 @@ func TestListDirectory(t *testing.T) {
390390 // Create directories
391391 for _ , dir := range testDirs {
392392 dirPath := filepath .Join (tempDir , dir )
393- err := os .MkdirAll (dirPath , 0755 )
393+ err := os .MkdirAll (dirPath , 0o755 )
394394 require .NoError (t , err )
395395 }
396396
397397 // Create files
398398 for _ , file := range testFiles {
399399 filePath := filepath .Join (tempDir , file )
400- err := os .WriteFile (filePath , []byte ("test content" ), 0644 )
400+ err := os .WriteFile (filePath , []byte ("test content" ), 0o644 )
401401 require .NoError (t , err )
402402 }
403403
404404 t .Run ("lists files with no limit" , func (t * testing.T ) {
405405 files , truncated , err := listDirectory (tempDir , []string {}, 1000 )
406406 require .NoError (t , err )
407407 assert .False (t , truncated )
408-
408+
409409 // Check that visible files and directories are included
410410 containsPath := func (paths []string , target string ) bool {
411411 targetPath := filepath .Join (tempDir , target )
@@ -416,12 +416,12 @@ func TestListDirectory(t *testing.T) {
416416 }
417417 return false
418418 }
419-
419+
420420 assert .True (t , containsPath (files , "dir1" ))
421421 assert .True (t , containsPath (files , "file1.txt" ))
422422 assert .True (t , containsPath (files , "file2.txt" ))
423423 assert .True (t , containsPath (files , "dir1/file3.txt" ))
424-
424+
425425 // Check that hidden files and directories are not included
426426 assert .False (t , containsPath (files , ".hidden_dir" ))
427427 assert .False (t , containsPath (files , ".hidden_file.txt" ))
@@ -438,12 +438,12 @@ func TestListDirectory(t *testing.T) {
438438 files , truncated , err := listDirectory (tempDir , []string {"*.txt" }, 1000 )
439439 require .NoError (t , err )
440440 assert .False (t , truncated )
441-
441+
442442 // Check that no .txt files are included
443443 for _ , file := range files {
444444 assert .False (t , strings .HasSuffix (file , ".txt" ), "Found .txt file: %s" , file )
445445 }
446-
446+
447447 // But directories should still be included
448448 containsDir := false
449449 for _ , file := range files {
@@ -454,4 +454,4 @@ func TestListDirectory(t *testing.T) {
454454 }
455455 assert .True (t , containsDir )
456456 })
457- }
457+ }
0 commit comments