alibaba / alibaba/open-code-review

feat(allowlist): expand supported file types — language experts wanted

Open
#470 25 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue help wanted
Dominant language
Go
Stars
24.4k
Forks
1.8k
Avg merge
2d 6h
Merged PRs (30d)
105

Description

## Description

OpenCodeReview currently supports **71 file extensions** for code review. However, many popular and emerging languages are missing from the allowlist. We're looking for **language experts** to help add proper support for their favorite languages — including file extensions, test-file exclude patterns, and **language-specific review rules**.

This is a **tracking issue**. Pick a language group below, create a sub-issue referencing this one, and submit a PR. Each language group is independent and can be contributed separately.

## Currently Supported

71 extensions (click to expand)

`.java` `.kt` `.kts` `.scala` `.groovy` `.py` `.pyi` `.js` `.jsx` `.ts` `.tsx` `.mjs` `.cjs` `.c` `.h` `.cpp` `.cc` `.cxx` `.hpp` `.hxx` `.cs` `.vb` `.fs` `.go` `.rs` `.rb` `.rake` `.gemspec` `.php` `.swift` `.m` `.mm` `.sh` `.bash` `.zsh` `.fish` `.ps1` `.sql` `.css` `.scss` `.sass` `.less` `.html` `.htm` `.ftl` `.ftlh` `.ftlx` `.astro` `.vue` `.svelte` `.xml` `.yaml` `.yml` `.json` `.toml` `.ini` `.env` `.gradle` `.cmake` `.r` `.lua` `.pl` `.pm` `.ex` `.exs` `.erl` `.hrl` `.ets` `.json5` `.dart` `.tf`

## Wanted — Language Groups

Pick one (or more!) and open a sub-issue:

| Language Group | Extensions | Test Exclude Patterns Needed | Difficulty |
|---|---|---|---|
| **Zig** | `.zig` | `**/test/*.zig`, `**/*_test.zig` | ★☆☆ |
| **Nim** | `.nim`, `.nims`, `.nimble` | `**/tests/**/*.nim` | ★☆☆ |
| **Haskell** | `.hs`, `.lhs` | `**/test/**/*.hs`, `**/*Spec.hs` | ★★☆ |
| **Clojure** | `.clj`, `.cljs`, `.cljc`, `.edn` | `**/test/**/*.clj` | ★★☆ |
| **Elm** | `.elm` | `**/tests/**/*.elm` | ★☆☆ |
| **OCaml / ReasonML** | `.ml`, `.mli`, `.re`, `.rei` | `**/test/**/*.ml` | ★★☆ |
| **Protocol Buffers & gRPC** | `.proto` | — | ★☆☆ |
| **GraphQL** | `.graphql`, `.gql` | — | ★☆☆ |
| **Solidity / Web3** | `.sol`, `.vy` | `**/test/**/*.sol`, `**/*.t.sol` | ★★☆ |
| **Move** | `.move` | `**/tests/**/*.move` | ★☆☆ |
| **HCL / Terraform** | `.hcl`, `.tfvars` (`.tf` already supported) | — | ★☆☆ |
| **Nix** | `.nix` | — | ★☆☆ |
| **Dhall** | `.dhall` | — | ★☆☆ |
| **Jsonnet** | `.jsonnet`, `.libsonnet` | — | ★☆☆ |
| **Bicep** | `.bicep` | — | ★☆☆ |
| **Prisma** | `.prisma` | — | ★☆☆ |
| **Thrift / Cap'n Proto** | `.thrift`, `.capnp` | — | ★☆☆ |
| **Shader Languages** | `.glsl`, `.hlsl`, `.wgsl`, `.metal` | — | ★★☆ |
| **Template Engines** | `.pug`, `.haml`, `.slim`, `.erb`, `.twig`, `.jinja2`, `.j2`, `.hbs`, `.mustache`, `.tera` | — | ★★☆ |
| **Hardware Description** | `.v`, `.sv`, `.vhd`, `.vhdl` | `**/tb_*.v`, `**/*_tb.v` | ★★☆ |
| **Julia** | `.jl` | `**/test/**/*.jl` | ★☆☆ |
| **Crystal** | `.cr` | `**/spec/**/*_spec.cr` | ★☆☆ |
| **V (vlang)** | `.v`, `.vsh` | `**/tests/**/*.v`, `**/*_test.v` | ★☆☆ |
| **Mojo** | `.mojo`, `.🔥` | — | ★☆☆ |

