Closed yohannes closed 2 years ago
I have this issue too.
ALE seems to indicate vale's output is empty:
(finished - exit code 0) ['/bin/zsh', '-c', 'vale --output=JSON ''/var/folders/kx/3dgbmvjx14n9nk7f6w0px7l80000gn/T/v8nPkws/2/README.md''']
<<<OUTPUT STARTS>>>
{}
<<<OUTPUT ENDS>>>
Just a guess but I believe this is because we are missing some configuration? What exact command needs to be executed for vale to properly output errors?? I have never been able to get vale output any errors/warning on my markdown files.
I know what this is now. It's to do with the filepath of the temprary file not matching the globs in the Vale config fle and so no styles are checked and you get an empty object {}
as output.
In my case, my .vale.ini
was configured to look in a posts
folder:
[posts/*.md]
BasedOnStyles = Vale, write-good
but Ale effectively executes this:
vale --output=JSON /var/folders/p8/qs2_s2zn4976_hdmjwb7r4zh0000gn/T/v9iGdUc/2/some-file.md
which doesn't match on posts/*.md
and so no rules are applied.
The fix for me was to relax the glob to *.md
in .vale.ini
.
Thanks for the investigation. Seems vale can work using STDIN as input so wonder if the glob patterns affect in this case too. If not then it would be good idea to modify ALE to use STDIN instead of temporary files.
If time allows would you mind testing if STDIN works even if the glob pattern is [posts/*.md]? or in general how these patters affect if STDIN is used?
vale --output=JSON --ext "md" < /absolute/path/to/file.md
Glob patterns that include a folder name (like posts/*.md
) don't work with STDIN even if the --ext=.md
option is used:
$ vale --ext=.md < posts/file-with-errors.md
{}
You have to use a glob of *.md
for the STDIN approach to work.
So ultimately it's simpler to stick with temporary files as you don't require the additional --ext=.md
option.
Thanks for the investigative work. Is unfortunate that vale behaves such way. The only solution is to use *.md glob in any case.
I created a separate issue to get this detail documented in ALE's non-existend vale documentation #4092 and close this one.
Is unfortunate that vale behaves such way.
This topic was recently brought to my attention with the implication being, as is the case here, that this is a "flaw" of Vale.
@hsanson, could you elaborate on how this is "unfortunate" behavior? What should Vale do here?
If the user explicitly provides a glob pattern, then there are only two options:
(1) is obviously the correct behavior here. It seems to me that the "unfortunate" behavior, if any, is the use of temporary file paths.
I believe, after re-reading the thread since this was more than a year ago, that what I referred as unfortunate is this behavior:
Glob patterns that include a folder name (like posts/*.md) don't work with STDIN even if the --ext=.md option is used
The best approach to integrate a tool with ALE is if it supports STDIN input that allows ALE to lint the buffer in quasi-realtime (as you type) instead of reading files from disk. Unfortunately when using STDIN input the filename and/or extension are not available so tools need additional parameters that allow ALE to pass that info (e.g. --ext) but seems that this does not work as expected in vale.
I believe, after re-reading the thread since this was more than a year ago, that what I referred as unfortunate is this behavior:
Glob patterns that include a folder name (like posts/*.md) don't work with STDIN even if the --ext=.md option is used
The best approach to integrate a tool with ALE is if it supports STDIN input that allows ALE to lint the buffer in quasi-realtime (as you type) instead of reading files from disk. Unfortunately when using STDIN input the filename and/or extension are not available so tools need additional parameters that allow ALE to pass that info (e.g. --ext) but seems that this does not work as expected in vale.
No, it works exactly as it should. The problem is that Vale can't know if a glob like posts/*.md
should match unless it has the file path, not just the extension.
At best, you could say that it'd be nice if Vale had something along the lines of a --filepath
flag so that using a general pattern (like *.md
) isn't necessary. But all of this discussion is due to the (questionable) particulars of ALE's implementation. There's absolutely no argument for Vale working "unexpectedly" here.
Hi all,
I am not sure what I did wrong in my settings. But I can't have ale display any linting error when processing markdown file via vale in VIM. Here's outputs of some of the files.
ALEInfo (run against a README.md file that has various typos):
A subset of my .vimrc:
Passing the same README.md file above to Vale directly produces the right outcome. So my Vale environment has been set up correctly:
vale.vim file in /ale/ale_linters/markdown:
Any pointer on what's causing the unexpected behavior?