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

[Feature request]: Create a default `.vale.ini` configuration on install #360

Closed sigveio closed 3 years ago

sigveio commented 3 years ago

Looked like a cool tool, so I thought I would give it a try.

I followed the Installation instructions, and installed via brew install vale

Then I glanced at Usage and tried to run some commands:

❯ vale -v
vale version 2.10.4
❯ vale SomeValidFileNameHere.md
E100 [.vale.ini] Runtime error

open : no such file or directory

Execution stopped with code 1.
❯ vale ls-config
E100 [.vale.ini] Runtime error

open : no such file or directory

Execution stopped with code 1.

Okay... slightly cryptic error message. But I could see .vale.ini + no such file there, so I tried:

❯ touch ~/.vale.ini
❯ vale SomeValidFileNameHere.md
✔ 0 errors, 0 warnings and 0 suggestions in 0 files.

Progress... but strange that it says 0 files. At this point I ran vale -h and saw the info about .vale.ini

❯ echo "[*]\nBasedOnStyles = Vale" >> ~/.vale.ini
❯ vale SomeValidFileNameHere.md

 SomeValidFileNameHere.md
 XXX:XXX  error  Did you really mean 'repo'?  Vale.Spelling

So that got it working 👍

My feedback after going through this process as a new user would be this:

If the tool depends on a configuration to work I think it would be an improvement if a default was created on install. More meaningful feedback/error messages (e.g. something similar to the .vale.ini info from vale -h) when running commands without the config file would also be useful.

As a temporary measure, I think it would help to update the 'Installation' instructions to include a step on adding a configuration. Or to make that clearer and prominently featured on the 'Usage' page.

jdkato commented 3 years ago

If you run vale -h (generally a good starting point if you're new to a command-line tool), you'll see:

$ vale -h
vale - A command-line linter for prose.

Usage:  vale [options] [input...]
    vale myfile.md myfile1.md mydir1
    vale --output=JSON [input...]

Vale is a syntax-aware linter for prose built with speed and extensibility in
mind. It supports Markdown, AsciiDoc, reStructuredText, HTML, and more.

It's designed to enforce custom rulesets (referred to as "styles"). See
https://github.com/errata-ai/styles for examples of what's possible.

To get started, you'll need a configuration file (.vale.ini):

Example:

    StylesPath = a/path/to/your/styles
    MinAlertLevel = suggestion

    [*]
    BasedOnStyles = Vale

See https://docs.errata.ai/vale/about for more setup information.

Flags:

 --built          post-processed file path                                     
 --config         A file path (e.g., --config='some/file/path/.vale.ini').     
 --ext            Extension to associate with stdin (e.g., --ext=.md).         
 --glob           A glob pattern (e.g., --glob='*.{md,txt}).'                  
 --ignore-syntax  Lint all files line-by-line.                                 
 --minAlertLevel  Lowest alert level to display (e.g., --minAlertLevel=error). 
 --no-exit        Don't return a nonzero exit code on errors.                  
 --no-wrap        Don't wrap CLI output.                                       
 --output         Output style ("line", "JSON", or a template file).           
 --v              prints current version                                       

Commands:

 ls-config        Print the current configuration to stdout and exit.    

The Usage section also walks through creating a configuration file, in addition to providing a sample repository. It may not be something that you can simply "glance at," but the information is there.

sigveio commented 3 years ago

Alright... it was merely a suggestion for improvement. I spent time writing feedback because I wanted to help; and I'm admittedly a little disappointed that you just shoot it down in this fashion.

You are right in that vale -h would perhaps have been the ideal starting point... my bad. I got there pretty quickly, and as you can see was able to figure it out after trying a couple of commands. But I don't think that invalidates the feedback I gave you; rather the opposite. If a developer can make that 'mistake' in the pursuit of giving the tool a test spin, then less tech savvy users are certainly likely to as well. And it's with that in mind, and not for myself, that I posted the feedback.

A small notice about it along with the Installation instructions would go a long way, just saying.

✌️

MischaPanch commented 2 years ago

I see that the issue is closed but I must say I completely agree with @sigveio. Most CLI tools work out of the box so after installing and running it, I would have at least expected a more precise error message instead of simply: open: no such file. Would be very easy and non-intrusive to add that