> 💡 Don't see your language? Comment below to propose it!

## Scope

- File(s):
- `internal/config/allowlist/supported_file_types.json` — add extensions
- `internal/config/allowlist/default_exclude_patterns.json` — add test patterns (if applicable)
- `internal/config/allowlist/allowed_ext_test.go` — add test cases
- `internal/config/rules/rule_docs/.md` — **(recommended)** language-specific review rules
- `internal/config/rules/system_rules.json` — register path-to-rule mapping
- Function/area: `allowedext` package + `rules` subsystem

## How to Contribute

1. **Comment below** claiming a language group (to avoid duplicate work)
2. **Create a sub-issue** titled `feat(allowlist): add support` referencing this issue
3. **Submit a PR** with:
- Extensions added to `supported_file_types.json`
- Test exclude patterns added to `default_exclude_patterns.json` (if the language has conventional test file locations)
- Test cases added to `allowed_ext_test.go` covering both `IsAllowedExt` and `IsExcludedPath`
- **(Recommended)** A review rule doc `internal/config/rules/rule_docs/.md` with language-specific review focus areas (see existing examples like `rust.md`, `python.md`, `java.md` for format and depth)
- **(Recommended)** Register the glob-to-rule mapping in `internal/config/rules/system_rules.json`
4. Ensure `make test` and `make check` pass

### Review Rule Doc Guidelines

Review rule docs define what OCR should focus on when reviewing code in that language. A good rule doc covers:

- **Common correctness pitfalls** (e.g., ownership bugs in Rust, null safety in Kotlin)
- **Error handling idioms** specific to the language
- **Concurrency & async patterns** and their foot-guns
- **Performance anti-patterns** common in the ecosystem
- **Security-sensitive areas** (injection, unsafe operations, crypto misuse)
- **Type/API design conventions** valued by the community

See `internal/config/rules/rule_docs/rust.md` or `python.md` for reference. Your language expertise is exactly what makes these rules valuable — generic rules already exist in `default.md`.

## Acceptance Criteria (per sub-PR)

- [ ] Extensions added to `supported_file_types.json`
- [ ] Test exclude patterns added if the language has well-known test conventions
- [ ] Test cases cover both positive (extension recognized) and negative (test files excluded) scenarios
- [ ] (Recommended) Rule doc added at `internal/config/rules/rule_docs/.md`
- [ ] (Recommended) Path mapping registered in `internal/config/rules/system_rules.json`
- [ ] `make test` passes
- [ ] `make check` passes

## Context

**Allowlist**: uses a simple JSON array of extensions with case-insensitive matching. The exclude patterns use [doublestar](https://github.com/bmatcuk/doublestar) glob syntax supporting `**` (recursive), `*` (single-segment), and `{a,b}` (brace expansion).

**Review rules**: `system_rules.json` maps file glob patterns to rule doc filenames. When OCR reviews a file matching a pattern, the corresponding rule doc is injected into the LLM prompt to guide the review. Files not matching any specific pattern fall back to `default.md`.

Adding a language is a great way to make your first contribution. Language expertise helps ensure the test patterns match real-world project conventions and the review rules capture genuine pitfalls — not just generic advice.

Contributor guide

Open the contributing guide

Research direction

Choose one language group and create a sub-issue before changing the allowlist. Start with internal/config/allowlist/supported_file_types.json, default_exclude_patterns.json, and allowed_ext_test.go; review matching rule examples under internal/config/rules/rule_docs/. Done means the extension and applicable exclusions have positive and negative tests, and make test plus make check pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
devtools, testing-qa, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.