From: Daniel Gomez <da.gomez@kernel.org>
To: Luis Chamberlain <mcgrof@kernel.org>,
Chuck Lever <cel@kernel.org>, Daniel Gomez <da.gomez@kruces.com>,
kdevops@lists.linux.dev
Subject: Re: [RFT] scripts: add fix_ansible_lint.py
Date: Tue, 26 Aug 2025 22:56:44 +0200 [thread overview]
Message-ID: <3bb53912-6b64-481b-9c8c-0f30c4479477@kernel.org> (raw)
In-Reply-To: <20250823012911.898920-1-mcgrof@kernel.org>
On 23/08/2025 03.29, Luis Chamberlain wrote:
> Add a script which fixes all fatal ansible-lint errors.
>
> Usage examples:
> python3 scripts/fix_ansible_lint.py --changes-only
>
> python3 scripts/fix_ansible_lint.py
>
> python3 scripts/fix_ansible_lint.py playbooks/foo.yml playbooks/bar*.yml
>
> python3 scripts/fix_ansible_lint.py --dry-run
>
> python3 scripts/fix_ansible_lint.py --changes-only --check
>
> This tool goes beyond ansible-lint --fix by handling more issue types
> and providing better control over what gets fixed.
>
> Generated-by: Claude AI
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
This is great!
I think we just need to be able to apply recursively and one rule at a time.
And it would be great to have these 2 combined:
https://github.com/dkruces/kdevops/blob/ansible-lint-wrapper/scripts/ansible-lint-fix-rules.py
The ansible-lint-fix-rules is just an ansible-lint --fix=<rule_id> wrapper. It
creates a commit based on a template with the appropriate Generated by: tag and
rule applied. I adapt the template last minute before pushing the linter fixes
as it was too verbose. Adapting that would be great too.
I think we can add these features to the fix_ansible_lint.py script. BTW, I
really like the option to apply it only to the last commit's lines. I tried
implementing it myself but had some trouble. Thanks!
...
Here's the combination of both scripts, and the missing linter fixes:
https://github.com/linux-kdevops/kdevops/tree/dagomez/more-ansible-lint-fixes
I did not manage to split the manual rules in smaller sub-groups/rules. That's
the last piece missing, I think. I've sent this branch to the CI for testing.
Here the entire claude development branch:
https://github.com/dkruces/kdevops/commits/ansible-lint-comprehensive-fixer/
prev parent reply other threads:[~2025-08-26 20:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-23 1:29 [RFT] scripts: add fix_ansible_lint.py Luis Chamberlain
2025-08-25 19:42 ` Daniel Gomez
2025-08-26 20:56 ` Daniel Gomez [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3bb53912-6b64-481b-9c8c-0f30c4479477@kernel.org \
--to=da.gomez@kernel.org \
--cc=cel@kernel.org \
--cc=da.gomez@kruces.com \
--cc=kdevops@lists.linux.dev \
--cc=mcgrof@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox