Skip to content

feat(rules): add Rust language rules#660

Closed
chris-yyau wants to merge 5 commits intoaffaan-m:mainfrom
chris-yyau:feat/rust-rules
Closed

feat(rules): add Rust language rules#660
chris-yyau wants to merge 5 commits intoaffaan-m:mainfrom
chris-yyau:feat/rust-rules

Conversation

@chris-yyau
Copy link
Copy Markdown
Contributor

@chris-yyau chris-yyau commented Mar 20, 2026

Summary

  • Add language-specific rules for Rust extending the common rule set, following the same pattern established by Java rules (feat(rules): add Java language rules #645)
  • Five rule files covering coding style, testing, patterns, hooks, and security
  • Rules reference existing rust-patterns and rust-testing skills for deep content, avoiding duplication

Files added

File Content
rules/rust/coding-style.md rustfmt, clippy, ownership idioms, error handling with thiserror/anyhow, iterators, module organization, visibility
rules/rust/testing.md cargo test, rstest parameterized tests, mockall mocking with mock! macro, tokio async tests, cargo-llvm-cov coverage
rules/rust/patterns.md Trait-based repository, newtype for type safety, enum state machines, builder, sealed traits, API response envelope
rules/rust/hooks.md PostToolUse hooks for rustfmt, clippy, cargo check
rules/rust/security.md Secrets via env vars, parameterized SQL with sqlx, parse-don't-validate input validation, unsafe code audit, cargo-audit/cargo-deny dependency scanning

Design decisions

  • Rules vs Skills: Rules are concise standards (~100-170 lines) defining what to do; skills are deep reference material (~500 lines) showing how. Each rule file ends with references to the relevant skill.
  • YAML frontmatter: Uses paths: ["**/*.rs"] (plus **/Cargo.toml for hooks) matching the convention in other language rule directories.
  • Code examples: Focused on security-sensitive patterns (SQL injection, unsafe, error exposure) per codex review feedback. Examples use backend-agnostic sqlx placeholders and proper HTTP status codes.

Test plan

  • Codex review passed on both commits (6 iterations total, fixing email validation, SQL placeholder syntax, unsafe lifetime docs, mockall mock! pattern, HTTP status codes)
  • Verify rule files render correctly on GitHub
  • Verify paths: frontmatter activates rules for .rs files

🤖 Generated with Claude Code


Summary by cubic

Adds Rust language rules that extend our common standards for style, testing, patterns, hooks, and security. Also fixes test harness issues on Windows and an ESLint warning.

  • New Features

    • rules/rust/coding-style.md: rustfmt, clippy -D warnings, ownership/borrowing, errors (thiserror/anyhow), iterators, modules/visibility.
    • rules/rust/testing.md: unit/integration layout, rstest, proptest, mockall, async via #[tokio::test], coverage with cargo-llvm-cov.
    • rules/rust/patterns.md: trait repos, service layer, newtypes, enum state machines, builders, sealed traits, API response envelope.
    • rules/rust/hooks.md: PostToolUse for cargo fmt, cargo clippy, cargo check.
    • rules/rust/security.md: env-based secrets, parameterized SQL with sqlx (Postgres $1), parse-don’t-validate, unsafe audit, cargo-audit/cargo-deny.
  • Bug Fixes

    • Examples: added missing imports; consistent anyhow::Result with anyhow::Context; corrected #[tokio::test]; wrapped mockall in #[cfg(test)]; switched sqlx placeholders to $1; fixed cargo test --test api_test; removed Cargo.lock from hooks paths.
    • Tests: mirror HOME to USERPROFILE in cost-tracker.test.js for Windows; suppress ESLint no-unused-vars in selective-install.test.js.
    • Docs: updated counts in README.md and AGENTS.md (skills 113, commands 58).

Written for commit 2283e81. Summary will update on new commits.

Summary by CodeRabbit

  • Documentation
    • Added comprehensive Rust guidance: coding style, hooks, reusable patterns, security, and testing best practices with examples.
    • Updated project README and plugin inventory counts to reflect new totals.
  • Tests
    • Improved test harness behavior and cross-platform env handling; minor test cleanup to suppress lint noise.

Copilot AI review requested due to automatic review settings March 20, 2026 04:30
@ecc-tools
Copy link
Copy Markdown
Contributor

ecc-tools bot commented Mar 20, 2026

Analyzing 5000 commits...

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 20, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Added five Rust-specific documentation files (coding style, hooks, patterns, security, testing), updated test utilities and two test files for environment handling and lint suppression, and adjusted AGENTS/README catalog counts for skills and commands.

Changes

Cohort / File(s) Summary
Rust Development Rules
rules/rust/coding-style.md, rules/rust/hooks.md, rules/rust/patterns.md, rules/rust/security.md, rules/rust/testing.md
New Rust docs: coding conventions (cargo fmt/clippy, formatting, immutability, naming, ownership, error handling, iterator guidance, visibility/module organization), tooling/hooks config (cargo fmt, cargo clippy, cargo check), reusable patterns (repository/service/newtype/state machine/builder/sealed-trait/API envelope), security guidance (secret management, SQL parameterization, unsafe usage rules, dependency audits), and testing guidance (unit/integration layout, rstest/proptest/mockall/Tokio, coverage expectations).
Test utilities & tests
tests/hooks/cost-tracker.test.js, tests/lib/selective-install.test.js
cost-tracker.test.js: unify env merging via { ...process.env, ...envOverrides }, mirror HOMEUSERPROFILE on Windows, and adjust test invocation style; selective-install.test.js: added inline ESLint disable comment to a destructured import.
Docs counts updates
AGENTS.md, README.md
Updated catalog totals: skills 109→113 and commands 57→58 reflected in both files.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • affaan-m

Poem

🐇 I hopped through rules and tidyled crates,

Five new pages for Rusty fates,
Tests now mind where HOME resides,
Docs shine bright with patterns and guides,
A carrot-coded cheer for all updates. 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main change: adding Rust language rules (five new rule files under rules/rust/) following the established pattern for language-specific rules.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

@ecc-tools
Copy link
Copy Markdown
Contributor

ecc-tools bot commented Mar 20, 2026

Analysis Failed

Not Found - https://docs.github.com/rest/git/refs#get-a-reference

Troubleshooting
Cause Resolution
Large repository Analysis may timeout on repos with extensive history
API rate limits Wait 15 minutes before retrying
Network issues Queue timeout is 15 minutes; retry may succeed
Permissions Verify app has Contents: Read access

Retry: /ecc-tools analyze


Report Issue | ECC Tools

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Rust-specific ruleset under rules/rust/, mirroring the established per-language structure (e.g., Java/Kotlin) and extending the shared rules/common/* guidance with Rust conventions and examples.

Changes:

  • Introduces Rust coding style rules (rustfmt/clippy, ownership/borrowing, error handling, module/visibility guidance).
  • Adds Rust testing rules (unit/integration organization, rstest/mockall/tokio testing patterns, coverage commands).
  • Adds Rust patterns, hooks, and security rules (trait-based repos/services, hooks for fmt/clippy/check, secrets/SQLi/input validation/unsafe/deps/error exposure).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
rules/rust/coding-style.md Rust-specific coding standards and idioms extending common coding-style guidance.
rules/rust/testing.md Rust testing organization/framework guidance extending common testing guidance.
rules/rust/patterns.md Rust architectural/pattern recommendations extending common patterns guidance.
rules/rust/hooks.md Rust-specific PostToolUse hook recommendations extending common hooks guidance.
rules/rust/security.md Rust security practices extending common security guidance.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +91 to +96
fn load_config(path: &str) -> anyhow::Result<Config> {
let content = std::fs::read_to_string(path)
.with_context(|| format!("failed to read {path}"))?;
toml::from_str(&content)
.with_context(|| format!("failed to parse {path}"))
}
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This snippet calls .with_context(...) but doesn’t bring the anyhow::Context trait into scope, so it won’t compile as-is. Add use anyhow::Context; (or fully qualify) in the example to make it runnable.

Copilot uses AI. Check for mistakes.
Comment on lines +39 to +44
pub fn place_order(&self, request: CreateOrderRequest) -> Result<OrderSummary> {
let order = Order::from(request);
self.payment.charge(order.total())?;
let saved = self.repo.save(&order)?;
Ok(OrderSummary::from(saved))
}
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

place_order is declared to return Result<OrderSummary> but Rust’s standard Result requires two type parameters. Consider using anyhow::Result<OrderSummary> for an application-style example, or Result<OrderSummary, ServiceError> for a library/service-style example.

Copilot uses AI. Check for mistakes.
struct UserId(u64);
struct OrderId(u64);

fn get_order(user: UserId, order: OrderId) -> Result<Order> {
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_order returns Result<Order> (missing the error type parameter), which won’t compile with the standard Result. Use anyhow::Result<Order> or an explicit Result<Order, E> to keep the example valid.

Suggested change
fn get_order(user: UserId, order: OrderId) -> Result<Order> {
fn get_order(user: UserId, order: OrderId) -> anyhow::Result<Order> {

Copilot uses AI. Check for mistakes.
Comment on lines +21 to +24
fn load_api_key() -> Result<String> {
std::env::var("PAYMENT_API_KEY")
.context("PAYMENT_API_KEY must be set")
}
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

load_api_key returns Result<String> (missing the error type parameter) and uses .context(...) which requires anyhow::Context in scope. Consider changing the signature to anyhow::Result<String> and adding/importing the Context trait in the example so it compiles.

Copilot uses AI. Check for mistakes.
Comment on lines +100 to +101
pub UserRepository {}
impl UserRepository for UserRepository {
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this mockall::mock! example, the macro defines a mock type named UserRepository, which conflicts with the already-defined pub trait UserRepository in the same scope. Use a different mock type name (or qualify the trait path in the impl ... for ... clause) so the example compiles and avoids the name collision.

Suggested change
pub UserRepository {}
impl UserRepository for UserRepository {
pub MockUserRepository {}
impl UserRepository for MockUserRepository {

Copilot uses AI. Check for mistakes.
- **rstest** for parameterized tests and fixtures
- **proptest** for property-based testing
- **mockall** for trait-based mocking
- **tokio::test** for async tests
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the framework list, tokio::test is presented as if it were a path/function, but the actual test macro is used as an attribute (#[tokio::test]). Consider updating the bullet to show the attribute form for consistency with the example below.

Suggested change
- **tokio::test** for async tests
- **`#[tokio::test]`** for async tests

Copilot uses AI. Check for mistakes.
Comment on lines +26 to +32
fn normalize(input: &str) -> Cow<'_, str> {
if input.contains(' ') {
Cow::Owned(input.replace(' ', "_"))
} else {
Cow::Borrowed(input)
}
}
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example uses Cow<'_, str> and Cow::... without importing Cow (it’s not in the Rust prelude). Use std::borrow::Cow in the signature/variants or add an explicit use std::borrow::Cow; so the snippet compiles as written.

Copilot uses AI. Check for mistakes.
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 20, 2026

Greptile Summary

This PR adds five Rust language rule files (coding-style.md, testing.md, patterns.md, hooks.md, security.md) under rules/rust/, following the same conventions established by the Java rules (#645). The rules are concise standards that delegate deep reference material to the existing rust-patterns and rust-testing skills. Also included are a Windows-compatibility fix in tests/hooks/cost-tracker.test.js and a count update in README.md/AGENTS.md.

Key findings:

  • rules/rust/security.md line 38 — incorrect SQLite placeholder label: The inline comment documents SQLite: $1, but sqlx-sqlite uses ? as the positional placeholder (same as MySQL). $1 is PostgreSQL-only in sqlx. A developer copying the SQLite column of that comment will get an error.
  • rules/rust/testing.mdproptest listed without an example: proptest is advertised as one of the five recommended test tools, but no example section exists for it. This leaves readers with no practical guidance on when or how to apply property-based testing.
  • All previously flagged issues (Cargo.lock in paths, ? vs $1 placeholder, unqualified Result<T>, mockall module placement) have been addressed in this final commit.
  • The tests/hooks/cost-tracker.test.js change correctly maps HOMEUSERPROFILE for Windows compatibility without altering test logic.

Confidence Score: 4/5

  • Safe to merge after fixing the incorrect SQLite placeholder label in the security rules comment.
  • The PR is primarily documentation. All previous review feedback was addressed. The one remaining factual error (SQLite placeholder comment) is low-risk since it only affects developers who read and copy that specific column of the comment, but it does constitute misleading guidance in a security-focused rule file. Everything else — hooks paths, patterns, test organization, count updates — is correct.
  • rules/rust/security.md (line 38 — incorrect SQLite placeholder in comment)

Important Files Changed

Filename Overview
rules/rust/security.md New Rust security rules covering secrets, SQL injection, input validation, unsafe code, and dependency scanning; contains an incorrect SQLite placeholder label in the sqlx comment ($1 instead of ?).
rules/rust/testing.md New Rust testing rules covering unit/integration layout, rstest, mockall, async tests, and coverage; proptest is listed as a recommended framework but has no accompanying example.
rules/rust/coding-style.md New Rust coding-style rules covering rustfmt, clippy, immutability, naming, ownership/borrowing, error handling with thiserror/anyhow, iterator idioms, module layout, and visibility — well-structured with clear GOOD/BAD examples.
rules/rust/patterns.md New Rust patterns rules covering repository trait, service layer, newtype, enum state machines, builder, sealed traits, and API envelope — all examples use fully-qualified anyhow::Result and are self-contained.
rules/rust/hooks.md New Rust hooks rules configuring PostToolUse triggers for cargo fmt, cargo clippy, and cargo check; paths correctly limited to **/*.rs and **/Cargo.toml (no lock file).
tests/hooks/cost-tracker.test.js Adds Windows compatibility by mirroring HOME to USERPROFILE for os.homedir() and reformats ternary test result counting — no logic change, clean improvement.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Developer edits *.rs file] --> B{PostToolUse Hook Fires}
    B --> C[cargo fmt\nauto-format]
    B --> D[cargo clippy\n-D warnings lint]
    B --> E[cargo check\ncompilation verify]

    C --> F{Code Passes?}
    D --> F
    E --> F

    F -- Yes --> G[Commit Ready]
    F -- No --> A

    G --> H{Rule Files Activated\nvia paths frontmatter}
    H --> H1[coding-style.md\nrustfmt · clippy · ownership]
    H --> H2[testing.md\nunit · rstest · mockall · async]
    H --> H3[patterns.md\nrepo · newtype · builder · FSM]
    H --> H4[security.md\nsecrets · SQL · unsafe · audit]
    H --> H5[hooks.md\nPostToolUse config]

    H1 & H2 & H3 & H4 & H5 --> I[Deep Reference Skills]
    I --> I1[rust-patterns skill]
    I --> I2[rust-testing skill]
