Skip to content

Commit

Permalink
Merge branch 'test-vale' into test-vale-pr
Browse files Browse the repository at this point in the history
  • Loading branch information
mirnawong1 authored Jun 17, 2024
2 parents e6360ad + e1601e0 commit c15d790
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
6 changes: 2 additions & 4 deletions styles/custom/Repitition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ tokens:
- '\b(\w+)\s+\1\b'

action:
name: edit
name: suggest
params:
- regex
- '\b(\w+)\s+\1\b'
- '\1'
- RepetitionFix.tengo
11 changes: 11 additions & 0 deletions styles/custom/config/RepetitionFix.tengo
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
text := import("text")

// `match` is provided by Vale and represents the rule's matched text.
// The regex pattern for detecting repetitive words.
pattern := `(\b\w+\s+\1\b)`

// Replace repetitive words with a single instance of the word.
replaced := text.re_replace(pattern, match, `$1`)

// `suggestions` is required by Vale and represents the script's output.
suggestions := [replaced]

0 comments on commit c15d790

Please sign in to comment.