Skip to content

Commit

Permalink
test: add case for script with custom message
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkato committed Sep 18, 2023
1 parent 0cc469b commit 721589e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions testdata/features/checks.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Feature: Checks
When I test "checks/Script"
Then the output should contain exactly:
"""
test.md:4:19:Scripts.CustomMsg:Some message
test.md:29:1:Checks.ScriptRE:Consider inserting a new section heading at this point.
test.md:39:1:Checks.ScriptRE:Consider inserting a new section heading at this point.
"""
Expand Down
3 changes: 2 additions & 1 deletion testdata/fixtures/checks/Script/.vale.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
StylesPath = ../../../styles/

[*.md]
Checks.ScriptRE = YES
Checks.ScriptRE = YES
Scripts.CustomMsg = YES
18 changes: 18 additions & 0 deletions testdata/styles/Scripts/CustomMsg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
extends: script
message: "Consider inserting a new section heading at this point."
link: https://tengolang.com/
# The unprocessed file contents.
#
# We need this to access heading markup.
scope: raw
script: |
text := import("text")
matches := []
p_limit := 3 // at most 3 paragraphs per section
// Remove all instances of code blocks since we don't want to count
// inter-block newlines as a new paragraph.
document := text.re_replace("(?s) *(\n```.*?```\n)", scope, "")
matches = append(matches, {begin: 1, end: 2, message: "Some message"})

0 comments on commit 721589e

Please sign in to comment.