feat(allowlist): add Handlebars and Mustache support - #1086
Conversation
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 2 selected item(s). |
| // Handlebars/Mustache templates have no conventional default test-file exclusion. | ||
| {"handlebars template in tests directory", "tests/templates/card.hbs", false}, | ||
| {"mustache template in test directory", "test/templates/email.mustache", false}, |
There was a problem hiding this comment.
Why doesn't this block have a item where want is true? It is optional but all other blocks have at least one item that has want set to true.
There was a problem hiding this comment.
A example suggestion might be:
| // Handlebars/Mustache templates have no conventional default test-file exclusion. | |
| {"handlebars template in tests directory", "tests/templates/card.hbs", false}, | |
| {"mustache template in test directory", "test/templates/email.mustache", false}, | |
| // Handlebars/Mustache templates have no conventional default test-file exclusion. | |
| {"handlebars template in tests directory", "tests/templates/card.hbs", false}, | |
| {"mustache template in test directory", "test/templates/email.mustache", false}, | |
| {"mustache files", "src/source.mustache", true}, | |
| {"handlebars source files", "src/code.hbs", true}, |
There was a problem hiding this comment.
Thanks for pointing this out. I added want: true cases for .hbs and .mustache under the existing generic **/fixtures/** exclusion, while keeping ordinary test/templates paths at false.
In TestIsExcludedPath, want: true means the path is excluded from review, so using ordinary src/*.hbs or src/*.mustache source files as the true cases would skip the templates this PR is adding support for. The fixture cases now cover the excluded side without changing the intended behavior.
| ".hbs", | ||
| ".mustache", |
There was a problem hiding this comment.
Is a default exclude pattern needed for those files?
For example:
"**/test/**/*.{hbs,mustache}",
"**/tests/**/*.{hbs,mustache}",
"**/spec/**/*.{hbs,mustache}"There was a problem hiding this comment.
Good question. I did not add extension-specific exclusions for all test, tests, or spec directories. #470 lists no required default exclusion for Template Engines, and this repository already excludes generic fixtures, testdata, and __snapshots__ paths.
A broad directory rule could exclude real Handlebars/Mustache templates based only on their location. The updated tests therefore keep ordinary test/templates paths reviewable while proving that templates under existing fixture paths are still excluded. If the maintainers prefer the broader exclusion as a project-level policy, I’m happy to adjust it.
| {".hbsx", false}, | ||
| {".mustachex", false}, |
There was a problem hiding this comment.
Why are there unwanted extensions here?
I mean if those unwanted extensions are not in the allowed_extensions.json in the first place. There is no need to be over explicit.
This should be handled by the {"", false}, currently on R103 in your branch.
Deleting these 2 items also aligns the format.
| {".hbsx", false}, | |
| {".mustachex", false}, |
There was a problem hiding this comment.
Agreed. I removed the .hbsx and .mustachex cases. The shared unsupported-extension cases already cover the false path, and the updated block now matches the surrounding test style.
2ce025d to
e9466cf
Compare
Description
Add first-class review support for Handlebars and Mustache templates as the focused subtask tracked in #1081:
.hbsand.mustachefiles case-insensitively;test/andtests/reviewable because these ecosystems do not share a reliable default template-test convention;The contribution stays limited to these two extensions. Other template engines remain outside this PR.
Type of Change
How Has This Been Tested?
make testpasses locallyValidation performed on macOS/arm64 with Go 1.26.5:
make checkmake test(race detector and-count=1)make buildmake coverage(91.1%, above the 90% threshold)git diff --check upstream/main...HEADThe repository-required
ocr review --audience agent --background <context>command was attempted, but this local environment has no configured LLM endpoint.ocr review --previewcompleted successfully, and I performed a separate line-by-line self-review.Checklist
go fmt,go vet)Related Issues
Closes #1081
Part of #470