feat(harper): add harper-cli config to hk builtin config#714
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces Highlights
Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds harper-cli as a new built-in linter for grammar checking. The changes introduce two new configurations, one for general text files and another for commit messages, along with a test stub for the tool. My review focuses on improving the maintainability and testability of the new configurations. I've pointed out a confusing comment that should be removed and suggested a way to make the commit message checker testable, along with adding tests for it.
| harper = new Config.Step { | ||
| check = "harper-cli lint {{commit_msg_file}}" | ||
| } |
There was a problem hiding this comment.
This step is not currently testable because it relies on the {{commit_msg_file}} variable, which is only available in the commit-msg hook context. You can make it testable by using Tera's default filter to fall back to the {{files}} variable during tests.
Also, for consistency with the other harper builtin and to ensure this step works correctly, please add tests for valid and invalid commit messages. The helpers.pkl module is already imported, so you can use TestMaker.
harper = new Config.Step {
check = "harper-cli lint {{ commit_msg_file | default(value=files) }}"
tests {
local const testMaker = new helpers.TestMaker {
filename = "COMMIT_EDITMSG"
}
["check bad commit message"] = testMaker.checkFail("fix: this has a typo;s", 1)
["check good commit message"] = testMaker.checkPass("fix: this is a correct commit message", 0)
}
}
| // It will work as expected once this issue (https://github.com/webpro-nl/knip/commit/c182c29e35748ff044048c578b6bf7dd99dae9a8) | ||
| // is fixed. |
| // It will work as expected once this issue (https://github.com/webpro-nl/knip/commit/c182c29e35748ff044048c578b6bf7dd99dae9a8) | ||
| // is fixed. |
There was a problem hiding this comment.
I will keep it as a draft until the version with this issue fixed is released.
Automattic/harper#2832
3f10b1d to
056c8e0
Compare
056c8e0 to
09e945a
Compare
Greptile SummaryThis PR adds two new builtins — Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Git Hook Triggered] --> B{Hook Type}
B -- pre-commit --> C[harper step]
B -- commit-msg --> D[harper_commit_message step]
C --> E["types = List('text')\nFilter staged files"]
E --> F["harper-cli lint {{ files }}"]
F --> G{Exit code?}
G -- 0 --> H[Commit proceeds]
G -- non-zero --> I[Commit blocked\nGrammar issues reported]
D --> J["harper-cli lint {{commit_msg_file}}"]
J --> K{Exit code?}
K -- 0 --> H
K -- non-zero --> L[Commit blocked\nGrammar issues in message]
Reviews (3): Last reviewed commit: "feat(grammar): add harper config to hk b..." | Re-trigger Greptile |
09e945a to
e314958
Compare
https://github.com/Automattic/harper Harper is an offline, privacy-first grammar checker written in Rust. It provides fast, millisecond-level checking for prose and documentation with support for Markdown, HTML, and other text formats. Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
e314958 to
d7f041e
Compare
### 🚀 Features - **(harper)** add harper-cli config to hk builtin config by [@hituzi-no-sippo](https://github.com/hituzi-no-sippo) in [#714](#714) ### 🐛 Bug Fixes - **(release)** add linux musl targets by [@jdx](https://github.com/jdx) in [#829](#829) ### 🔍 Other Changes - drop sub-crate submodules and publish hk to crates.io by [@jdx](https://github.com/jdx) in [#830](#830) ### 📦️ Dependency Updates - lock file maintenance by [@renovate[bot]](https://github.com/renovate[bot]) in [#826](#826) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Primarily a version/release bookkeeping change (docs, generated CLI metadata, and lockfiles) with no runtime logic modifications in this diff. > > **Overview** > Cuts release `v1.43.0` by bumping the crate version in `Cargo.toml`/`Cargo.lock` and updating `CHANGELOG.md` with the 1.43.0 notes. > > Regenerates versioned references across docs and CLI artifacts (e.g., `docs/*`, `docs/cli/*`, example `.pkl` files, and `hk.usage.kdl`) to point at `v1.43.0` Pkl package URLs. Updates `mise.lock` to include provenance metadata for the `communique` linux x64 artifact. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit f4e6c35. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: mise-en-dev <[email protected]>
Add harper-cli as a new builtin linter for grammar.