4 ms·
I looked through and there's a bunch of stuff that's in poor coding practice. E.g. https://github.com/kstenerud/yoloai/blob/main/internal/fileutil/fileutil.go
by everforward 5mo ago
I looked through and there's a bunch of stuff that's in poor coding practice.
E.g.
https://github.com/kstenerud/yoloai/blob/main/internal/fileutil/fileutil.go#L54 https://github.com/kstenerud/yoloai/blob/main/internal/fileu... <- that recursively creates directories, but will only change permissions on the innermost dir (user may be unable to cd into intermediary directories)
https://github.com/kstenerud/yoloai/blob/main/internal/mcpsrv/tools.go#L195 https://github.com/kstenerud/yoloai/blob/main/internal/mcpsr... <- all the json.Marshal calls in this file just suppress errors, so if anything un-marshallable ends up in there the app will return empty strings with no errors logged
https://github.com/kstenerud/yoloai/blob/main/runtime/registry.go#L23 https://github.com/kstenerud/yoloai/blob/main/runtime/regist... <- `Register` embeds a copy of the code from `IsAvailable` because of the locking; that could be replaced with a private `isAvailable` that has no locking that both use (after doing their own locking)
https://github.com/kstenerud/yoloai/blob/main/runtime/exec.go https://github.com/kstenerud/yoloai/blob/main/runtime/exec.g... <- these functions are identical except for the strings.Trim, one should just call the other and then trim the output
Just out of curiosity, I enabled some other linters and it looks bad. Excluding test files, there are 110 functions with a cyclomatic complexity over 10 and 7 that are _over 50_. The worst is at 86, which is mind-boggling.
Could probably find more, but you get the drift. I'm sure it runs, but stylistically this is more along the lines of what I would expect an intern to do.
This is also sort of nit-picky, but like half the stuff in https://github.com/kstenerud/yoloai/blob/main/docs/dev/backend-idiosyncrasies.md#osstat-on-the-containerd-socket-does-not-detect-permission-denied https://github.com/kstenerud/yoloai/blob/main/docs/dev/backe... isn't idiosyncratic, it's just the way those things work and a lot of them aren't even tricky. The one linked is particularly blatant; that's not limited to os.Stat that's literally just how permissions work. Denying permission on inodes is a property of the folder, not the file.