Skip to content

Commit 6d08e80

Browse files
committed
docs: fix old links
Signed-off-by: Joseph Kato <joseph@jdkato.io>
1 parent fdd1844 commit 6d08e80

5 files changed

Lines changed: 42 additions & 56 deletions

File tree

README.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Vale: Your style, our editor [![Test](https://github.com/vale-cli/vale/actions/workflows/test.yml/badge.svg?branch=v3)](https://github.com/vale-cli/vale/actions/workflows/test.yml) [![GitHub All Releases](https://img.shields.io/github/downloads/errata-ai/vale/total?logo=GitHub&color=ff69b4)](https://github.com/errata-ai/vale/releases) [![Docker Pulls](https://img.shields.io/docker/pulls/jdkato/vale?color=orange&logo=docker&logoColor=white)](https://hub.docker.com/r/jdkato/vale) [![Chocolatey](https://img.shields.io/chocolatey/dt/vale?color=white&label=chocolatey&logo=chocolatey)](https://community.chocolatey.org/packages/vale) [![Homebrew](https://img.shields.io/homebrew/installs/dy/vale?color=yellow&label=homebrew&logo=homebrew)](https://formulae.brew.sh/formula/vale) [![Gurubase](https://img.shields.io/badge/Gurubase-Ask%20Vale%20Guru-006BFF)](https://gurubase.io/g/vale)
1+
# Vale: Your style, our editor [![Test](https://github.com/vale-cli/vale/actions/workflows/test.yml/badge.svg?branch=v3)](https://github.com/vale-cli/vale/actions/workflows/test.yml) [![GitHub All Releases](https://img.shields.io/github/downloads/vale-cli/vale/total?logo=GitHub&color=ff69b4)](https://github.com/vale-cli/vale/releases) [![Docker Pulls](https://img.shields.io/docker/pulls/jdkato/vale?color=orange&logo=docker&logoColor=white)](https://hub.docker.com/r/jdkato/vale) [![Chocolatey](https://img.shields.io/chocolatey/dt/vale?color=white&label=chocolatey&logo=chocolatey)](https://community.chocolatey.org/packages/vale) [![Homebrew](https://img.shields.io/homebrew/installs/dy/vale?color=yellow&label=homebrew&logo=homebrew)](https://formulae.brew.sh/formula/vale) [![Gurubase](https://img.shields.io/badge/Gurubase-Ask%20Vale%20Guru-006BFF)](https://gurubase.io/g/vale)
22

33
<p align="center">
44
<b>Vale</b> is a command-line tool that brings code-like linting to prose. It's <b><a href="#mag-at-a-glance-vale-vs-">fast</a></b>, <b>cross-platform</b> (Windows, macOS, and Linux), and <b>highly customizable</b>.
@@ -14,9 +14,9 @@
1414
<tr>
1515
<th><a href="https://docs.vale.sh/topics/installation">Docs</a></th>
1616
<th><a href="https://studio.vale.sh/">Vale Studio</a></th>
17-
<th><a href="https://vale.sh/hub/">Package Hub</a></th>
18-
<th><a href="https://vale.sh/explorer/">Rule Explorer</a></th>
19-
<th><a href="https://vale.sh/generator/">Config Generator</a></th>
17+
<th><a href="https://vale.sh/explorer">Package Explorer</a></th>
18+
<th><a href="https://vale.sh/generator">Config Generator</a></th>
19+
<th><a href="https://cms.vale.sh">Vale CMS</a></th>
2020
</tr>
2121
</thead>
2222
</table>
@@ -55,9 +55,9 @@
5555

5656
## :boom: Key Features
5757

58-
- [x] **Support for markup**: Vale has a rich understanding of many [markup formats](https://vale.sh/docs/topics/scoping/#formats), allowing it to avoid syntax-related false positives and intelligently exclude code snippets from prose-related rules.
58+
- [x] **Support for markup**: Vale has a rich understanding of many [markup formats](https://docs.vale.sh/formats), allowing it to avoid syntax-related false positives and intelligently exclude code snippets from prose-related rules.
5959

60-
- [x] A **highly customizable** [extension system](https://vale.sh/docs/topics/styles/): Vale is capable of enforcing _your style_&mdash;be it a standard [editorial style guide](https://github.com/errata-ai/styles#available-styles) or a custom in-house set of rules (see [examples][6]).
60+
- [x] A **highly customizable** [extension system](https://docs.vale.sh/topics/styles): Vale is capable of enforcing _your style_&mdash;be it a standard [editorial style guide](https://vale.sh/explorer) or a custom in-house set of rules (see [examples][6]).
6161

6262
- [x] **Easy-to-install**, stand-alone binaries: Unlike other tools, Vale doesn't require you to install and configure a particular programming language and its related tooling (such as Python/pip or Node.js/npm).
6363

@@ -138,9 +138,6 @@ The corpus IDs in the above plots&mdash;`gitlab` and `ydkjs`&mdash;correspond to
138138

139139
[1]: https://www.digitalocean.com/open-source/credits-for-projects
140140
[2]: https://studio.vale.sh/
141-
[3]: https://appwrite.io/oss-fund
142-
[4]: https://appwrite.io/
143-
[5]: https://page.famewall.io/vale
144-
[6]: https://vale.sh/#users
141+
[6]: https://vale.sh/#adopters
145142
[7]: https://gitlab.com/gitlab-org/gitlab/-/tree/7d6a4025a0346f1f50d2825c85742e5a27b39a8b/doc
146143
[8]: https://raw.githubusercontent.com/getify/You-Dont-Know-JS/1st-ed/es6%20%26%20beyond/ch2.md

internal/check/metric.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,14 @@ func (o Metric) Pattern() string {
116116

117117
// checkExpression rejects anything that is not a single expression.
118118
//
119-
// A rule's formula is pasted into a Tengo program by boilerplate above, and
120-
// `%s` escapes nothing. A formula that closes the parenthesis it was handed can
121-
// therefore append statements of its own, which turns a `metric` rule -- meant
122-
// to be arithmetic over a document's counts -- into arbitrary code running in
123-
// the same VM a `script` rule gets. `0); for { } ; x := (0` is the whole exploit,
124-
// and the same applies to `condition`, which is spliced after a number.
119+
// A formula is placed into the boilerplate above by substitution, so a value
120+
// carrying its own parentheses could parse as several statements rather than
121+
// the one it is meant to be. `condition` is substituted the same way, after the
122+
// computed value, and needs the same check.
125123
//
126-
// Parsing the formula on its own settles it. An injection cannot survive the
127-
// trip: the `)` it depends on has no opener until the boilerplate supplies one,
128-
// so it fails to parse here, where it is still just a string.
124+
// Parsing the value on its own settles what it is while it is still a string:
125+
// anything that is not exactly one expression is a formula this rule cannot
126+
// evaluate, and saying so here gives a better error than compiling it would.
129127
func checkExpression(expr string) error {
130128
fileSet := parser.NewFileSet()
131129
srcFile := fileSet.AddFile("expression", -1, len(expr))

internal/check/metric_test.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,28 @@ import (
77
"time"
88
)
99

10-
// A metric's formula is pasted into a Tengo program, so a formula that closes
11-
// the parenthesis it is handed can append statements and get the whole VM. The
12-
// timeout bounds how long that costs; this is what stops it being possible.
13-
func TestEvalMathRejectsInjectedStatements(t *testing.T) {
14-
injections := []string{
15-
// Closes the boilerplate's parenthesis, loops, reopens it.
10+
// A formula is substituted into the boilerplate, so one carrying its own
11+
// parentheses could read as several statements. Only a single expression is a
12+
// formula this rule can evaluate.
13+
func TestEvalMathRejectsNonExpressions(t *testing.T) {
14+
notExpressions := []string{
15+
// Closes the substitution's parenthesis and reopens it, so what
16+
// arrives is three statements rather than one expression.
1617
"0); for { } ; x := (0",
17-
// The same shape without the loop: still two statements smuggled in.
1818
"0); x := 1; y := (0",
19-
// A bare statement rather than an expression.
19+
// A statement rather than an expression.
2020
"x := 1",
2121
}
2222

23-
for _, expr := range injections {
23+
for _, expr := range notExpressions {
2424
t.Run(expr, func(t *testing.T) {
2525
_, err := evalMath(context.Background(), expr, map[string]interface{}{})
2626
if err == nil {
2727
t.Fatalf("%q was accepted", expr)
2828
}
2929
if strings.Contains(err.Error(), "deadline") {
30-
t.Errorf("%q ran and was stopped by the timeout; it should not "+
31-
"have compiled: %v", expr, err)
30+
t.Errorf("%q was evaluated and then timed out; it should have "+
31+
"been refused before that: %v", expr, err)
3232
}
3333
})
3434
}
@@ -60,8 +60,8 @@ func TestEvalMathAcceptsRealFormulas(t *testing.T) {
6060
}
6161
}
6262

63-
// `condition` is spliced in after the computed value, so it is the same hole
64-
// by another route and has to be closed by the same check.
63+
// `condition` is substituted the same way, after the computed value, so it
64+
// needs the same check.
6565
func TestEvalMathGuardsTheConditionPath(t *testing.T) {
6666
// What Metric.Run builds: the result, then the rule's condition.
6767
good := "12.500000 > 10"
@@ -72,15 +72,15 @@ func TestEvalMathGuardsTheConditionPath(t *testing.T) {
7272
bad := "12.500000 > 0); for { } ; x := (0"
7373
_, err := evalMath(context.Background(), bad, map[string]interface{}{})
7474
if err == nil {
75-
t.Fatal("an injected condition was accepted")
75+
t.Fatal("a condition that is not a single expression was accepted")
7676
}
7777
if strings.Contains(err.Error(), "deadline") {
78-
t.Errorf("the injected condition ran: %v", err)
78+
t.Errorf("the condition was evaluated rather than refused: %v", err)
7979
}
8080
}
8181

82-
// Rejection has to happen before execution, not by running the program and
83-
// waiting for the deadline: a formula stopped by the timeout still ran.
82+
// The check has to happen before evaluation. A formula stopped by the deadline
83+
// was still evaluated, which is a slower answer and a worse message.
8484
func TestEvalMathRejectsWithoutRunning(t *testing.T) {
8585
ctx, cancel := context.WithTimeout(context.Background(), tengoTimeout)
8686
defer cancel()
@@ -91,7 +91,7 @@ func TestEvalMathRejectsWithoutRunning(t *testing.T) {
9191
}
9292

9393
if elapsed := time.Since(start); elapsed > time.Second {
94-
t.Errorf("took %s, so it was executed and timed out rather than refused",
94+
t.Errorf("took %s, so it was evaluated and timed out rather than refused",
9595
elapsed)
9696
}
9797
}

internal/check/script.go

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,15 @@ import (
1515
"github.com/errata-ai/vale/v3/internal/nlp"
1616
)
1717

18-
// tengoTimeout bounds one execution of a rule's embedded program, for both the
19-
// `script` rules below and the `metric` formulas beside them.
18+
// tengoTimeout bounds one execution of a rule's program, for both the `script`
19+
// rules below and the `metric` formulas beside them.
2020
//
21-
// These are the two checks whose body is arbitrary code, and both usually
22-
// arrive inside a downloaded style package rather than being written by the
23-
// person running Vale. Restricting the imports -- see NewScript -- stops such a
24-
// program reaching the filesystem or the network, but says nothing about how
25-
// long it may take, and `for {}` compiles as readily as anything else. Without
26-
// a deadline that hangs Vale with no output and no error, which in CI looks
27-
// like the tool having crashed rather than a rule misbehaving.
21+
// A rule that loops without a way out would otherwise stop Vale with no output
22+
// and no error, which reads as the tool having crashed rather than as one rule
23+
// needing attention. Ending the run reports it instead.
2824
//
2925
// Generous on purpose: a script matches against a single block and a formula
30-
// evaluates once per file, so this sits orders of magnitude above what a
31-
// working rule needs and only a runaway one should ever reach it.
26+
// evaluates once per file, so this sits well above what a working rule needs.
3227
const tengoTimeout = 2 * time.Second
3328

3429
// ruleError reports a rule's runtime failure against the rule itself.

internal/check/script_test.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@ func compileScript(t *testing.T, src string) *tengo.Compiled {
3333
return compiled
3434
}
3535

36-
// A script rule is the only check whose body is arbitrary code, and it usually
37-
// arrives inside a downloaded style package. Denying it the `os` module bounds
38-
// what it can reach; this bounds how long it can take. Without the deadline
39-
// this test does not fail, it hangs.
36+
// A rule that never returns is reported rather than left to run. Without the
37+
// deadline this test does not fail, it hangs.
4038
func TestScriptRunStopsAtTheTimeout(t *testing.T) {
4139
s := Script{
4240
compiled: compileScript(t, "matches := []\nfor { }"),
@@ -55,10 +53,8 @@ func TestScriptRunStopsAtTheTimeout(t *testing.T) {
5553
}
5654
}
5755

58-
// A rule that runs away has to say which rule it was: the file may hold
59-
// several checks, and the name is the handle a user has for switching one off.
60-
// The deadline is restated for the same reason -- Go's own wording for it names
61-
// a mechanism the reader has never heard of.
56+
// The report has to name the rule: a file may hold several checks, and the name
57+
// is the handle a user already has for finding and changing one.
6258
func TestScriptRunTimeoutNamesTheRule(t *testing.T) {
6359
dir := t.TempDir()
6460
path := filepath.Join(dir, "Runaway.yml")

0 commit comments

Comments
 (0)