-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hi friends, working to add a new linter in [Vale](https://vale.sh/explorer/). ## What I'm trying to do Vale is a pretty extensible style checker for text files like Markdown, doc source, blogs, etc. Lets you lint beyond spell checks, also for style, diction, etc. I'm trying to add Vale as a linter so I can use it in `trunk check`. ## What I added - [x] Vale as a tool, downloaded from GitHub releases - [x] Vale as a linter, output as line and parsed with regex - [x] A basic smoke tests for tool - [x] Success case and an issue case tests for linter ## Test plan - Tests described above - Some manual testing by running Vale check with vale enabled. --------- Co-authored-by: Tyler Jang <[email protected]>
- Loading branch information
1 parent
5ae4524
commit dbefc22
Showing
6 changed files
with
111 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[formats] | ||
markdoc = md | ||
|
||
[*.md] | ||
BasedOnStyles = Vale |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
version: 0.1 | ||
|
||
downloads: | ||
- name: vale | ||
downloads: | ||
- os: | ||
linux: Linux | ||
macos: macOS | ||
cpu: | ||
x86_64: 64-bit | ||
arm_64: arm64 | ||
url: https://github.com/errata-ai/vale/releases/download/v${version}/vale_${version}_${os}_${cpu}.tar.gz | ||
- os: | ||
windows: Windows | ||
cpu: | ||
x86_64: 64-bit | ||
arm_64: arm64 | ||
url: https://github.com/errata-ai/vale/releases/download/v${version}/vale_${version}_Windows_${cpu}.zip | ||
|
||
tools: | ||
definitions: | ||
- name: vale | ||
download: vale | ||
shims: [vale] | ||
known_good_version: 3.4.1 | ||
environment: | ||
- name: PATH | ||
list: ["${tool}"] | ||
|
||
lint: | ||
definitions: | ||
- name: vale | ||
files: [ALL] | ||
description: Enforce editorial standards in your text documents | ||
commands: | ||
- name: lint | ||
output: regex | ||
parse_regex: (?P<path>.*):(?P<line>\d+):(?P<col>\d+):(?P<severity>[^:]+):(?P<message>.+) | ||
run: vale --output=line ${target} | ||
success_codes: [0, 1] | ||
read_output_from: stdout | ||
batch: true | ||
suggest_if: config_present | ||
tools: [vale] | ||
known_good_version: 3.4.1 | ||
direct_configs: [.vale.ini] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Hello world! | ||
Hallo, wurld? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Testing linter vale test basic 1`] = ` | ||
{ | ||
"issues": [ | ||
{ | ||
"code": "error", | ||
"column": "1", | ||
"file": "test_data/basic.in.md", | ||
"issueClass": "ISSUE_CLASS_EXISTING", | ||
"level": "LEVEL_HIGH", | ||
"line": "2", | ||
"linter": "vale", | ||
"message": "Did you really mean 'Hallo'?", | ||
"targetType": "ALL", | ||
}, | ||
{ | ||
"code": "error", | ||
"column": "8", | ||
"file": "test_data/basic.in.md", | ||
"issueClass": "ISSUE_CLASS_EXISTING", | ||
"level": "LEVEL_HIGH", | ||
"line": "2", | ||
"linter": "vale", | ||
"message": "Did you really mean 'wurld'?", | ||
"targetType": "ALL", | ||
}, | ||
], | ||
"lintActions": [ | ||
{ | ||
"command": "lint", | ||
"fileGroupName": "ALL", | ||
"linter": "vale", | ||
"paths": [ | ||
"test_data/basic.in.md", | ||
], | ||
"verb": "TRUNK_VERB_CHECK", | ||
}, | ||
{ | ||
"command": "lint", | ||
"fileGroupName": "ALL", | ||
"linter": "vale", | ||
"paths": [ | ||
"test_data/basic.in.md", | ||
], | ||
"upstream": true, | ||
"verb": "TRUNK_VERB_CHECK", | ||
}, | ||
], | ||
"taskFailures": [], | ||
"unformattedFiles": [], | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { linterCheckTest } from "tests"; | ||
|
||
linterCheckTest({ linterName: "vale" }); |