errata-ai / vale

:pencil: A markup-aware linter for prose built with speed and extensibility in mind.
https://vale.sh
MIT License
4.3k stars 144 forks source link

vale sync failed to look for config file #798

Closed ccoVeille closed 2 months ago

ccoVeille commented 3 months ago

Check for existing issues

Environment

Linux via Homebrew

$ vale --version
vale version 3.3.1

Describe the bug / provide steps to reproduce it

Here is my conf

$ vale ls-dirs
Asset       | Default Location                               | Found
StylesPath  | /home/whatever/.local/share/vale/styles        | ✓
.vale.ini   | /home/whatever/.config/vale/.vale.ini          | ✓
vale-native | /home/whatever/.config/vale/native/vale-native | ✗
$ cat ~/.config/vale/.vale.ini   

MinAlertLevel = suggestion

Packages = write-good

[*]
BasedOnStyles = Vale, write-good

vale works

$ vale /etc/debian_version
✔ 0 errors, 0 warnings and 0 suggestions in 1 file.

But you cannot use vale sync without using --config

$ vale sync
E100 [.vale.ini not found] Runtime error

no config file found

Execution stopped with code 1.

And it works when asking to use the config file reported with vale ls-dirs

$ vale sync --config ~/.config/vale/.vale.ini
Syncing write-good [1/1] █████████████████████████████████████████████ 100% | 0s
SUCCESS  Synced 1 package(s) to '/home/whatever/.local/share/vale/styles'.

Expected behavior, be able to use vale sync without having to use a --config parameter

Here is an strace of what the code tries to locate

newfstatat(AT_FDCWD, "/home/whatever/Documents/dev/.vale", 0xc002d9a1d8, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/home/whatever/Documents/dev/_vale", 0xc002d9a2a8, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/home/whatever/Documents/dev/vale.ini", 0xc002d9a378, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/home/whatever/Documents/dev/.vale.ini", 0xc002d9a448, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/home/whatever/Documents/dev/_vale.ini", 0xc002d9a518, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/home/whatever/Documents/.vale", 0xc002d9a5e8, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/home/whatever/Documents/_vale", 0xc002d9a6b8, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/home/whatever/Documents/vale.ini", 0xc002d9a788, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/home/whatever/Documents/.vale.ini", 0xc002d9a858, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/home/whatever/Documents/_vale.ini", 0xc002d9a928, 0) = -1 ENOENT (No such file or directory)
(...)
newfstatat(AT_FDCWD, "/home/whatever/.vale", 0xc002d9b628, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/home/whatever/_vale", 0xc002d9b6f8, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/home/whatever/vale.ini", 0xc002d9b7c8, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/home/whatever/.vale.ini", 0xc002d9b898, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/home/whatever/_vale.ini", 0xc002d9b968, 0) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/home/whatever/.config/vale", {st_mode=S_IFDIR|0700, st_size=4096, ...}, 0) = 0
newfstatat(AT_FDCWD, "/home/whatever/.config/vale/.vale.ini", {st_mode=S_IFREG|0664, st_size=107, ...}, 0) = 0

You can see it find the /home/whatever/.config/vale/.vale.ini file, but it reports an error