-
Notifications
You must be signed in to change notification settings - Fork 57
feat(quality): [#2157] require documented Clippy allows #2177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
1ef9d8d
aa0e74c
63e7251
734742a
fbfeaba
901b6b4
f35116b
df015f7
92c1eff
d018e9f
34e30e3
36ba76d
3c326bd
c3e00ed
4389614
a45c18c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| --- | ||
| name: add-workspace-member | ||
| description: Add or remove an explicit Cargo workspace member in Torrust Tracker. Use when editing the root workspace members list, adding a developer-tool crate, or registering a new standalone workspace package. | ||
| metadata: | ||
| author: torrust | ||
| version: "1.0" | ||
| semantic-links: | ||
| related-artifacts: | ||
| - Cargo.toml | ||
| - Containerfile | ||
| - .dockerignore | ||
| - .github/skills/dev/maintenance/add-rust-dependency/SKILL.md | ||
| --- | ||
|
|
||
| # Add a Cargo Workspace Member | ||
|
|
||
| Use this workflow when changing the root `Cargo.toml` `[workspace].members` list. It applies to | ||
| explicit members only; path dependencies can be auto-discovered separately by Cargo. | ||
|
|
||
| ## Required Review | ||
|
|
||
| 1. Add or remove the member in root `Cargo.toml`. | ||
| 2. Read the semantic link above that list and review `Containerfile` at the cargo-chef recipe | ||
| stage. Add or remove its manifest copy and all target stubs required by `cargo metadata`. | ||
| 3. Decide whether the member has value in container test archives. | ||
| - Production-relevant members remain included. | ||
| - Developer-only analysis, checks, benchmarks, clients, and host-only E2E tools are normally | ||
| excluded from every `cargo nextest archive` invocation. | ||
| - Keep the explanation and all four archive exclusion lists synchronized. | ||
| 4. Review `.dockerignore`; a manifest copied in the recipe stage must not be excluded from the | ||
| build context. | ||
|
|
||
| ## Verification | ||
|
|
||
| Run the narrow validation appropriate to the change before the normal repository gate: | ||
|
|
||
| ```bash | ||
| docker build --target recipe --file Containerfile . | ||
| ``` | ||
|
|
||
| For a changed archive inclusion/exclusion, also run: | ||
|
|
||
| ```bash | ||
| docker build --target test_debug --file Containerfile . | ||
| ``` | ||
|
|
||
| Then run `linter all`, `cargo test --doc --workspace`, and the mandatory pre-commit workflow. | ||
|
|
||
| ## Related Skills | ||
|
|
||
| - [`add-rust-dependency`](../add-rust-dependency/SKILL.md) — add an external dependency. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,8 @@ jobs: | |
| - id: checkout | ||
| name: Checkout Repository | ||
| uses: actions/checkout@v7 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - id: setup | ||
| name: Setup Toolchain | ||
|
|
@@ -90,6 +92,10 @@ jobs: | |
| name: Run All Linters | ||
| run: linter all | ||
|
|
||
| - id: documented-clippy-allows | ||
| name: Check Documented Clippy Allows | ||
| run: cargo run --quiet --package clippy-allow-reasons -- --base-ref "origin/${{ github.base_ref || 'develop' }}" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion (S-f; round-1 S6/S7 unaddressed). A check that needs only |
||
|
|
||
| - id: test-docs | ||
| name: Run Documentation Tests | ||
| run: cargo test --doc --workspace | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,10 @@ | ||
| # syntax=docker/dockerfile:latest | ||
| # | ||
| # semantic-links: | ||
| # skill-links: | ||
| # - add-workspace-member | ||
| # related-artifacts: | ||
| # - Cargo.toml # explicit workspace members; review this recipe when they change | ||
| # - .hadolint.yaml # hadolint global linting rules and ignore policies with rationale | ||
|
|
||
| # Torrust Tracker | ||
|
|
@@ -72,6 +75,7 @@ COPY console/tracker-client/Cargo.toml console/tracker-client/ | |
| # Build stages below) because they are not part of the production tracker service | ||
| # and do not need to be tested inside the container image: | ||
| # - workspace-coupling (analysis/coupling tool, no production value) | ||
| # - clippy-allow-reasons (prospective source-quality check, no production value) | ||
|
josecelano marked this conversation as resolved.
|
||
| # - torrust-tracker-torrent-repository-benchmarking (benchmarking only) | ||
| # - torrust-tracker-client (CLI dev tools: tracker_client, tracker_checker, etc.) | ||
| # - torrust-tracker-e2e-tools (E2E runners + profiling tool, GHA host-only) | ||
|
|
@@ -82,6 +86,7 @@ COPY console/tracker-client/Cargo.toml console/tracker-client/ | |
| # or declared target file is missing. `cargo chef prepare` has no `--exclude` | ||
| # flag (only `--bin`), so these stubs cannot be omitted from the recipe stage. | ||
| COPY contrib/dev-tools/analysis/workspace-coupling/Cargo.toml contrib/dev-tools/analysis/workspace-coupling/ | ||
| COPY contrib/dev-tools/checks/clippy-allow-reasons/Cargo.toml contrib/dev-tools/checks/clippy-allow-reasons/ | ||
| COPY packages/e2e-tools/Cargo.toml packages/e2e-tools/ | ||
| COPY packages/persistence-benchmark/Cargo.toml packages/persistence-benchmark/ | ||
| COPY packages/axum-health-check-api-server/Cargo.toml packages/axum-health-check-api-server/ | ||
|
|
@@ -127,6 +132,7 @@ RUN mkdir -p \ | |
| packages/e2e-tools/src/bin \ | ||
| packages/persistence-benchmark/src/bin \ | ||
| contrib/dev-tools/analysis/workspace-coupling/src \ | ||
| contrib/dev-tools/checks/clippy-allow-reasons/src \ | ||
| console/tracker-client/src/bin \ | ||
| packages/axum-health-check-api-server/src \ | ||
| packages/axum-http-server/src \ | ||
|
|
@@ -163,6 +169,8 @@ RUN mkdir -p \ | |
| packages/e2e-tools/src/bin/qbittorrent_e2e_runner.rs \ | ||
| packages/persistence-benchmark/src/bin/persistence_benchmark_runner.rs \ | ||
| contrib/dev-tools/analysis/workspace-coupling/src/main.rs \ | ||
| contrib/dev-tools/checks/clippy-allow-reasons/src/lib.rs \ | ||
| contrib/dev-tools/checks/clippy-allow-reasons/src/main.rs \ | ||
| console/tracker-client/src/lib.rs \ | ||
| console/tracker-client/src/bin/http_tracker_client.rs \ | ||
| console/tracker-client/src/bin/tracker_checker.rs \ | ||
|
|
@@ -222,7 +230,7 @@ COPY --from=recipe /build/recipe.json /build/recipe.json | |
| # Note: `cargo chef cook` does not support `--exclude` (the cargo-chef CLI only | ||
| # exposes `--workspace` and `--package`, not `--exclude`). The excluded workspace | ||
| # members (workspace-coupling, torrust-tracker-torrent-repository-benchmarking, | ||
| # torrust-tracker-client, torrust-tracker-contrib-bencode, | ||
| # clippy-allow-reasons, torrust-tracker-client, torrust-tracker-contrib-bencode, | ||
| # torrust-tracker-e2e-tools, torrust-tracker-persistence-benchmark) are therefore | ||
| # still compiled as part of the cook skeleton (their Cargo.toml manifests are in | ||
| # the recipe, so cargo-chef cooks them). The build-time savings come from the | ||
|
|
@@ -235,6 +243,7 @@ RUN cargo chef cook --tests --workspace --all-features --recipe-path /build/reci | |
| # by pre-faulting the linker phases, avoiding redundant linking work in later stages. | ||
| RUN cargo nextest archive --tests --workspace --all-features \ | ||
| --exclude workspace-coupling \ | ||
| --exclude clippy-allow-reasons \ | ||
| --exclude torrust-tracker-torrent-repository-benchmarking \ | ||
| --exclude torrust-tracker-client \ | ||
| --exclude torrust-tracker-contrib-bencode \ | ||
|
|
@@ -261,6 +270,7 @@ RUN cargo chef cook --tests --workspace --all-features --recipe-path /build/reci | |
| # by pre-faulting the linker phases, avoiding redundant linking work in later stages. | ||
| RUN cargo nextest archive --tests --workspace --all-features \ | ||
| --exclude workspace-coupling \ | ||
| --exclude clippy-allow-reasons \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit (N-b, new). This continuation line is indented with two spaces; every other The substance of C1 is fixed here and I confirmed it independently: |
||
| --exclude torrust-tracker-torrent-repository-benchmarking \ | ||
| --exclude torrust-tracker-client \ | ||
| --exclude torrust-tracker-contrib-bencode \ | ||
|
|
@@ -275,6 +285,7 @@ WORKDIR /build/src | |
| COPY . /build/src | ||
| RUN cargo nextest archive --tests --workspace --all-features \ | ||
| --exclude workspace-coupling \ | ||
| --exclude clippy-allow-reasons \ | ||
| --exclude torrust-tracker-torrent-repository-benchmarking \ | ||
| --exclude torrust-tracker-client \ | ||
| --exclude torrust-tracker-contrib-bencode \ | ||
|
|
@@ -288,6 +299,7 @@ WORKDIR /build/src | |
| COPY . /build/src | ||
| RUN cargo nextest archive --tests --workspace --all-features \ | ||
| --exclude workspace-coupling \ | ||
| --exclude clippy-allow-reasons \ | ||
| --exclude torrust-tracker-torrent-repository-benchmarking \ | ||
| --exclude torrust-tracker-client \ | ||
| --exclude torrust-tracker-contrib-bencode \ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| [package] | ||
| description = "Prospective validation for documented Clippy allow attributes." | ||
| name = "clippy-allow-reasons" | ||
| publish = false | ||
|
|
||
| authors.workspace = true | ||
| edition.workspace = true | ||
| rust-version.workspace = true | ||
| version = "0.1.0" | ||
|
|
||
| [lints] | ||
| workspace = true | ||
|
|
||
| [dependencies] | ||
| proc-macro2 = { version = "1", features = [ "span-locations" ] } | ||
| serde = { version = "1", features = [ "derive" ] } | ||
| serde_json = "1" | ||
| syn = { version = "2", features = [ "full", "visit" ] } |
Uh oh!
There was an error while loading. Please reload this page.