Repository navigation
refactor: replace reviewdog with direct cargo calls and PR comment - #67
Conversation
3488859 to
bc47422
Compare
0ae1c3c to
5afa22d
Compare
| run: | | ||
| git fetch --depth=1 origin "${{ inputs.base-sha }}" 2>/dev/null || true | ||
| git diff "${{ inputs.base-sha }}...HEAD" --unified=0 > /tmp/pr.diff | ||
| echo "diff_file=/tmp/pr.diff" >> "$GITHUB_OUTPUT" |
There was a problem hiding this comment.
question: Why is it put as output result, but never used?
| uses: giraffate/clippy-action@v1 | ||
| - name: Post nightly-clippy comment on PR | ||
| if: >- | ||
| inputs.post-pr-comment == 'true' && github.event_name == 'pull_request' && steps.clippy.outputs.has_findings == 'true' && github.event.pull_request.head.repo.full_name == github.repository |
There was a problem hiding this comment.
I think this is missing the ${{ }}, otherwise it's not evaluated
There was a problem hiding this comment.
Seems to work fine on the test PR I did on CDA eclipse-opensovd/classic-diagnostic-adapter#385 (comment), anyhow I will test again once I addressed the remaining issues :)
There was a problem hiding this comment.
No it's not necessary. But after looking at this again after some passed since I created this PR I was still pretty unhappy with how complicated it still is. I dropped all the comment handling for format and clippy, just look at the pipeline output directly.
I did add two small wrapper scripts, so we can configure pre commit properly for format and clippy.
Example for CDA.
Now if you run pre-commit it will run format with the correct nightly stage and clippy with 1.88 and the pinned nightly version.
We might want to update the nightly version to something more recent in the future but that is out of scope for here.
- id: cargo-fmt
args:
- --toolchain=nightly-2025-07-14
- --all
- id: cargo-clippy
name: clippy (stable)
args:
- --toolchain=1.88
- --all-targets
- --locked
- --
- -D
- warnings
- id: cargo-clippy
name: clippy (nightly)
args:
- --toolchain=nightly-2025-07-14
- --all-targets
- --locked
- --
- -D
- warnings780f272 to
c512250
Compare
|
needs rebase (conflict in README) |
- Remove rust-lint-and-format-action reviewdog integration (giraffate/clippy-action, reviewdog setup, checkstyle XML helpers) - Remove shared-config/cargo-fmt.sh and cargo-clippy.sh; pre-commit hooks now call cargo directly (language: system) - Nightly clippy runs warn-only (continue-on-error); findings are posted as a PR comment with a disclaimer that they are informational and may be unrelated to PR changes; no comment posted when clean - New action inputs: toolchain, all-features, post-pr-comment - Document RUSTUP_TOOLCHAIN=nightly as the local opt-in for nightly clippy via prek Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
c512250 to
0f19d76
Compare
|
@floroks rebased :) |
mbfm
left a comment
There was a problem hiding this comment.
Mostly nitpicks, but I spotted one bug as well.
| cargo = "cargo" | ||
| cmd = [cargo] |
There was a problem hiding this comment.
Nitpick:
| cargo = "cargo" | |
| cmd = [cargo] | |
| cmd = ["cargo"] |
There was a problem hiding this comment.
I am going to assume you also wanted me to remove the pointless variable above :)
| cargo = "cargo" | ||
| cmd = [cargo] |
There was a problem hiding this comment.
Nitpick:
| cargo = "cargo" | |
| cmd = [cargo] | |
| cmd = ["cargo"] |
| description: 'Reporter to use for reviewdog' | ||
| required: false | ||
| default: 'github-pr-review' | ||
| default: '--all-features --all-targets --D warnings' |
There was a problem hiding this comment.
I think, this should be:
| default: '--all-features --all-targets --D warnings' | |
| default: '--all-features --all-targets --locked -- --deny=warnings' |
The --locked is from .pre-commit-hooks.yaml. Not sure, if you maybe decided against that here.
| || FMT_EXIT=$? | ||
| - name: Format check (rustfmt) | ||
| id: fmt | ||
| continue-on-error: true |
There was a problem hiding this comment.
| continue-on-error: true | |
| continue-on-error: true # fail later to present all errors to user at once |
I think, you mentioned this to me at some point. Maybe good to document that. 🙂
There was a problem hiding this comment.
Using same comment for both lines.
| /tmp/checkstyle.xml /tmp/rustfmt_stderr.log "$STDERR_SEVERITY" | ||
| - name: Clippy | ||
| id: clippy | ||
| continue-on-error: true |
There was a problem hiding this comment.
| continue-on-error: true | |
| continue-on-error: true # fail later to present all errors to user at once |
There was a problem hiding this comment.
Using # Set to 'true' to present all errors to user at once, 'false' fails immediately.
| - -D | ||
| - warnings |
There was a problem hiding this comment.
Easier to understand like this:
| - -D | |
| - warnings | |
| - --deny=warnings |
14e4fcd to
6708173
Compare
Signed-off-by: Alexander Mohr <alexander.m.mohr@mercedes-benz.com>
6708173 to
dc0f14e
Compare
Summary
Checklist
Related
Notes for Reviewers