vale
vale copied to clipboard
Feature: Support running a single rule from the command line
I want to be able to run a readability score from the command line without having a configuration file configured for the rule.
Consider the following setup:
Folder structure:
~/.VALE
└───styles
├───alex
├───Google
├───Joblint
├───Microsoft
├───PowerShell-Docs
├───proselint
├───Readability
├───Vocab
│ ├───Blog
│ ├───Docs
│ └───Marketing
└───write-good
The vale.ini:
StylesPath = styles
MiMinAlertLevel = suggestion
Vocab = Docs
[*.md]
BasedOnStyles = Vale, PowerShell-Docs, Microsoft, alex
The rule would have to exist in the configured style path, but it does not have to be enabled in the configuration. Vale would use the style path from the vale.ini file in the workspace or specified by the --config option.
For example:
vale -rule Readability.FleschKincaid --output=JSON myfile.md
This way you could run any installed rule, not just a Readability score.
This is possible with the latest release:
$ vale --filter='.Name=="Readability.FleschKincaid"' --output=JSON myfile.md
The rule would have to exist in the configured style path, but it does not have to be enabled in the configuration. Vale would use the style path from the vale.ini file in the workspace or specified by the --config option.
There's a caveat here: filters can only produce a subset of the .vale.ini configuration, so the rule does have to be enabled. It can obviously, though, then be excluded in cases that you don't want it.
There are two issues I have:
- I get no readability score output - I just get empty JSON
{}or✔ 0 errors, 0 warnings and 0 suggestions in 1 file. - I don't want the rules enabled in my default config. I want to run any arbitrary rule from the command line as a one-off test.
EDIT
After further testing, I get output from Readability.GunningFog, Readability.FleschReadingEase and Readability.SMOG only.
To work around the default config issue, I created a new configuration called allrules.ini that has all rules enabled. I can use this from the command line with --filter to run any rule I want.