Repository navigation
feat(rules): add Solidity and Vyper review rules - #961
Merged
lizhengfeng101 merged 2 commits intoAug 27, 2026
Merged
Conversation
Contributor
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 3 selected item(s). |
chethanuk
force-pushed
the
wf/solidity-vyper-language-support
branch
2 times, most recently
from
August 17, 2026 07:35
57346f4 to
6e34b54
Compare
wu21-web
approved these changes
Aug 17, 2026
chethanuk
force-pushed
the
wf/solidity-vyper-language-support
branch
2 times, most recently
from
August 18, 2026 08:53
fa87067 to
a2cc110
Compare
`.sol` and `.vy` files were rejected by the extension allowlist, so no
review rules could ever run on them. `whyExcluded` checks `IsAllowedExt`
before any rule is resolved, so allowlisting the two extensions is what
makes the new rule docs reachable at all.
Adds `.sol`/`.vy` to supported_file_types.json, routes them to two new
rule docs via path_rule_map, and adds six exclude patterns.
Two rule docs rather than one shared EVM doc: the repo splits rule docs
by language syntax, not by domain (`c.md`/`cpp.md`, `po.md`/`pot.md`).
Vyper checks arithmetic by default and has no inheritance or inline
assembly, so half a shared doc would be wrong on every file it matched.
No `.v.py`: `extFromPath` takes the last dot of the basename, so
`token.v.py` resolves to `.py` and the entry could never be looked up.
Every remaining use of that extension is pre-0.1 viper-era code or a
tool's backward-compat list.
`**/*.t.sol` alone misses the test helpers and mock contracts that carry
no suffix — `test/BaseTest.sol`, `test/foundry/utils/BaseTest.sol` and
`contracts/test/ERC20TestToken.sol` are all real layouts — so
`**/test/**/*.sol` and `**/tests/**/*.sol` cover the directory the way
`**/test/**/*.jl` and `**/tests/**/*.nim` already do for other
languages. `.vy` gets both spellings of the directory for the same
reason.
`lib/**/*.sol` is root-anchored deliberately. `IsExcludedPath` applies
every pattern to every path with no language dispatch, and
`**/lib/**/*.sol` also matches `src/lib/Math.sol` — a project's own
library directory. The test table asserts both directions.
No build-output patterns: `out/`, `artifacts/`, `cache/` and
`typechain-types/` contain no `.sol` or `.vy` files, and are gitignored,
so internal/scan/provider.go's gitignore walk already skips them.
Users can re-admit any of this with `--include`, which `whyExcluded`
checks before `IsExcludedPath`.
The rule table in pages/src/content/docs/{en,ja,ru,zh}/review-rules.md
lists both new patterns.
chethanuk
force-pushed
the
wf/solidity-vyper-language-support
branch
from
August 21, 2026 06:19
a2cc110 to
f0be91f
Compare
Main's Objective-C/MATLAB `.m` rule lands on the same trailing lines this branch appends to: the pattern map in system_rules.json, the resolution table in system_rules_test.go, and the pattern table in all four locales of review-rules.md. Kept both sides, main's first; in the JSON that also means giving main's entry the comma it did not need as the last member. Claude-Session: https://claude.ai/code/session_01FoMHZQ3qqdt98LHTwSJuTG
Contributor
Author
|
@lizhengfeng101 Rebased onto main and conflicts resolved again. Please review this. Thanks :) |
Githab-capibara
added a commit
to Githab-capibara/open-code-review
that referenced
this pull request
Sep 17, 2026
`.sol` and `.vy` files were rejected by the extension allowlist, so no
review rules could ever run on them. `whyExcluded` checks `IsAllowedExt`
before any rule is resolved, so allowlisting the two extensions is what
makes the new rule docs reachable at all.
Adds `.sol`/`.vy` to supported_file_types.json, routes them to two new
rule docs via path_rule_map, and adds six exclude patterns.
Two rule docs rather than one shared EVM doc: the repo splits rule docs
by language syntax, not by domain (`c.md`/`cpp.md`, `po.md`/`pot.md`).
Vyper checks arithmetic by default and has no inheritance or inline
assembly, so half a shared doc would be wrong on every file it matched.
No `.v.py`: `extFromPath` takes the last dot of the basename, so
`token.v.py` resolves to `.py` and the entry could never be looked up.
Every remaining use of that extension is pre-0.1 viper-era code or a
tool's backward-compat list.
`**/*.t.sol` alone misses the test helpers and mock contracts that carry
no suffix — `test/BaseTest.sol`, `test/foundry/utils/BaseTest.sol` and
`contracts/test/ERC20TestToken.sol` are all real layouts — so
`**/test/**/*.sol` and `**/tests/**/*.sol` cover the directory the way
`**/test/**/*.jl` and `**/tests/**/*.nim` already do for other
languages. `.vy` gets both spellings of the directory for the same
reason.
`lib/**/*.sol` is root-anchored deliberately. `IsExcludedPath` applies
every pattern to every path with no language dispatch, and
`**/lib/**/*.sol` also matches `src/lib/Math.sol` — a project's own
library directory. The test table asserts both directions.
No build-output patterns: `out/`, `artifacts/`, `cache/` and
`typechain-types/` contain no `.sol` or `.vy` files, and are gitignored,
so internal/scan/provider.go's gitignore walk already skips them.
Users can re-admit any of this with `--include`, which `whyExcluded`
checks before `IsExcludedPath`.
The rule table in pages/src/content/docs/{en,ja,ru,zh}/review-rules.md
lists both new patterns.
This was referenced Oct 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
.soland.vyfiles were never reviewed. Neither extension is insupported_file_types.json, soIsAllowedExtdrops them at the filter gate before any rule can run, which is why a rule doc on its own would never have been reachable.This adds both extensions and registers two rule docs in
path_rule_map:**/*.sol→solidity.mdand**/*.vy→vyper.md. Data only, no Go source changes.Two docs rather than one shared EVM doc. The repo splits rule docs by language syntax, not by domain —
c.mdandcpp.mdstay separate despite covering the same ground, and multi-extension docs likehaskell.mdcover several file forms of a single language, never two languages. Vyper checks arithmetic by default and has neither inheritance nor inline assembly, so a merged doc would put claims into every Vyper review that are false for Vyper.The six exclude patterns are scoped by extension (
**/test/**/*.sol, not a bare**/test/**).IsExcludedPathapplies every pattern to every path with no language dispatch, so an unscopedtest/pattern would drop Julia, Nim and Haskell files as well.**/*.t.solon its own is not enough either: Foundry test helpers and mock contracts carry no suffix, andtest/utils/BaseTest.solandcontracts/test/ERC20TestToken.solare both real layouts. The directory patterns cover those the way**/test/**/*.jland**/tests/**/*.nimalready do. Both the singular and the plural spelling of the directory is present for each extension.lib/**/*.solis root-anchored on purpose. That is where Foundry installs git submodule dependencies, but**/lib/**/*.solwould also matchsrc/lib/Math.solandcontracts/lib/SafeMath.sol, which are a project's own hand-written library code. Three negative rows fail if anyone broadens the pattern later.Limitation
Vyper's legacy
.v.pyextension is not covered and cannot be.extFromPathtakes the last dot of the basename, sotoken.v.pyresolves to.pyand is reviewed as Python. An allowlist entry for.v.pywould never be looked up..soland.vydiffs that used to be skipped are now reviewed. Anyone who does not want that opts out with user exclude globs, which are checked before the allowlist.Type of Change
How Has This Been Tested?
make testpasses locallyRows appended to the existing table tests:
TestIsAllowedExt—.sol/.SOLand.vy/.VY.TestIsExcludedPath— the six patterns, the threelib/negatives above, andscript/Deploy.s.sol, which stays reviewable.TestResolve_DefaultRules— source paths for both extensions resolve by heading anchors unique to each doc.Checklist
go fmt,go vet)The rule table in
pages/src/content/docs/{en,ja,ru,zh}/review-rules.mdlists both new patterns.Related Issues
Part of #470.