|
| 1 | +# Replace Local `packages/linting` with Published `torrust-linting` Crate |
| 2 | + |
| 3 | +**Issue**: #416 |
| 4 | +**Parent Epic**: None |
| 5 | +**Related**: None |
| 6 | + |
| 7 | +## Overview |
| 8 | + |
| 9 | +The `packages/linting` workspace package has been extracted and published to |
| 10 | +[crates.io as `torrust-linting`](https://crates.io/crates/torrust-linting) |
| 11 | +(v0.1.0). This makes it an independently versioned and reusable library for any |
| 12 | +Torrust project. |
| 13 | + |
| 14 | +This task replaces the local path dependency with the published crate and removes |
| 15 | +the now-redundant workspace member. |
| 16 | + |
| 17 | +## Goals |
| 18 | + |
| 19 | +- [ ] Replace `torrust-linting = { path = "packages/linting" }` with `torrust-linting = "0.1.0"` in `Cargo.toml` |
| 20 | +- [ ] Remove `"packages/linting"` from the workspace `members` list in `Cargo.toml` |
| 21 | +- [ ] Delete the `packages/linting/` directory |
| 22 | +- [ ] Update documentation that references `packages/linting/` |
| 23 | +- [ ] Update `packages/README.md` to reflect that `torrust-linting` is now an external dependency |
| 24 | +- [ ] Verify the build and all tests pass after the change |
| 25 | + |
| 26 | +## 🏗️ Architecture Requirements |
| 27 | + |
| 28 | +**DDD Layer**: N/A (build infrastructure / workspace configuration) |
| 29 | +**Module Path**: N/A |
| 30 | +**Pattern**: External crate dependency substitution |
| 31 | + |
| 32 | +### Architectural Constraints |
| 33 | + |
| 34 | +- [ ] No changes to `src/` code — the public API of `torrust-linting` on crates.io matches the local package |
| 35 | + |
| 36 | +### Anti-Patterns to Avoid |
| 37 | + |
| 38 | +- ❌ Keeping the local package in the workspace after migrating (dead code / confusion) |
| 39 | +- ❌ Updating `src/bin/linter.rs` imports — the API is identical and no source changes are needed |
| 40 | + |
| 41 | +## Specifications |
| 42 | + |
| 43 | +### Cargo.toml Changes |
| 44 | + |
| 45 | +**Before**: |
| 46 | + |
| 47 | +```toml |
| 48 | +[workspace] |
| 49 | +members = [ |
| 50 | + "packages/linting", |
| 51 | + "packages/dependency-installer", |
| 52 | + "packages/sdk", |
| 53 | + "packages/deployer-types", |
| 54 | +] |
| 55 | + |
| 56 | +[dependencies] |
| 57 | +torrust-linting = { path = "packages/linting" } |
| 58 | +``` |
| 59 | + |
| 60 | +**After**: |
| 61 | + |
| 62 | +```toml |
| 63 | +[workspace] |
| 64 | +members = [ |
| 65 | + "packages/dependency-installer", |
| 66 | + "packages/sdk", |
| 67 | + "packages/deployer-types", |
| 68 | +] |
| 69 | + |
| 70 | +[dependencies] |
| 71 | +torrust-linting = "0.1.0" |
| 72 | +``` |
| 73 | + |
| 74 | +### Directory Removal |
| 75 | + |
| 76 | +Delete `packages/linting/` in its entirety (the code is now maintained in the |
| 77 | +upstream [torrust/torrust-linting](https://github.com/torrust/torrust-linting) |
| 78 | +repository). |
| 79 | + |
| 80 | +### Documentation Updates |
| 81 | + |
| 82 | +Files that reference `packages/linting` and will need updating: |
| 83 | + |
| 84 | +| File | Change | |
| 85 | +|------|--------| |
| 86 | +| `packages/README.md` | Remove `packages/linting` entry; add note that `torrust-linting` is an external crate | |
| 87 | +| `docs/codebase-architecture.md` | Update linting section to reference the external crate | |
| 88 | +| `.github/skills/dev/git-workflow/run-linters/skill.md` | Update link to linting framework | |
| 89 | +| `.github/skills/dev/git-workflow/run-linters/references/linters.md` | Update package location description | |
| 90 | + |
| 91 | +## Implementation Plan |
| 92 | + |
| 93 | +### Phase 1: Update Cargo workspace and dependency (< 30 min) |
| 94 | + |
| 95 | +- [ ] Task 1.1: Remove `"packages/linting"` from `[workspace] members` in `Cargo.toml` |
| 96 | +- [ ] Task 1.2: Replace path dependency with `torrust-linting = "0.1.0"` in `[dependencies]` |
| 97 | +- [ ] Task 1.3: Run `cargo build` and `cargo test` to confirm no compilation errors |
| 98 | + |
| 99 | +### Phase 2: Remove local package (< 15 min) |
| 100 | + |
| 101 | +- [ ] Task 2.1: Delete `packages/linting/` directory |
| 102 | +- [ ] Task 2.2: Run `cargo build` and `cargo test` again to confirm clean build after deletion |
| 103 | + |
| 104 | +### Phase 3: Update documentation (< 30 min) |
| 105 | + |
| 106 | +- [ ] Task 3.1: Update `packages/README.md` — remove local package entry, document as external |
| 107 | +- [ ] Task 3.2: Update `docs/codebase-architecture.md` — linting section |
| 108 | +- [ ] Task 3.3: Update `.github/skills/` references to `packages/linting` |
| 109 | + |
| 110 | +## Acceptance Criteria |
| 111 | + |
| 112 | +> **Note for Contributors**: These criteria define what the PR reviewer will check. |
| 113 | +> Use this as your pre-review checklist before submitting the PR to minimize |
| 114 | +> back-and-forth iterations. |
| 115 | +
|
| 116 | +**Quality Checks**: |
| 117 | + |
| 118 | +- [ ] Pre-commit checks pass: `./scripts/pre-commit.sh` |
| 119 | + |
| 120 | +**Task-Specific Criteria**: |
| 121 | + |
| 122 | +- [ ] `packages/linting/` directory no longer exists in the repository |
| 123 | +- [ ] `Cargo.toml` workspace `members` does not include `"packages/linting"` |
| 124 | +- [ ] `Cargo.toml` dependency is `torrust-linting = "0.1.0"` (crates.io) |
| 125 | +- [ ] `cargo build` and `cargo test` pass with no errors |
| 126 | +- [ ] No remaining references to `packages/linting` in source or documentation |
| 127 | + |
| 128 | +## Related Documentation |
| 129 | + |
| 130 | +- [crates.io: torrust-linting](https://crates.io/crates/torrust-linting) |
| 131 | +- [GitHub: torrust/torrust-linting](https://github.com/torrust/torrust-linting) |
| 132 | +- [packages/README.md](../../packages/README.md) |
| 133 | +- [docs/codebase-architecture.md](../codebase-architecture.md) |
| 134 | + |
| 135 | +## Notes |
| 136 | + |
| 137 | +The published crate API is identical to the local package — `src/bin/linter.rs` |
| 138 | +and all other callers require no changes. Only the Cargo configuration and |
| 139 | +package directory are affected. |
0 commit comments