Skip to content

Add Vale pre-commit hook - #758

Merged
sds merged 8 commits into
sds:mainfrom
guillaume-d:guillaume-d/bug/750-add-Vale-pre-commit-hook
Nov 10, 2026
Merged

sds merged 8 commits into
sds:mainfrom
guillaume-d:guillaume-d/bug/750-add-Vale-pre-commit-hook

Conversation

@guillaume-d

@guillaume-d guillaume-d commented Jun 18, 2021 •

Copy link
Copy Markdown
Contributor

Adds an opt-in Vale pre-commit hook that checks spelling and style in staged text, markup, and source files using the configurable line-aware command hooks merged in #757.

Implements the requirements described in this PR and its prerequisites:

  • Enable Vale with PreCommit: { Vale: { enabled: true } }; no Ruby plugin is needed. The default command is vale --output=line, with executable detection, installation guidance, and configurable file selection.
  • Parse file and line locations, including Windows drive-letter paths and filenames containing spaces, and honor include, exclude, requires_files, and problem_on_unmodified_line.
  • Preserve the stated severity limitation: diagnostics from unsuccessful commands default to errors because Vale's line output lacks severity. Documentation links to vale-cli/vale#350 for a custom template and explains the configuration needed to distinguish warnings.
  • Replace the documentation placeholder with installation, setup, enablement, and customization instructions. Allow supported configuration regexes through YamlSyntax, while continuing to reject arbitrary Ruby objects.

Validation: all 1,866 local examples pass, including 20 Vale-specific examples, a real subprocess with staged files, and YAML regression coverage. All repository pre-commit checks and RuboCop pass. A smoke test using the checksum-verified Vale 3.26.0 release confirms both failing diagnostics and a clean-file pass with a staged filename containing spaces. GitHub CI tests Ruby 3.3, 3.4, and 4.0 on Ubuntu and Windows.

@guillaume-d
guillaume-d marked this pull request as draft June 18, 2021 07:36
@guillaume-d
guillaume-d force-pushed the guillaume-d/bug/750-add-Vale-pre-commit-hook branch from 7565ef2 to c9b308a Compare October 11, 2021 18:45
@guillaume-d

Copy link
Copy Markdown
Contributor Author

This depends on #757 which should be merged first! I will rebase this (or merge from master?) after that.

Rebased to adapt to latest configuration format changes.

@sds
sds marked this pull request as ready for review November 10, 2026 07:06
@sds
sds merged commit 6649458 into sds:main Nov 10, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants