@@ -159,6 +159,7 @@ async def delete_file_or_directory(
159159 """
160160 body = await parse_request (request , cls = FileDeleteRequest )
161161 try :
162+ # TODO: Refactor this side-effect based validation to a dedicated validation.
162163 file_system .get_details (body .path )
163164 success = file_system .delete_file_or_directory (body .path )
164165 return FileDeleteResponse (success = success )
@@ -189,6 +190,7 @@ async def copy_file_or_directory(
189190 """
190191 body = await parse_request (request , cls = FileCopyRequest )
191192 try :
193+ # TODO: Refactor this side-effect based validation to a dedicated validation.
192194 file_system .get_details (body .path )
193195 info = file_system .copy_file_or_directory (body .path , body .new_path )
194196 return FileCopyResponse (success = True , info = info )
@@ -219,6 +221,7 @@ async def move_file_or_directory(
219221 """
220222 body = await parse_request (request , cls = FileMoveRequest )
221223 try :
224+ # TODO: Refactor this side-effect based validation to a dedicated validation.
222225 file_system .get_details (body .path )
223226 info = file_system .move_file_or_directory (body .path , body .new_path )
224227 return FileMoveResponse (success = True , info = info )
@@ -250,6 +253,7 @@ async def update_file(
250253 app_state = AppState (request )
251254 body = await parse_request (request , cls = FileUpdateRequest )
252255 try :
256+ # TODO: Refactor this side-effect based validation to a dedicated validation.
253257 file_system .get_details (body .path )
254258 info = file_system .update_file (body .path , body .contents )
255259
@@ -285,6 +289,7 @@ async def open_file(
285289 """
286290 body = await parse_request (request , cls = FileOpenRequest )
287291 try :
292+ # TODO: Refactor this side-effect based validation to a dedicated validation.
288293 file_system .get_details (body .path )
289294 success = file_system .open_in_editor (body .path , body .line_number )
290295 return SuccessResponse (success = success )
0 commit comments