Skip to content

Format workflow: auto-fix and commit formatting/lint issues; extend coverage to tests/**/*.rs#22

Merged
nunoplopes merged 11 commits intomasterfrom
copilot/add-clippy-and-clang-format-workflow
Apr 21, 2026
Merged

Format workflow: auto-fix and commit formatting/lint issues; extend coverage to tests/**/*.rs#22
nunoplopes merged 11 commits intomasterfrom
copilot/add-clippy-and-clang-format-workflow

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 20, 2026

The format workflow only reported issues without fixing them, and skipped all .rs files under tests/ that aren't part of a Cargo project.

Workflow changes

  • permissions: contents: write + checkout with ref: ${{ github.head_ref || github.ref_name }} so the action can push back to the correct branch
  • Auto-fix phase (runs before the existing check steps):
    • clang-format -i for C++
    • cargo clippy --fix --allow-dirty for all three Rust crates (runs before cargo fmt so clippy's edits are normalized by rustfmt)
    • cargo fmt for all three Rust crates
    • rustfmt across tests/**/*.rs
  • stefanzweifel/git-auto-commit-action@v5 commits any resulting changes back to the branch automatically
  • Existing check steps remain unchanged as a verification pass (catches anything that can't be auto-fixed)

Coverage gap: tests/**/*.rs

These files are lit-test expected outputs compared byte-for-byte against cpp2rust output. They can't be linted by clippy without a Cargo project context, but rustfmt runs on them directly. Since cpp2rust already calls rustfmt on its output, keeping the expected files formatted with the same pinned toolchain (1.94.0) keeps them consistent.

Auto-fixes applied in this PR

Running the new workflow locally produced these fixes (now committed):

  • rules/build.rs: collapsible_if and collapsible_str_replace clippy suggestions
  • tests/unit/out/refcount/ub*.rs (22 files): import order normalized to rustfmt 1.94.0
  • tests/unit/out/unsafe/bit_cast.rs: redundant braces removed (use libcc2rs::{prepostfix::*}use libcc2rs::prepostfix::*)

@nunoplopes nunoplopes force-pushed the copilot/add-clippy-and-clang-format-workflow branch from f72b9fd to 25f62a9 Compare April 20, 2026 18:13
@nunoplopes nunoplopes marked this pull request as ready for review April 20, 2026 18:14
@nunoplopes nunoplopes merged commit ff93441 into master Apr 21, 2026
16 checks passed
@nunoplopes nunoplopes deleted the copilot/add-clippy-and-clang-format-workflow branch April 21, 2026 08:44
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