Skip to content

feat(rules): add assembly and linker script review rules - #43

Open
chethanuk wants to merge 2 commits into
mainfrom
feat/issue-1243-asm-linker-rules
Open

chethanuk wants to merge 2 commits into
mainfrom
feat/issue-1243-asm-linker-rules

Conversation

@chethanuk

@chethanuk chethanuk commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

Description

Assembly (.s, .S) and linker script (.ld, .lds) files are dropped by the extension allowlist, so they never reach review. Part of alibaba#1243 (kernel/BSP code review, under alibaba#470).

Changes:

  • Add .s, .S, .ld and .lds to supported_file_types.json.
  • In system_rules.json, route **/*.{ld,lds} and **/*[.]lds.s to linker_script.md, ahead of **/*.s to asm.md, so vmlinux.lds.S gets the linker rule. The [.] keeps names such as builds.s on the assembly rule.
  • Add asm.md and linker_script.md rule docs.
  • Add one row per locale (en, ja, ko, zh, ru) to review-rules.md.

It appends to the same tail lines as the devicetree PR (#42, not in upstream yet), so the two conflict trivially. Whichever lands second needs a rebase.

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?

New allowlist and rule-matching table rows fail before the change and pass after it, including rows that keep builds.s, fields.S and lds.s on the assembly rule.

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

go test -race ./... and make check pass. In a scratch repo, delegate preview on entry.S, vmlinux.lds.S and board/link.ld reports reviewable_count 3, excluded 0. With --exclude 'arch/**' only board/link.ld stays reviewable.

Known limits:

  • A plain assembly file literally named *.lds.s still gets the linker rule. The docs tell the reviewer to skip linker checks when the file has no linker content.
  • This adds no kernel-specific rule.
  • Devicetree files are a separate PR.

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.

Claude (Anthropic) drafted the change and this description. I reviewed all of it and will answer review comments myself.

Related Issues

Refs alibaba#1243

Allow .s/.S, .ld and .lds files and add asm.md and linker_script.md rules, with *lds.s mapped to the linker rule ahead of **/*.s. Refs alibaba#1243, alibaba#470.

Signed-off-by: ChethanUK <chethanuk@outlook.com>
@codeant-ai

codeant-ai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 7f5d140 Oct 01, 2026 · 19:22 19:24

@codeant-ai

codeant-ai Bot commented Oct 1, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 38 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 853f8311-9ac5-40b2-9c4d-707a7374cfeb

📥 Commits

Reviewing files that changed from the base of the PR and between a758d9c and 7bdd75d.

📒 Files selected for processing (11)
  • internal/config/allowlist/allowed_ext_test.go
  • internal/config/allowlist/supported_file_types.json
  • internal/config/rules/rule_docs/asm.md
  • internal/config/rules/rule_docs/linker_script.md
  • internal/config/rules/system_rules.json
  • internal/config/rules/system_rules_test.go
  • pages/src/content/docs/en/review-rules.md
  • pages/src/content/docs/ja/review-rules.md
  • pages/src/content/docs/ko/review-rules.md
  • pages/src/content/docs/ru/review-rules.md
  • pages/src/content/docs/zh/review-rules.md
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codeant-ai codeant-ai Bot added the size:M This PR changes 30-99 lines, ignoring generated files label Oct 1, 2026
@codeant-ai

codeant-ai Bot commented Oct 1, 2026

Copy link
Copy Markdown

User description

Description

Assembly (.s, .S) and linker script (.ld, .lds) files are dropped by the extension allowlist, so they never reach review. This is part of alibaba#1243 (kernel/BSP code review), under alibaba#470.

Changes:

  • Add .s, .S, .ld and .lds to supported_file_types.json.
  • Add three globs in system_rules.json, linker first: **/*.ld, **/*.lds, **/*lds.s -> linker_script.md, then **/*.s -> asm.md. The linker globs come first so vmlinux.lds.S gets the linker rule instead of the generic assembly one.
  • Add asm.md and linker_script.md rule docs.
  • Add one row per locale (en, ja, ko, zh, ru) to review-rules.md.

It appends to the same tail lines as the devicetree PR (#42, not in upstream yet), so the two will conflict trivially. Whichever lands second needs a rebase.

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?

New allowlist and rule-matching table rows fail before the change and pass after it.

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

go test -race ./... and make check pass. In a scratch repo, delegate preview on entry.S, vmlinux.lds.S and board/link.ld reports reviewable_count 3, excluded 0. With --exclude 'arch/**' only board/link.ld stays reviewable.

Known limits:

  • **/*lds.s also matches names like builds.s. The docs tell the reviewer to skip linker checks when the file has no linker content.
  • This adds no kernel-specific rule.
  • Devicetree files are a separate PR.

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.

Claude (Anthropic) drafted the change and this description. I reviewed all of it and will answer review comments myself.

Related Issues

Refs alibaba#1243


CodeAnt-AI Description

Add review coverage for assembly and linker script files

What Changed

  • Assembly files (.s and .S) are now included in reviews and checked for calling-convention, register, stack, memory-ordering, alignment, and macro issues
  • Linker scripts (.ld, .lds, and preprocessed .lds.S) are now included in reviews and checked for memory placement, section ordering, symbol boundaries, alignment, and retention issues
  • Linker script patterns take precedence over generic assembly matching, so .lds.S files receive the correct review guidance
  • Rule documentation and file-matching references now describe the new coverage in all supported locales

Impact

✅ Assembly defects surfaced during review
✅ Linker placement and memory-map issues surfaced during review
✅ Kernel and embedded build files no longer skipped

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@codeant-ai

codeant-ai Bot commented Oct 1, 2026

Copy link
Copy Markdown

CodeAnt Nitpicks

2 code suggestions

1. The *lds.s pattern also matches ordinary assembly files such as arch/lds.s, so they receive linker-script guidance instead of assembly guidance.

Incorrect condition logic · internal/config/rules/system_rules.json:59


2. The documented glob does not match .lds.S files, despite the description claiming that it includes them, so the matching-order documentation is inaccurate.

Docstring mismatch · pages/src/content/docs/en/review-rules.md:342

…n lds.s

**/*lds.s also routed builds.s and fields.S to linker_script.md. **/*[.]lds.s
requires the dot, so vmlinux.lds.S still resolves to the linker rule (the
integrity test's globExt skips it as it has no '*.' prefix). Table rows added.

Signed-off-by: ChethanUK <chethanuk@outlook.com>
@chethanuk chethanuk mentioned this pull request Oct 1, 2026
8 of 15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant