Skip to content

feat(rules): add C# review support - #1616

Closed
RahulXDTT wants to merge 1 commit into
alibaba:mainfrom
RahulXDTT:feat/csharp-review-support
Closed

RahulXDTT wants to merge 1 commit into
alibaba:mainfrom
RahulXDTT:feat/csharp-review-support

Conversation

@RahulXDTT

@RahulXDTT RahulXDTT commented Sep 30, 2026 •

Copy link
Copy Markdown

Description

Adds first-class built-in review rules for C# and modern .NET (.NET Core / .NET 5+), including ASP.NET Core and EF Core-specific defect patterns.

  • Adds internal/config/rules/rule_docs/csharp.md with high-confidence review guidance covering correctness, nullability, async/concurrency, resource lifetime, security, ASP.NET Core, EF Core, and data-access defects.
  • Maps **/*.cs to csharp.md in internal/config/rules/system_rules.json.
  • Excludes common C# test files (**/*Test.cs, **/*Tests.cs) by default, consistent with existing compiled-language exclusions.
  • Adds rule-resolution and exclusion tests in internal/config/rules/ and internal/config/allowlist/.
  • Updates review-rule documentation across all supported locales (en, ja, ko, ru, zh).

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring (no functional changes)
  • Documentation update
  • CI / Build / Tooling

How Has This Been Tested?

  • make test passes locally
  • Manual testing (describe below)

Validation performed:

  • go test -race -count=1 ./internal/config/rules/... — PASS
  • go test -v -race -count=1 ./internal/config/allowlist/... — PASS
  • make check — PASS
  • make test — PASS
  • make coverage — PASS (92.1% statement coverage, above the 90% threshold)
  • make build — PASS
  • git diff --check — PASS
  • ./dist/opencodereview rules check src/Example.cs — PASS; resolves to the built-in **/*.cs / csharp.md rule

Checklist

  • My code follows the project's coding style (go fmt, go vet)
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the documentation accordingly (if applicable)
  • I have signed the CLA
  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

AI-assisted development

I used Antigravity CLI with Gemini 3.8 Flash and ChatGPT (GPT-5.6 Sol) to assist with repository analysis, implementation planning, and review. I manually reviewed the resulting changes and understand the code and documentation included in this PR.

Related Issues

Closes #1612

@github-actions

Copy link
Copy Markdown
Contributor

✅ OpenCodeReview: Review complete: 0 finding(s) across 2 selected item(s).

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@RahulXDTT

Copy link
Copy Markdown
Author

recheck

@wu21-web

Copy link
Copy Markdown
Contributor

@RahulXDTT Thanks for your submission. Like other language PRs, following needs to be done before merge.

  1. Check your rule documentation according to official documentation. A recheck greatly improves docs accuracy.
  2. Rebase main
  3. Sign the CLA, otherwise we cannot accept your contribution.

Thanks.

@lizhengfeng101

Copy link
Copy Markdown
Contributor

license/claWaiting for status to be reported — Contributor License Agreement is not signed yet. @RahulXDTT

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.

Add validation rules for the C# .NET language.

5 participants