Replace the MegaLinter idea with Torrust internal linting tooling and integrate it into CI for this repository.
- Target issue: #523
- CI workflow to modify: .github/workflows/testing.yaml
- External reference workflow: https://raw.githubusercontent.com/torrust/torrust-tracker-deployer/refs/heads/main/.github/workflows/linting.yml
- Approved branch name:
523-internal-linting-tool - Commands:
git fetch --all --prunegit checkout developgit pull --ff-onlygit checkout -b 523-internal-linting-tool
- Checkpoint:
git branch --show-currentshould output523-internal-linting-tool.
- Identify/install internal linting package/tool used by Torrust (likely
torrust-lintingor equivalent wrapper). - Ensure local runtime dependencies are present (if any).
- Note: linter config files (step 2) must exist in the repo root before a full suite run; it is fine to do a first exploratory run first to discover which linters are active.
- Run the internal linting command against this repository.
- Capture the exact command and output summary for reproducibility.
- Checkpoint:
- Linting command exits with code
0.
- Linting command exits with code
Some linters require a config file in the repo root. Use the deployer configs as reference and adapt values to this repository.
| File | Linter | Reference |
|---|---|---|
.markdownlint.json |
markdownlint | https://raw.githubusercontent.com/torrust/torrust-tracker-deployer/refs/heads/main/.markdownlint.json |
.taplo.toml |
taplo (TOML fmt) | https://raw.githubusercontent.com/torrust/torrust-tracker-deployer/refs/heads/main/.taplo.toml |
.yamllint-ci.yml |
yamllint | https://raw.githubusercontent.com/torrust/torrust-tracker-deployer/refs/heads/main/.yamllint-ci.yml |
Key adaptations to make per file:
.markdownlint.json: review line-length rules and Markdown conventions used in this repo's docs..taplo.toml: updateexcludelist to match this repo's generated/runtime folders (e.g.target/**,storage/**) instead of the deployer-specific ones (build/**,data/**,envs/**)..yamllint-ci.yml: updateignoreblock to reflect this repo's generated/runtime directories instead of cloud-init and deployer folders.
Commit message: ci(lint): add linter config files (.markdownlint.json, .taplo.toml, .yamllint-ci.yml)
Checkpoint:
- Config files are present in the repo root.
- Running each individual linter against the repo with the config produces expected/controlled output.
- If the linting suite reports failures:
- Group findings by linter (for example: formatting, clippy, docs, spelling, yaml, etc.).
- Fix only one linter category at a time.
- Create one commit per linter category.
- Commit style proposal:
fix(lint/<linter-name>): resolve <brief issue summary>
- Constraints:
- Do not mix workflow/tooling changes with source lint fixes in the same commit.
- Keep each commit minimal and reviewable.
- Checkpoint:
- Re-run linting suite; all checks pass before moving to workflow integration.
- Read and analyze:
- Extract and adapt:
- Trigger strategy.
- Tool setup/install method.
- Cache strategy.
- Invocation command and CI fail behavior.
- Checkpoint:
- Document a short mapping from deployer workflow pattern to this repo’s
testing.yamljob structure.
- Document a short mapping from deployer workflow pattern to this repo’s
- Update the current
check/lint-related section to run the internal linting command. - Replace existing lint/check execution path with the internal linting tool in this migration (no parallel transition mode).
- Ensure matrix/toolchain compatibility is explicit (nightly/stable behavior decided and documented).
- Validate workflow syntax before commit.
- Checkpoint:
- Workflow is valid and executes linting through internal tool.
- Commit only workflow-related changes in a dedicated commit.
- Commit message proposal:
ci(lint): switch testing workflow to internal linting tool
- Checkpoint:
git show --name-only --stat HEADincludes only expected workflow files (and any required supporting CI files if intentionally added).
- Verify remote exists:
git remote -v
- Push branch:
git push -u josecelano 523-internal-linting-tool
- Open PR targeting
torrust/torrust-tracker:developwith headjosecelano:523-internal-linting-tool. - PR content should include:
- Why internal linting over MegaLinter.
- Summary of lint-fix commits by linter.
- Summary of workflow change.
- Evidence (local run + CI status).
- Checkpoint:
- PR is open, linked to issue #523, and ready for review.
- Keep PR review-friendly by separating commits by concern:
- Linter config files (step 2)
- Per-linter source fixes (step 3, only if needed)
- CI workflow migration (step 6)
- Use Conventional Commits for all commits in this implementation.
- If lint checks differ between local and CI, align tool versions and execution flags before merging.
- Avoid broad refactors unrelated to lint failures.
- Branch name:
523-internal-linting-tool. - CI strategy: replace existing lint/check path with internal linting.
- Commit convention: yes, use Conventional Commits.
- PR target: base
torrust/torrust-tracker:develop, headjosecelano:523-internal-linting-tool.
- Risk: Internal linting wrapper may not be version-pinned and may produce unstable CI behavior.
- Mitigation: Pin tool version in workflow installation step.
- Risk: Internal linting may overlap with existing checks, increasing CI time.
- Mitigation: Remove redundant jobs only after verifying coverage parity.
- Risk: Tool may require secrets or environment assumptions not available in CI.
- Mitigation: Run dry-run in GitHub Actions on branch before requesting review.