Loading

Last reviewed commit: "fix(tests): fix ESLi..."

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 5 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="rules/rust/testing.md">

<violation number="1" location="rules/rust/testing.md:146">
P2: Rust testing docs use an integration test target name that is inconsistent with the file layout example, making the command likely invalid when copied.</violation>
</file>

<file name="rules/rust/security.md">

<violation number="1" location="rules/rust/security.md:39">
P2: The sqlx "GOOD" example hardcodes `?` placeholder, which is invalid for Postgres despite claiming multi-backend guidance.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
rules/rust/coding-style.md (1)

24-33: Make snippets copy-paste compilable by adding required imports.

The examples use Cow and .with_context(...) without showing required imports, so they fail when copied verbatim. Add use std::borrow::Cow; and use anyhow::Context; (or fully qualify in snippet).

Suggested doc diff
 ```rust
+use std::borrow::Cow;
+
 // GOOD — immutable by default, new value returned
 fn normalize(input: &str) -> Cow<'_, str> {
@@
 // GOOD — application error with anyhow
+use anyhow::Context;
+
 fn load_config(path: &str) -> anyhow::Result<Config> {
     let content = std::fs::read_to_string(path)
         .with_context(|| format!("failed to read {path}"))?;

Also applies to: 91-96

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rules/rust/coding-style.md` around lines 24 - 33, The snippets reference Cow
and anyhow's Context without imports causing non-compilable examples; add the
missing imports (e.g., add use std::borrow::Cow; for the normalize/Cow example
and add use anyhow::Context; for load_config/.with_context) or fully qualify
those types/traits in the snippets so functions like normalize and load_config
and calls to .with_context compile when copy-pasted.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@rules/rust/security.md`:
- Around line 37-42: The "GOOD" example uses a backend-specific placeholder
(`?`) that breaks for Postgres; update the docs to either show explicit
per-backend examples using sqlx::query with Postgres placeholders (`$1`, `$2`),
MySQL (`?`), and SQLite (`?1`/`?`) or present a backend-agnostic pattern (e.g.,
show usage of sqlx::query with .bind and note the correct placeholder for each
supported backend). Reference the example's symbol sqlx::query and the
.bind(&name) call so readers can find and replace the placeholder token
appropriate for their DB.

---

Nitpick comments:
In `@rules/rust/coding-style.md`:
- Around line 24-33: The snippets reference Cow and anyhow's Context without
imports causing non-compilable examples; add the missing imports (e.g., add use
std::borrow::Cow; for the normalize/Cow example and add use anyhow::Context; for
load_config/.with_context) or fully qualify those types/traits in the snippets
so functions like normalize and load_config and calls to .with_context compile
when copy-pasted.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bb6147c1-0bd9-431f-9d0d-177e06c06f2c

📥 Commits

Reviewing files that changed from the base of the PR and between 1b21e08 and 59265d6.

📒 Files selected for processing (5)
  • rules/rust/coding-style.md
  • rules/rust/hooks.md
  • rules/rust/patterns.md
  • rules/rust/security.md
  • rules/rust/testing.md

@ecc-tools
Copy link
Copy Markdown
Contributor

ecc-tools bot commented Mar 20, 2026

Analyzing 5000 commits...

@ecc-tools
Copy link
Copy Markdown
Contributor

ecc-tools bot commented Mar 20, 2026

Analysis Failed

Not Found - https://docs.github.com/rest/git/refs#get-a-reference

Troubleshooting
Cause Resolution
Large repository Analysis may timeout on repos with extensive history
API rate limits Wait 15 minutes before retrying
Network issues Queue timeout is 15 minutes; retry may succeed
Permissions Verify app has Contents: Read access

Retry: /ecc-tools analyze


Report Issue | ECC Tools

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 5 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="rules/rust/hooks.md">

<violation number="1" location="rules/rust/hooks.md:5">
P2: Removing `**/Cargo.lock` from Rust hook paths drops rule activation for lockfile-only dependency changes.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@chris-yyau
Copy link
Copy Markdown
Contributor Author

Review feedback addressed

Thanks to all reviewers! All issues from the initial round have been fixed in commit cd4c557:

Fixed (from Copilot, Greptile, Cubic, CodeRabbit):

  • ✅ Added missing imports: use std::borrow::Cow, use anyhow::Context
  • ✅ Changed Result<T>anyhow::Result<T> in patterns.md and security.md
  • ✅ Changed sqlx placeholder from ? to $1 (Postgres is most common Rust backend)
  • ✅ Removed Cargo.lock from hooks.md paths (auto-generated, not relevant to fmt/clippy/check hooks)
  • ✅ Fixed tokio::test to attribute form #[tokio::test]
  • ✅ Fixed mockall mock! name collision — renamed to MockRepo, wrapped in #[cfg(test)] mod tests
  • ✅ Fixed --test integration--test api_test to match file layout

Regarding the new Cubic comment on Cargo.lock removal: This was intentionally removed per Greptile's recommendation. The hooks file defines PostToolUse hooks for cargo fmt, cargo clippy, and cargo check — none of which are relevant to lockfile changes. This matches the Java hooks pattern which excludes lockfile equivalents.

@affaan-m
Copy link
Copy Markdown
Owner

Thanks for addressing the review comments. CI tests are still failing across all platforms though — likely the component validation or catalog counts need updating to reflect the new rule files.

Please check the failing test output and fix the validation errors. Once CI is green, this is ready to merge.

@ecc-tools
Copy link
Copy Markdown
Contributor

ecc-tools bot commented Mar 20, 2026

Analyzing 5000 commits...

@ecc-tools
Copy link
Copy Markdown
Contributor

ecc-tools bot commented Mar 20, 2026

Analysis Failed

Not Found - https://docs.github.com/rest/git/refs#get-a-reference

Troubleshooting
Cause Resolution
Large repository Analysis may timeout on repos with extensive history
API rate limits Wait 15 minutes before retrying
Network issues Queue timeout is 15 minutes; retry may succeed
Permissions Verify app has Contents: Read access

Retry: /ecc-tools analyze


Report Issue | ECC Tools

chris-yyau and others added 4 commits March 20, 2026 15:54
Add language-specific rules for Rust extending the common rule set:
- coding-style.md: rustfmt, clippy, ownership idioms, error handling,
  iterator patterns, module organization, visibility
- hooks.md: PostToolUse hooks for rustfmt, clippy, cargo check
- patterns.md: trait-based repository, newtype, enum state machines,
  builder, sealed traits, API response envelope

Rules reference existing rust-patterns skill for deep content.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Add remaining Rust language-specific rules:
- testing.md: cargo test, rstest parameterized tests, mockall mocking
  with mock! macro, tokio async tests, cargo-llvm-cov coverage
- security.md: secrets via env vars, parameterized SQL with sqlx,
  parse-don't-validate input validation, unsafe code audit requirements,
  cargo-audit dependency scanning, proper HTTP error status codes

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Fixes from Copilot, Greptile, Cubic, and CodeRabbit reviews:
- Add missing imports: use std::borrow::Cow, use anyhow::Context
- Use anyhow::Result<T> consistently (patterns.md, security.md)
- Change sqlx placeholder from ? to $1 (Postgres is most common)
- Remove Cargo.lock from hooks.md paths (auto-generated file)
- Fix tokio::test to show attribute form #[tokio::test]
- Fix mockall mock! name collision, wrap in #[cfg(test)] mod tests
- Fix --test target to match file layout (api_test, not integration)

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Update documented counts to match actual repository state after rebase:
- Skills: 109 → 113 (new skills merged to main)
- Commands: 57 → 58 (new command merged to main)

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
@ecc-tools
Copy link
Copy Markdown
Contributor

ecc-tools bot commented Mar 20, 2026

Analyzing 5000 commits...

@ecc-tools
Copy link
Copy Markdown
Contributor

ecc-tools bot commented Mar 20, 2026

Analysis Complete

Generated ECC bundle from 500 commits | Confidence: 100%

View Pull Request #685

Repository Profile
Attribute Value
Language JavaScript
Framework Not detected
Commit Convention conventional
Test Directory separate
Detected Workflows (9)
Workflow Description
feature-development Standard feature implementation workflow
add-new-skill Adds a new skill to the repository, often with Antigravity/Codex/Cursor harness support and review-driven iteration.
add-new-agent Adds a new agent to the repository, registers it in documentation, and updates agent catalog.
add-language-ruleset Adds a new set of language-specific rules (coding-style, hooks, patterns, security, testing) for a programming language.
add-command-and-backing-skill Adds a new command (CLI or slash command) and a corresponding backing skill.
Generated Instincts (17)
Domain Count
git 2
code-style 3
testing 3
workflow 9

After merging, import with:

/instinct-import .claude/homunculus/instincts/inherited/everything-claude-code-instincts.yaml

Files

  • .claude/ecc-tools.json
  • .claude/skills/everything-claude-code/SKILL.md
  • .agents/skills/everything-claude-code/SKILL.md
  • .agents/skills/everything-claude-code/agents/openai.yaml
  • .claude/identity.json
  • .codex/config.toml
  • .codex/AGENTS.md
  • .codex/agents/explorer.toml
  • .codex/agents/reviewer.toml
  • .codex/agents/docs-researcher.toml
  • .claude/homunculus/instincts/inherited/everything-claude-code-instincts.yaml
  • .claude/rules/everything-claude-code-guardrails.md
  • .claude/research/everything-claude-code-research-playbook.md
  • .claude/team/everything-claude-code-team-config.json
  • .claude/enterprise/controls.md
  • .claude/commands/feature-development.md
  • .claude/commands/add-new-skill.md
  • .claude/commands/add-new-agent.md

ECC Tools | Everything Claude Code

- selective-install.test.js: suppress no-unused-vars for loadInstallManifests
  (imported for future use), remove unused result variable
- cost-tracker.test.js: mirror HOME to USERPROFILE in env overrides so
  os.homedir() resolves to temp dir on Windows

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
tests/hooks/cost-tracker.test.js (1)

54-65: Consider inlining the ternary for readability.

The separated multiline ternary after the test call is functional but slightly unusual. An inline pattern or a simpler conditional block might be clearer.

♻️ Optional: Simplified pattern using if statement
-  test('passes through input on stdout', () => {
+  if (test('passes through input on stdout', () => {
     const input = {
       model: 'claude-sonnet-4-20250514',
       usage: { input_tokens: 100, output_tokens: 50 }
     };
     const inputStr = JSON.stringify(input);
     const result = runScript(input);
     assert.strictEqual(result.code, 0, `Expected exit code 0, got ${result.code}`);
     assert.strictEqual(result.stdout, inputStr, 'Expected stdout to match original input');
-  })
-    ? passed++
-    : failed++;
+  })) { passed++; } else { failed++; }

Alternatively, you could keep the current pattern if the team prefers it — it's functionally correct.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/hooks/cost-tracker.test.js` around lines 54 - 65, The multiline ternary
after the test call is confusing; change the pattern to a simple conditional so
it's clearer: after calling runScript (the variable result) and asserting,
replace the separated " ? passed++ : failed++" with a straightforward if/else
that increments passed or failed (or, if you prefer brevity, move the ternary
inline on the same line) — locate the test block with the description 'passes
through input on stdout', the variables inputStr and result from runScript, and
update the increment logic to a single-line conditional or explicit if/else for
readability.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@tests/hooks/cost-tracker.test.js`:
- Around line 54-65: The multiline ternary after the test call is confusing;
change the pattern to a simple conditional so it's clearer: after calling
runScript (the variable result) and asserting, replace the separated " ?
passed++ : failed++" with a straightforward if/else that increments passed or
failed (or, if you prefer brevity, move the ternary inline on the same line) —
locate the test block with the description 'passes through input on stdout', the
variables inputStr and result from runScript, and update the increment logic to
a single-line conditional or explicit if/else for readability.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7512f64b-7a71-481f-abd3-5cd65a2e05a7

📥 Commits

Reviewing files that changed from the base of the PR and between 44fdf79 and 2283e81.

📒 Files selected for processing (2)
  • tests/hooks/cost-tracker.test.js
  • tests/lib/selective-install.test.js
✅ Files skipped from review due to trivial changes (1)
  • tests/lib/selective-install.test.js

affaan-m added a commit that referenced this pull request Mar 20, 2026
* feat(rules): add Rust coding style, hooks, and patterns rules

Add language-specific rules for Rust extending the common rule set:
- coding-style.md: rustfmt, clippy, ownership idioms, error handling,
  iterator patterns, module organization, visibility
- hooks.md: PostToolUse hooks for rustfmt, clippy, cargo check
- patterns.md: trait-based repository, newtype, enum state machines,
  builder, sealed traits, API response envelope

Rules reference existing rust-patterns skill for deep content.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

* feat(rules): add Rust testing and security rules

Add remaining Rust language-specific rules:
- testing.md: cargo test, rstest parameterized tests, mockall mocking
  with mock! macro, tokio async tests, cargo-llvm-cov coverage
- security.md: secrets via env vars, parameterized SQL with sqlx,
  parse-don't-validate input validation, unsafe code audit requirements,
  cargo-audit dependency scanning, proper HTTP error status codes

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

* fix(rules): address review feedback on Rust rules

Fixes from Copilot, Greptile, Cubic, and CodeRabbit reviews:
- Add missing imports: use std::borrow::Cow, use anyhow::Context
- Use anyhow::Result<T> consistently (patterns.md, security.md)
- Change sqlx placeholder from ? to $1 (Postgres is most common)
- Remove Cargo.lock from hooks.md paths (auto-generated file)
- Fix tokio::test to show attribute form #[tokio::test]
- Fix mockall mock! name collision, wrap in #[cfg(test)] mod tests
- Fix --test target to match file layout (api_test, not integration)

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

* fix: update catalog counts in README.md and AGENTS.md

Update documented counts to match actual repository state after rebase:
- Skills: 109 → 113 (new skills merged to main)
- Commands: 57 → 58 (new command merged to main)

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

---------

Co-authored-by: Chris Yau <chris@diveanddev.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Happy <yesreply@happy.engineering>
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.

3 participants