Skip to content

Feature request: rtk ansible-lint wrapper (group violations by rule, cap output) #1781

Open

Description

@globalsecurepayments

Summary

Add rtk ansible-lint to the built-in wrapper set. ansible-lint is one of the verbose linters that doesn't yet have an rtk filter, and like rtk lint (ESLint) and rtk rubocop, it benefits from rule-grouping + ANSI strip.

Sizing

Real-world frequency from a 30-day Claude Code window on an Ansible-heavy infra repo: 11 invocations flagged by rtk discover as unhandled. Each invocation against a non-trivial role tree produces 100-500 lines of output (per-task violations, with full file paths + 5+ line context blocks per finding), often with ANSI color.

Two representative invocations:

ansible-lint roles/ playbooks/
ansible-lint --offline -p

I checked the issue tracker and didn't find a prior request for this specific tool — closest neighbors are #1607/#1680/#789 (ssh) and #1737/#1738 (op/1Password CLI), which suggests linter wrappers for less-mainstream-but-still-common tools fit the project's direction.

Proposed shape

Pattern lifted from rtk lint (ESLint grouped output) and rtk rubocop:

  • Strip ANSI escapes
  • Strip the WARNING: PATH altered to expand ~ and AnsibleWarning: Enable tracemalloc boilerplate that ansible-lint emits unconditionally
  • Group violations by rule-id (yaml[indentation], var-naming, risky-shell-pipe, etc.) with a <rule-id>: <count> header line per group
  • Show the first N (e.g. 3) sample paths per rule-id, then a … +K more line
  • Preserve the final summary line (Passed: 0 failure(s), 0 warning(s) … / Failed: …) verbatim — that's the signal an agent acts on
  • Pass-through mode for --version, --help, -L (list rules), -T (list tags) — these have small fixed output and shouldn't be touched

Subcommand surface should mirror existing wrappers: rtk ansible-lint <args...> shells through to ansible-lint <args...> with the filter applied to stdout/stderr.

Why this fits the existing pattern

  • The rtk lint wrapper already does ESLint rule-grouping, so the heuristic exists in code.
  • ansible-lint output is structurally similar to ESLint's: file path, line:col, rule-id, message, optional context block.
  • ansible-lint exit code semantics are the same as ESLint (0 = clean, non-0 = violations), so no special handling needed for && / || chains.

Verification

If an agent runs rtk ansible-lint roles/some-role/ on a tree with 30 violations spanning 5 rule-ids, expected compressed output is ~10 lines (rule-id headers + 3 sample paths each + summary), down from ~150 lines raw. Estimated savings: ~70% on a typical infra-repo lint pass, similar to the rtk lint baseline.

Out of scope for this issue (tracked separately upstream)

Environment

  • rtk 0.39.0 (just upgraded from 0.35.0; verified the parser fixes for ps -p PID -o, pnpm install --frozen-lockfile, grep -q, and ansible-playbook --syntax-check all landed in 0.36-0.39, nice work)
  • ansible-lint 26.4.0 / ansible-core 2.20.5
  • macOS arm64, brew install

Activity

  1. added
    enhancement
    help wanted
    on May 27, 2026
  2. pszymkowiak commented on May 27, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    ✨ Category feature
    🟡 Priority medium
    🎯 Confidence 93%

    Summary

    Well-specified request to add rtk ansible-lint wrapper with rule-grouping, ANSI stripping, and boilerplate suppression — follows the existing rtk lint/rtk rubocop pattern; no duplicate found in open issues.


    Triaged automatically by wshm · This is an automated analysis, not a human review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clienhancementhelp wantedpriority:medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions