Skip to content

Conversation

@YashSuthar983
Copy link
Contributor

@YashSuthar983 YashSuthar983 commented Nov 2, 2025

After running all all test i have added a another which check the rust format and if its not correct it make a commit with
[skip ci] which tell github workflow to ignore this commit.

issue :#6204

Summary by CodeRabbit

  • Chores
    • CI now auto-formats Rust code on PRs and commits formatting fixes when detected.
    • Formatting runs across the repository and posts a PR comment when changes were applied.
    • Lint check simplified to run only clippy; the separate formatting check was removed from the lint job.
    • Auto-format commits are skipped when the commit/PR message includes the conventional skip marker.

Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 2, 2025

Walkthrough

The CI lint job in .github/workflows/ci.yaml was narrowed to run only Clippy (rustfmt component and cargo fmt --check removed). A new workflow .github/workflows/auto-format.yaml was added to run cargo fmt --all and commit/push formatting changes (with [skip ci]) and optionally comment on PRs.

Changes

Cohort / File(s) Summary
CI workflow update
\.github/workflows/ci.yaml``
Renamed the lint job to run only Clippy: removed rustfmt from the rust-toolchain components and removed the cargo fmt --check step.
New auto-format workflow
\.github/workflows/auto-format.yaml``
Added a workflow that runs after CI completes: checks out code, installs Rust with rustfmt, runs cargo fmt --all, and if changes exist commits & pushes with [skip ci] and optionally posts a PR comment.

Sequence Diagram(s)

sequenceDiagram
    participant Upstream as Upstream Jobs
    participant Lint as lint (clippy)
    participant AutoFmt as auto-format workflow
    participant Repo as GitHub Repo

    Upstream->>Lint: required jobs finish
    Lint->>Lint: run clippy

    rect rgb(240,250,235)
    Note over AutoFmt: auto-format flow (rustfmt + commit)
    AutoFmt->>Repo: checkout head commit
    AutoFmt->>AutoFmt: setup Rust toolchain (with rustfmt)
    AutoFmt->>AutoFmt: run cargo fmt --all
    AutoFmt->>AutoFmt: detect formatting changes
    end

    alt changes detected
        AutoFmt->>Repo: git commit -m "[skip ci] autoformat"
        AutoFmt->>Repo: git push
        AutoFmt->>Repo: optionally post PR comment
    else no changes
        AutoFmt-->>AutoFmt: exit without commit/comment
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review focus:
    • .github/workflows/ci.yaml — confirm lint job name change and removal of rustfmt/component and that no unintended steps were removed.
    • .github/workflows/auto-format.yaml — permissions for commit/push, concurrency and if guards to avoid CI loops, correctness of using the triggering head commit, and PR comment step/token usage.

Poem

🐇
I nibbled trailing spaces from each line,
curled tabs to tails and made braces align.
A tiny commit with a quiet plea,
"[skip ci]" tucked in — tidy as can be.

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ 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 "Update CI auto-format" is related to the primary changes in the pull request, which involve refactoring the CI configuration to implement automated code formatting. The title refers to a real aspect of the changeset—the new auto-format workflow being added. However, the title is somewhat generic in its use of "update" and doesn't clearly convey the full scope of changes, which includes both removing rustfmt from the main lint job and adding a new separate auto-format workflow. While the title is meaningful enough that a teammate scanning history would understand the PR concerns auto-formatting in CI, it could be more specific about the nature of the update.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4760c69 and aae26a3.

📒 Files selected for processing (2)
  • .github/workflows/auto-format.yaml (1 hunks)
  • .github/workflows/ci.yaml (1 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
Repo: RustPython/RustPython PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-11T05:06:59.971Z
Learning: Applies to **/*.rs : Format Rust code with the default rustfmt style (run `cargo fmt`)
Learnt from: CR
Repo: RustPython/RustPython PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-11T05:06:59.971Z
Learning: Applies to **/*.rs : Run clippy and fix any warnings or lints introduced by your changes
📚 Learning: 2025-09-11T05:06:59.971Z
Learnt from: CR
Repo: RustPython/RustPython PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-11T05:06:59.971Z
Learning: Applies to **/*.rs : Run clippy and fix any warnings or lints introduced by your changes

Applied to files:

  • .github/workflows/ci.yaml
📚 Learning: 2025-07-10T10:08:43.330Z
Learnt from: ShaharNaveh
Repo: RustPython/RustPython PR: 5932
File: .github/workflows/comment-commands.yml:18-24
Timestamp: 2025-07-10T10:08:43.330Z
Learning: In GitHub Actions workflows for the RustPython project, the maintainer ShaharNaveh prefers to keep workflows simple and doesn't mind if steps fail when the desired state is already achieved (e.g., user already assigned to an issue). Avoid suggesting complex error handling for edge cases they don't consider problematic.

Applied to files:

  • .github/workflows/ci.yaml
  • .github/workflows/auto-format.yaml
📚 Learning: 2025-09-11T05:06:59.971Z
Learnt from: CR
Repo: RustPython/RustPython PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-11T05:06:59.971Z
Learning: Applies to extra_tests/**/*.py : Use ruff to lint custom Python code

Applied to files:

  • .github/workflows/ci.yaml
📚 Learning: 2025-09-11T05:06:59.971Z
Learnt from: CR
Repo: RustPython/RustPython PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-11T05:06:59.971Z
Learning: Applies to **/*.rs : Format Rust code with the default rustfmt style (run `cargo fmt`)

Applied to files:

  • .github/workflows/auto-format.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Run snippets and cpython tests (ubuntu-latest)
  • GitHub Check: Run snippets and cpython tests (windows-latest)
  • GitHub Check: Run snippets and cpython tests (macos-latest)
  • GitHub Check: Run rust tests (windows-latest)
🔇 Additional comments (1)
.github/workflows/ci.yaml (1)

309-330: Lint job changes look good—responsibility correctly shifted to auto-format workflow.

The removal of rustfmt from the components and the deletion of cargo fmt --check properly align with the new auto-format workflow's responsibility. The job now focuses solely on clippy, which is appropriate.


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.

Copy link
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: 3

📜 Review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a7e8ac6 and e3a4c59.

📒 Files selected for processing (1)
  • .github/workflows/ci.yaml (2 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
Repo: RustPython/RustPython PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-11T05:06:59.971Z
Learning: Applies to **/*.rs : Run clippy and fix any warnings or lints introduced by your changes
Learnt from: CR
Repo: RustPython/RustPython PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-11T05:06:59.971Z
Learning: Applies to **/*.rs : Format Rust code with the default rustfmt style (run `cargo fmt`)
📚 Learning: 2025-09-11T05:06:59.971Z
Learnt from: CR
Repo: RustPython/RustPython PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-11T05:06:59.971Z
Learning: Applies to **/*.rs : Run clippy and fix any warnings or lints introduced by your changes

Applied to files:

  • .github/workflows/ci.yaml
📚 Learning: 2025-09-11T05:06:59.971Z
Learnt from: CR
Repo: RustPython/RustPython PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-11T05:06:59.971Z
Learning: Applies to extra_tests/**/*.py : Use ruff to lint custom Python code

Applied to files:

  • .github/workflows/ci.yaml
📚 Learning: 2025-07-10T10:08:43.330Z
Learnt from: ShaharNaveh
Repo: RustPython/RustPython PR: 5932
File: .github/workflows/comment-commands.yml:18-24
Timestamp: 2025-07-10T10:08:43.330Z
Learning: In GitHub Actions workflows for the RustPython project, the maintainer ShaharNaveh prefers to keep workflows simple and doesn't mind if steps fail when the desired state is already achieved (e.g., user already assigned to an issue). Avoid suggesting complex error handling for edge cases they don't consider problematic.

Applied to files:

  • .github/workflows/ci.yaml
📚 Learning: 2025-09-11T05:06:59.971Z
Learnt from: CR
Repo: RustPython/RustPython PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-11T05:06:59.971Z
Learning: Applies to **/*.rs : Format Rust code with the default rustfmt style (run `cargo fmt`)

Applied to files:

  • .github/workflows/ci.yaml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
  • GitHub Check: Check Rust code with clippy
  • GitHub Check: Run snippets and cpython tests on wasm-wasi
  • GitHub Check: Run tests under miri
  • GitHub Check: Check the WASM package and demo
  • GitHub Check: Run snippets and cpython tests (macos-latest)
  • GitHub Check: Run snippets and cpython tests (ubuntu-latest)
  • GitHub Check: Run snippets and cpython tests (windows-latest)
  • GitHub Check: Run rust tests (macos-latest)
  • GitHub Check: Run rust tests (ubuntu-latest)
  • GitHub Check: Run rust tests (windows-latest)
  • GitHub Check: Ensure compilation on various targets
🔇 Additional comments (1)
.github/workflows/ci.yaml (1)

310-310: ✓ Lint job refactored correctly.

The separation of formatting concerns from the lint job aligns well with the PR objectives. Rustfmt has been removed, and the lint job now focuses solely on clippy checks.

Also applies to: 316-316

@youknowone youknowone changed the title Update CI auto-formate Update CI auto-format Nov 2, 2025
Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
Copy link
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: 2

🧹 Nitpick comments (1)
.github/workflows/auto-format.yaml (1)

63-65: Minor: Capitalize first word in comment text.

The message on line 65 should start with a capital letter for consistency.

          message: |
            Code has been automatically formatted.
            No action needed.
-           the changes were committed with `[skip ci]`.
+           The changes were committed with `[skip ci]`.
📜 Review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4755b21 and 4760c69.

📒 Files selected for processing (2)
  • .github/workflows/auto-format.yaml (1 hunks)
  • .github/workflows/ci.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/ci.yaml
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
Repo: RustPython/RustPython PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-11T05:06:59.971Z
Learning: Applies to **/*.rs : Run clippy and fix any warnings or lints introduced by your changes
Learnt from: CR
Repo: RustPython/RustPython PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-11T05:06:59.971Z
Learning: Applies to **/*.rs : Format Rust code with the default rustfmt style (run `cargo fmt`)
📚 Learning: 2025-09-11T05:06:59.971Z
Learnt from: CR
Repo: RustPython/RustPython PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-11T05:06:59.971Z
Learning: Applies to **/*.rs : Format Rust code with the default rustfmt style (run `cargo fmt`)

Applied to files:

  • .github/workflows/auto-format.yaml
📚 Learning: 2025-07-10T10:08:43.330Z
Learnt from: ShaharNaveh
Repo: RustPython/RustPython PR: 5932
File: .github/workflows/comment-commands.yml:18-24
Timestamp: 2025-07-10T10:08:43.330Z
Learning: In GitHub Actions workflows for the RustPython project, the maintainer ShaharNaveh prefers to keep workflows simple and doesn't mind if steps fail when the desired state is already achieved (e.g., user already assigned to an issue). Avoid suggesting complex error handling for edge cases they don't consider problematic.

Applied to files:

  • .github/workflows/auto-format.yaml
🔇 Additional comments (6)
.github/workflows/auto-format.yaml (6)

1-6: Trigger configuration looks good.

The workflow correctly responds to CI completion and supports manual dispatch.


10-24: Job configuration is appropriate.

Permissions correctly scoped for git commits and PR comments; concurrency setup prevents redundant runs.


27-32: Checkout configuration correct for workflow_run context.

Properly references github.event.workflow_run context to check out the PR head branch and repository.


34-37: Rust toolchain setup is standard.

Using dtolnay's stable toolchain with rustfmt component is the recommended approach.


39-42: Formatting command is correct.

Straightforward cargo fmt --all invocation.


21-21: Verify workflow_dispatch trigger intent—job will be skipped when manually triggered.

The job condition checks github.event.workflow_run.conclusion, which doesn't exist for workflow_dispatch events. This means the job will be skipped if manually triggered via the workflow_dispatch button.

If manual formatting is desired, update the condition to handle both event types:

-    if: ${{ github.event.workflow_run.conclusion == 'success' && !contains(github.event.workflow_run.head_commit.message, '[skip ci]') }}
+    if: ${{ (github.event_name == 'workflow_dispatch') || (github.event.workflow_run.conclusion == 'success' && !contains(github.event.workflow_run.head_commit.message, '[skip ci]')) }}

Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
@YashSuthar983
Copy link
Contributor Author

@youknowone please check as I seprate the auto formate workflow due to branch restrictions on ci .

Copy link
Member

@youknowone youknowone left a comment

Choose a reason for hiding this comment

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

Thank you so much, let's try

@youknowone youknowone merged commit 377151a into RustPython:main Nov 4, 2025
12 checks passed
YashSuthar983 added a commit to YashSuthar983/RustPython that referenced this pull request Nov 4, 2025
youknowone pushed a commit that referenced this pull request Nov 4, 2025
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.

2 participants