errata-ai / vale

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

.vale.ini and dicpath detection #518

Closed 5u623l20 closed 2 years ago

5u623l20 commented 2 years ago

The documentation mentions that

It’ll start looking for this file in the same folder as the file that’s being linted. If it can’t find one, it’ll search up to 6 levels up the file tree.

So I was trying to work as following:

git clone https://github.com/freebsd/freebsd-doc.git
vale freebsd-doc/documentation/content/en/books/handbook/jails/_index.adoc 

which errored with:

E100 [.vale.ini] Runtime error

open : no such file or directory

Execution stopped with code 1.

I think the documentation is a bit misleading as 6 levels up the tree means the folder freebsd-doc is the one where .vale.ini is allowed. So this is a bit confusing.

Because if I do the following:

cd freebsd-doc
vale documentation/content/en/books/handbook/jails/_index.adoc 

It runs properly and is able to locate the .vale.ini from within six levels up the tree.

Second issue is with dicpath: If I try to execute vale from any other directory other than freebsd-doc then it errors out as following:

E201 Invalid value [/home/bofh/freebsd-doc/.vale/styles/FreeBSD/Spelling.yml:1:1]:

   1* extends: spelling
   2  message: "'%s' is a typo!"
   3  dicpath: .vale/styles/Dicts

open /home/bofh/freebsd-doc/documentation/.vale/styles/Dicts/en_US-default_none_strip_hacker.dic: no such file or directory

Execution stopped with code 1.

Although it runs fine if I run vale from one directory up. I have tried to put .vale.ini and .vale directory under $HOME and run vale with the same errors:

cd freebsd-doc/documentation/content/en/books/handbook/jails
vale _index.adoc 
E201 Invalid value [/home/bofh/.vale/styles/FreeBSD/Spelling.yml:1:1]:

   1* extends: spelling
   2  message: "'%s' is a typo!"
   3  dicpath: .vale/styles/Dicts

open /home/bofh/freebsd-doc/documentation/content/en/books/handbook/jails/.vale/styles/Dicts/en_US-default_none_strip_hacker.dic: no such file or directory

Execution stopped with code 1.

I have tried with dicpath: ~/.vale/styles/Dicts but it's not expanded and ~ is expanded as literal tilde.

These are not a problem while we running CI/CD pipelines as for CI/CD pipelines we do:

cd freebsd-doc
vale .

which runs perfectly. The problem is with integration with editors as the buffer locations of the editors are outside the scope of the working directory. For your reference I have been trying to use this with Emacs using flymake-vale which is failing due to this reason. For your reference please see: https://github.com/tpeacock19/flymake-vale/issues/8

jdkato commented 2 years ago

This should be fixed in next release. You can verify by building from the v2 branch.

5u623l20 commented 2 years ago

Thanks for your prompt support. I can confirm that this works as intended now with the new branch. Looking forward for the release. 👍